Convert function declarations from K&R to ANSI style.

cproto (http://invisible-island.net/cproto/) was used to do the bulk of
the work in batch; even the most recent version had some issues with
typedef'd parameters; a quick "patch" was to modify `lex.l` to
explicitly include all vim typedefs as known types. One example from
`vim.h` is

    typedef unsigned char char_u;

which was added in `lex.l` as

    <INITIAL>char_u    { save_text_offset(); return T_CHAR; }

Even with these changes there were some problems:

* Two files (`mbyte.c` and `os_unix.c`) were not cleanly converted.
* Any function with the `UNUSED` macro in its parameter list was not converted.

Rather than spend more time fixing the automated approach, the two files
`mbyte.c` and `os_unix.c` were converted by hand.

The `UNUSED` macros were compiler specific, and the alternative, generic
version would require a different syntax, so in order to simplify the
conversion all uses of `UNUSED` were stripped, and then the sources were
run back through cproto. It is planned to reconsider each use of
`UNUSED` manually using a new macro definition.
This commit is contained in:
scott-linder 2014-02-23 15:34:45 -05:00
parent 1bcbc42330
commit b76c358f3d
54 changed files with 6840 additions and 10886 deletions

View File

@ -12,7 +12,6 @@
#define SIZEOF_OFF_T @SIZEOF_OFF_T@
#define _FILE_OFFSET_BITS 64
#define HAVE_ATTRIBUTE_UNUSED 1
#define HAVE_BCMP 1
#define HAVE_DATE_TIME 1
#define HAVE_DIRENT_H 1

View File

@ -42,8 +42,7 @@ static int A_is_special __ARGS((int c));
/*
* Returns True if c is an ISO-8859-6 shaped ARABIC letter (user entered)
*/
static int A_is_a(cur_c)
int cur_c;
static int A_is_a(int cur_c)
{
switch (cur_c) {
case a_HAMZA:
@ -93,8 +92,7 @@ int cur_c;
/*
* Returns True if c is an Isolated Form-B ARABIC letter
*/
static int A_is_s(cur_c)
int cur_c;
static int A_is_s(int cur_c)
{
switch (cur_c) {
case a_s_HAMZA:
@ -143,8 +141,7 @@ int cur_c;
/*
* Returns True if c is a Final shape of an ARABIC letter
*/
static int A_is_f(cur_c)
int cur_c;
static int A_is_f(int cur_c)
{
switch (cur_c) {
case a_f_ALEF_MADDA:
@ -195,8 +192,7 @@ int cur_c;
/*
* Change shape - from ISO-8859-6/Isolated to Form-B Isolated
*/
static int chg_c_a2s(cur_c)
int cur_c;
static int chg_c_a2s(int cur_c)
{
int tempc;
@ -323,8 +319,7 @@ int cur_c;
/*
* Change shape - from ISO-8859-6/Isolated to Initial
*/
static int chg_c_a2i(cur_c)
int cur_c;
static int chg_c_a2i(int cur_c)
{
int tempc;
@ -451,8 +446,7 @@ int cur_c;
/*
* Change shape - from ISO-8859-6/Isolated to Medial
*/
static int chg_c_a2m(cur_c)
int cur_c;
static int chg_c_a2m(int cur_c)
{
int tempc;
@ -579,8 +573,7 @@ int cur_c;
/*
* Change shape - from ISO-8859-6/Isolated to final
*/
static int chg_c_a2f(cur_c)
int cur_c;
static int chg_c_a2f(int cur_c)
{
int tempc;
@ -717,8 +710,7 @@ int cur_c;
/*
* Change shape - from Initial to Medial
*/
static int chg_c_i2m(cur_c)
int cur_c;
static int chg_c_i2m(int cur_c)
{
int tempc;
@ -803,8 +795,7 @@ int cur_c;
/*
* Change shape - from Final to Medial
*/
static int chg_c_f2m(cur_c)
int cur_c;
static int chg_c_f2m(int cur_c)
{
int tempc;
@ -911,8 +902,7 @@ int cur_c;
/*
* Change shape - from Combination (2 char) to an Isolated
*/
static int chg_c_laa2i(hid_c)
int hid_c;
static int chg_c_laa2i(int hid_c)
{
int tempc;
@ -940,8 +930,7 @@ int hid_c;
/*
* Change shape - from Combination-Isolated to Final
*/
static int chg_c_laa2f(hid_c)
int hid_c;
static int chg_c_laa2f(int hid_c)
{
int tempc;
@ -968,8 +957,7 @@ int hid_c;
/*
* Do "half-shaping" on character "c". Return zero if no shaping.
*/
static int half_shape(c)
int c;
static int half_shape(int c)
{
if (A_is_a(c))
return chg_c_a2i(c);
@ -987,13 +975,7 @@ int c;
* (not shaped)
* in: "next_c" is the next character (not shaped).
*/
int arabic_shape(c, ccp, c1p, prev_c, prev_c1, next_c)
int c;
int *ccp;
int *c1p;
int prev_c;
int prev_c1;
int next_c;
int arabic_shape(int c, int *ccp, int *c1p, int prev_c, int prev_c1, int next_c)
{
int curr_c;
int shape_c;
@ -1054,9 +1036,11 @@ int next_c;
/*
* A_firstc_laa returns first character of LAA combination if it exists
*/
static int A_firstc_laa(c, c1)
int c; /* base character */
int c1; /* first composing character */
static int
A_firstc_laa (
int c, /* base character */
int c1 /* first composing character */
)
{
if (c1 != NUL && c == a_LAM && !A_is_harakat(c1))
return c1;
@ -1068,8 +1052,7 @@ int c1; /* first composing character */
* A_is_harakat returns TRUE if 'c' is an Arabic Harakat character
* (harakat/tanween)
*/
static int A_is_harakat(c)
int c;
static int A_is_harakat(int c)
{
return c >= a_FATHATAN && c <= a_SUKUN;
}
@ -1079,8 +1062,7 @@ int c;
* A_is_iso returns TRUE if 'c' is an Arabic ISO-8859-6 character
* (alphabet/number/punctuation)
*/
static int A_is_iso(c)
int c;
static int A_is_iso(int c)
{
return (c >= a_HAMZA && c <= a_GHAIN)
|| (c >= a_TATWEEL && c <= a_HAMZA_BELOW)
@ -1092,8 +1074,7 @@ int c;
* A_is_formb returns TRUE if 'c' is an Arabic 10646-1 FormB character
* (alphabet/number/punctuation)
*/
static int A_is_formb(c)
int c;
static int A_is_formb(int c)
{
return (c >= a_s_FATHATAN && c <= a_s_DAMMATAN)
|| c == a_s_KASRATAN
@ -1105,8 +1086,7 @@ int c;
/*
* A_is_ok returns TRUE if 'c' is an Arabic 10646 (8859-6 or Form-B)
*/
static int A_is_ok(c)
int c;
static int A_is_ok(int c)
{
return A_is_iso(c) || A_is_formb(c);
}
@ -1116,8 +1096,7 @@ int c;
* A_is_valid returns TRUE if 'c' is an Arabic 10646 (8859-6 or Form-B)
* with some exceptions/exclusions
*/
static int A_is_valid(c)
int c;
static int A_is_valid(int c)
{
return A_is_ok(c) && !A_is_special(c);
}
@ -1127,8 +1106,7 @@ int c;
* A_is_special returns TRUE if 'c' is not a special Arabic character.
* Specials don't adhere to most of the rules.
*/
static int A_is_special(c)
int c;
static int A_is_special(int c)
{
return c == a_HAMZA || c == a_s_HAMZA;
}

View File

@ -319,9 +319,7 @@ static UINT32_T sbi[4][256] = {
sbx[3][xr & 0xFF];
static void bf_e_block(p_xl, p_xr)
UINT32_T *p_xl;
UINT32_T *p_xr;
static void bf_e_block(UINT32_T *p_xl, UINT32_T *p_xr)
{
UINT32_T temp, xl = *p_xl, xr = *p_xr;
@ -346,8 +344,7 @@ UINT32_T *p_xr;
# define htonl2(x)
#endif
static void bf_e_cblock(block)
char_u *block;
static void bf_e_cblock(char_u *block)
{
block8 bk;
@ -365,10 +362,7 @@ char_u *block;
* Initialize the crypt method using "password" as the encryption key and
* "salt[salt_len]" as the salt.
*/
void bf_key_init(password, salt, salt_len)
char_u *password;
char_u *salt;
int salt_len;
void bf_key_init(char_u *password, char_u *salt, int salt_len)
{
int i, j, keypos = 0;
unsigned u;
@ -421,10 +415,7 @@ int salt_len;
/*
* BF Self test for corrupted tables or instructions
*/
static int bf_check_tables(a_ipa, a_sbi, val)
UINT32_T a_ipa[18];
UINT32_T a_sbi[4][256];
UINT32_T val;
static int bf_check_tables(UINT32_T a_ipa[18], UINT32_T a_sbi[4][256], UINT32_T val)
{
int i, j;
UINT32_T c = 0;
@ -464,7 +455,7 @@ static struct_bf_test_data bf_test_data[] = {
/*
* Return FAIL when there is something wrong with blowfish encryption.
*/
static int bf_self_test() {
static int bf_self_test(void) {
int i, bn;
int err = 0;
block8 bk;
@ -509,9 +500,7 @@ static char_u ofb_buffer[BF_OFB_LEN]; /* 64 bytes */
/*
* Initialize with seed "iv[iv_len]".
*/
void bf_ofb_init(iv, iv_len)
char_u *iv;
int iv_len;
void bf_ofb_init(char_u *iv, int iv_len)
{
int i, mi;
@ -542,10 +531,7 @@ int iv_len;
* Encrypt "from[len]" into "to[len]".
* "from" and "to" can be equal to encrypt in place.
*/
void bf_crypt_encode(from, len, to)
char_u *from;
size_t len;
char_u *to;
void bf_crypt_encode(char_u *from, size_t len, char_u *to)
{
size_t i;
int ztemp, t;
@ -561,9 +547,7 @@ char_u *to;
/*
* Decrypt "ptr[len]" in place.
*/
void bf_crypt_decode(ptr, len)
char_u *ptr;
long len;
void bf_crypt_decode(char_u *ptr, long len)
{
char_u *p;
int t;
@ -579,8 +563,10 @@ long len;
* Initialize the encryption keys and the random header according to
* the given password.
*/
void bf_crypt_init_keys(passwd)
char_u *passwd; /* password string with which to modify keys */
void
bf_crypt_init_keys (
char_u *passwd /* password string with which to modify keys */
)
{
char_u *p;
@ -599,7 +585,7 @@ static UINT32_T save_sbx[4][256];
* Save the current crypt state. Can only be used once before
* bf_crypt_restore().
*/
void bf_crypt_save() {
void bf_crypt_save(void) {
save_randbyte_offset = randbyte_offset;
save_update_offset = update_offset;
mch_memmove(save_ofb_buffer, ofb_buffer, BF_OFB_LEN);
@ -611,7 +597,7 @@ void bf_crypt_save() {
* Restore the current crypt state. Can only be used after
* bf_crypt_save().
*/
void bf_crypt_restore() {
void bf_crypt_restore(void) {
randbyte_offset = save_randbyte_offset;
update_offset = save_update_offset;
mch_memmove(ofb_buffer, save_ofb_buffer, BF_OFB_LEN);
@ -623,7 +609,7 @@ void bf_crypt_restore() {
* Run a test to check if the encryption works as expected.
* Give an error and return FAIL when not.
*/
int blowfish_self_test() {
int blowfish_self_test(void) {
if (sha256_self_test() == FAIL) {
EMSG(_("E818: sha256 test failed"));
return FAIL;

View File

@ -64,10 +64,12 @@ static char *e_auabort = N_("E855: Autocommands caused command to abort");
* memory.
* Return FAIL for failure, OK otherwise.
*/
int open_buffer(read_stdin, eap, flags)
int read_stdin; /* read file from stdin */
exarg_T *eap; /* for forced 'ff' and 'fenc' or NULL */
int flags; /* extra flags for readfile() */
int
open_buffer (
int read_stdin, /* read file from stdin */
exarg_T *eap, /* for forced 'ff' and 'fenc' or NULL */
int flags /* extra flags for readfile() */
)
{
int retval = OK;
buf_T *old_curbuf;
@ -231,8 +233,7 @@ int flags; /* extra flags for readfile() */
/*
* Return TRUE if "buf" points to a valid buffer (in the buffer list).
*/
int buf_valid(buf)
buf_T *buf;
int buf_valid(buf_T *buf)
{
buf_T *bp;
@ -259,11 +260,13 @@ buf_T *buf;
* cause there to be only one window with this buffer. e.g. when ":quit" is
* supposed to close the window but autocommands close all other windows.
*/
void close_buffer(win, buf, action, abort_if_last)
win_T *win; /* if not NULL, set b_last_cursor */
buf_T *buf;
int action;
int abort_if_last UNUSED;
void
close_buffer (
win_T *win, /* if not NULL, set b_last_cursor */
buf_T *buf,
int action,
int abort_if_last
)
{
int is_curbuf;
int nwindows;
@ -421,8 +424,7 @@ aucmd_abort:
/*
* Make buffer not contain a file.
*/
void buf_clear_file(buf)
buf_T *buf;
void buf_clear_file(buf_T *buf)
{
buf->b_ml.ml_line_count = 1;
unchanged(buf, TRUE);
@ -444,9 +446,7 @@ buf_T *buf;
* BFA_WIPE buffer is going to be wiped out
* BFA_KEEP_UNDO do not free undo information
*/
void buf_freeall(buf, flags)
buf_T *buf;
int flags;
void buf_freeall(buf_T *buf, int flags)
{
int is_curbuf = (buf == curbuf);
@ -506,8 +506,7 @@ int flags;
* Free a buffer structure and the things it contains related to the buffer
* itself (not the file, that must have been done already).
*/
static void free_buffer(buf)
buf_T *buf;
static void free_buffer(buf_T *buf)
{
free_buffer_stuff(buf, TRUE);
unref_var_dict(buf->b_vars);
@ -518,9 +517,11 @@ buf_T *buf;
/*
* Free stuff in the buffer for ":bdel" and when wiping out the buffer.
*/
static void free_buffer_stuff(buf, free_options)
buf_T *buf;
int free_options; /* free options as well */
static void
free_buffer_stuff (
buf_T *buf,
int free_options /* free options as well */
)
{
if (free_options) {
clear_wininfo(buf); /* including window-local options */
@ -539,8 +540,7 @@ int free_options; /* free options as well */
/*
* Free the b_wininfo list for buffer "buf".
*/
static void clear_wininfo(buf)
buf_T *buf;
static void clear_wininfo(buf_T *buf)
{
wininfo_T *wip;
@ -558,11 +558,7 @@ buf_T *buf;
/*
* Go to another buffer. Handles the result of the ATTENTION dialog.
*/
void goto_buffer(eap, start, dir, count)
exarg_T *eap;
int start;
int dir;
int count;
void goto_buffer(exarg_T *eap, int start, int dir, int count)
{
# if defined(FEAT_WINDOWS) && defined(HAS_SWAP_EXISTS_ACTION)
buf_T *old_curbuf = curbuf;
@ -597,8 +593,7 @@ int count;
* Handle the situation of swap_exists_action being set.
* It is allowed for "old_curbuf" to be NULL or invalid.
*/
void handle_swap_exists(old_curbuf)
buf_T *old_curbuf;
void handle_swap_exists(buf_T *old_curbuf)
{
cleanup_T cs;
long old_tw = curbuf->b_p_tw;
@ -659,13 +654,15 @@ buf_T *old_curbuf;
*
* Returns error message or NULL
*/
char_u * do_bufdel(command, arg, addr_count, start_bnr, end_bnr, forceit)
int command;
char_u *arg; /* pointer to extra arguments */
int addr_count;
int start_bnr; /* first buffer number in a range */
int end_bnr; /* buffer nr or last buffer nr in a range */
int forceit;
char_u *
do_bufdel (
int command,
char_u *arg, /* pointer to extra arguments */
int addr_count,
int start_bnr, /* first buffer number in a range */
int end_bnr, /* buffer nr or last buffer nr in a range */
int forceit
)
{
int do_current = 0; /* delete current buffer? */
int deleted = 0; /* number of buffers deleted */
@ -762,10 +759,7 @@ static int empty_curbuf __ARGS((int close_others, int forceit, int action));
* Make the current buffer empty.
* Used when it is wiped out and it's the last buffer.
*/
static int empty_curbuf(close_others, forceit, action)
int close_others;
int forceit;
int action;
static int empty_curbuf(int close_others, int forceit, int action)
{
int retval;
buf_T *buf = curbuf;
@ -811,12 +805,14 @@ int action;
*
* Return FAIL or OK.
*/
int do_buffer(action, start, dir, count, forceit)
int action;
int start;
int dir; /* FORWARD or BACKWARD */
int count; /* buffer number or number of buffers */
int forceit; /* TRUE for :...! */
int
do_buffer (
int action,
int start,
int dir, /* FORWARD or BACKWARD */
int count, /* buffer number or number of buffers */
int forceit /* TRUE for :...! */
)
{
buf_T *buf;
buf_T *bp;
@ -1100,9 +1096,7 @@ int forceit; /* TRUE for :...! */
* DOBUF_DEL delete it
* DOBUF_WIPE wipe it out
*/
void set_curbuf(buf, action)
buf_T *buf;
int action;
void set_curbuf(buf_T *buf, int action)
{
buf_T *prevbuf;
int unload = (action == DOBUF_UNLOAD || action == DOBUF_DEL
@ -1158,8 +1152,7 @@ int action;
* Old curbuf must have been abandoned already! This also means "curbuf" may
* be pointing to freed memory.
*/
void enter_buffer(buf)
buf_T *buf;
void enter_buffer(buf_T *buf)
{
/* Copy buffer and window local option values. Not for a help buffer. */
buf_copy_options(buf, BCO_ENTER | BCO_NOHELP);
@ -1237,7 +1230,7 @@ buf_T *buf;
/*
* Change to the directory of the current buffer.
*/
void do_autochdir() {
void do_autochdir(void) {
if (curbuf->b_ffname != NULL && vim_chdirfile(curbuf->b_ffname) == OK)
shorten_fnames(TRUE);
}
@ -1257,11 +1250,13 @@ void do_autochdir() {
*/
static int top_file_num = 1; /* highest file number */
buf_T * buflist_new(ffname, sfname, lnum, flags)
char_u *ffname; /* full path of fname or relative */
char_u *sfname; /* short fname or NULL */
linenr_T lnum; /* preferred cursor line */
int flags; /* BLN_ defines */
buf_T *
buflist_new (
char_u *ffname, /* full path of fname or relative */
char_u *sfname, /* short fname or NULL */
linenr_T lnum, /* preferred cursor line */
int flags /* BLN_ defines */
)
{
buf_T *buf;
#ifdef UNIX
@ -1451,9 +1446,7 @@ int flags; /* BLN_ defines */
* If "free_p_ff" is TRUE also free 'fileformat', 'buftype' and
* 'fileencoding'.
*/
void free_buf_options(buf, free_p_ff)
buf_T *buf;
int free_p_ff;
void free_buf_options(buf_T *buf, int free_p_ff)
{
if (free_p_ff) {
clear_string_option(&buf->b_p_fenc);
@ -1516,11 +1509,7 @@ int free_p_ff;
*
* return FAIL for failure, OK for success
*/
int buflist_getfile(n, lnum, options, forceit)
int n;
linenr_T lnum;
int options;
int forceit;
int buflist_getfile(int n, linenr_T lnum, int options, int forceit)
{
buf_T *buf;
win_T *wp = NULL;
@ -1596,7 +1585,7 @@ int forceit;
/*
* go to the last know line number for the current buffer
*/
void buflist_getfpos() {
void buflist_getfpos(void) {
pos_T *fpos;
fpos = buflist_findfpos(curbuf);
@ -1618,8 +1607,7 @@ void buflist_getfpos() {
* Find file in buffer list by name (it has to be for the current window).
* Returns NULL if not found.
*/
buf_T * buflist_findname_exp(fname)
char_u *fname;
buf_T *buflist_findname_exp(char_u *fname)
{
char_u *ffname;
buf_T *buf = NULL;
@ -1645,8 +1633,7 @@ char_u *fname;
* Skips dummy buffers.
* Returns NULL if not found.
*/
buf_T * buflist_findname(ffname)
char_u *ffname;
buf_T *buflist_findname(char_u *ffname)
{
#ifdef UNIX
struct stat st;
@ -1661,9 +1648,7 @@ char_u *ffname;
* twice for the same file.
* Returns NULL if not found.
*/
static buf_T * buflist_findname_stat(ffname, stp)
char_u *ffname;
struct stat *stp;
static buf_T *buflist_findname_stat(char_u *ffname, struct stat *stp)
{
#endif
buf_T *buf;
@ -1685,12 +1670,14 @@ struct stat *stp;
* Return fnum of the found buffer.
* Return < 0 for error.
*/
int buflist_findpat(pattern, pattern_end, unlisted, diffmode, curtab_only)
char_u *pattern;
char_u *pattern_end; /* pointer to first char after pattern */
int unlisted; /* find unlisted buffers */
int diffmode UNUSED; /* find diff-mode buffers only */
int curtab_only; /* find buffers in current tab only */
int
buflist_findpat (
char_u *pattern,
char_u *pattern_end, /* pointer to first char after pattern */
int unlisted, /* find unlisted buffers */
int diffmode, /* find diff-mode buffers only */
int curtab_only /* find buffers in current tab only */
)
{
buf_T *buf;
regprog_T *prog;
@ -1794,11 +1781,7 @@ int curtab_only; /* find buffers in current tab only */
* For command line expansion of ":buf" and ":sbuf".
* Return OK if matches found, FAIL otherwise.
*/
int ExpandBufnames(pat, num_file, file, options)
char_u *pat;
int *num_file;
char_u ***file;
int options;
int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options)
{
int count = 0;
buf_T *buf;
@ -1886,9 +1869,7 @@ int options;
/*
* Check for a match on the file name for buffer "buf" with regprog "prog".
*/
static char_u * buflist_match(prog, buf)
regprog_T *prog;
buf_T *buf;
static char_u *buflist_match(regprog_T *prog, buf_T *buf)
{
char_u *match;
@ -1904,9 +1885,7 @@ buf_T *buf;
* Try matching the regexp in "prog" with file name "name".
* Return "name" when there is a match, NULL when not.
*/
static char_u * fname_match(prog, name)
regprog_T *prog;
char_u *name;
static char_u *fname_match(regprog_T *prog, char_u *name)
{
char_u *match = NULL;
char_u *p;
@ -1933,8 +1912,7 @@ char_u *name;
/*
* find file in buffer list by number
*/
buf_T * buflist_findnr(nr)
int nr;
buf_T *buflist_findnr(int nr)
{
buf_T *buf;
@ -1952,10 +1930,12 @@ int nr;
* home_replace() is used to shorten the file name (used for marks).
* Returns a pointer to allocated memory, of NULL when failed.
*/
char_u * buflist_nr2name(n, fullname, helptail)
int n;
int fullname;
int helptail; /* for help buffers return tail only */
char_u *
buflist_nr2name (
int n,
int fullname,
int helptail /* for help buffers return tail only */
)
{
buf_T *buf;
@ -1971,12 +1951,7 @@ int helptail; /* for help buffers return tail only */
* When "copy_options" is TRUE save the local window option values.
* When "lnum" is 0 only do the options.
*/
static void buflist_setfpos(buf, win, lnum, col, copy_options)
buf_T *buf;
win_T *win;
linenr_T lnum;
colnr_T col;
int copy_options;
static void buflist_setfpos(buf_T *buf, win_T *win, linenr_T lnum, colnr_T col, int copy_options)
{
wininfo_T *wip;
@ -2032,8 +2007,7 @@ static int wininfo_other_tab_diff __ARGS((wininfo_T *wip));
* Return TRUE when "wip" has 'diff' set and the diff is only for another tab
* page. That's because a diff is local to a tab page.
*/
static int wininfo_other_tab_diff(wip)
wininfo_T *wip;
static int wininfo_other_tab_diff(wininfo_T *wip)
{
win_T *wp;
@ -2055,9 +2029,7 @@ wininfo_T *wip;
* another tab page.
* Returns NULL when there isn't any info.
*/
static wininfo_T * find_wininfo(buf, skip_diff_buffer)
buf_T *buf;
int skip_diff_buffer UNUSED;
static wininfo_T *find_wininfo(buf_T *buf, int skip_diff_buffer)
{
wininfo_T *wip;
@ -2086,8 +2058,7 @@ int skip_diff_buffer UNUSED;
* the most recently used window. If the values were never set, use the
* global values for the window.
*/
void get_winopts(buf)
buf_T *buf;
void get_winopts(buf_T *buf)
{
wininfo_T *wip;
@ -2114,8 +2085,7 @@ buf_T *buf;
* window.
* Returns a pointer to no_position if no position is found.
*/
pos_T * buflist_findfpos(buf)
buf_T *buf;
pos_T *buflist_findfpos(buf_T *buf)
{
wininfo_T *wip;
static pos_T no_position = INIT_POS_T(1, 0, 0);
@ -2130,8 +2100,7 @@ buf_T *buf;
/*
* Find the lnum for the buffer 'buf' for the current window.
*/
linenr_T buflist_findlnum(buf)
buf_T *buf;
linenr_T buflist_findlnum(buf_T *buf)
{
return buflist_findfpos(buf)->lnum;
}
@ -2139,8 +2108,7 @@ buf_T *buf;
/*
* List all know file names (for :files and :buffers command).
*/
void buflist_list(eap)
exarg_T *eap;
void buflist_list(exarg_T *eap)
{
buf_T *buf;
int len;
@ -2188,10 +2156,7 @@ exarg_T *eap;
* Used by insert_reg() and cmdline_paste() for '#' register.
* Return FAIL if not found, OK for success.
*/
int buflist_name_nr(fnum, fname, lnum)
int fnum;
char_u **fname;
linenr_T *lnum;
int buflist_name_nr(int fnum, char_u **fname, linenr_T *lnum)
{
buf_T *buf;
@ -2211,10 +2176,13 @@ linenr_T *lnum;
* Returns FAIL for failure (file name already in use by other buffer)
* OK otherwise.
*/
int setfname(buf, ffname, sfname, message)
buf_T *buf;
char_u *ffname, *sfname;
int message; /* give message when buffer already exists */
int
setfname (
buf_T *buf,
char_u *ffname,
char_u *sfname,
int message /* give message when buffer already exists */
)
{
buf_T *obuf = NULL;
#ifdef UNIX
@ -2300,9 +2268,7 @@ int message; /* give message when buffer already exists */
* Crude way of changing the name of a buffer. Use with care!
* The name should be relative to the current directory.
*/
void buf_set_name(fnum, name)
int fnum;
char_u *name;
void buf_set_name(int fnum, char_u *name)
{
buf_T *buf;
@ -2323,8 +2289,7 @@ char_u *name;
* Take care of what needs to be done when the name of buffer "buf" has
* changed.
*/
void buf_name_changed(buf)
buf_T *buf;
void buf_name_changed(buf_T *buf)
{
/*
* If the file name changed, also change the name of the swapfile
@ -2346,10 +2311,7 @@ buf_T *buf;
* Used by do_one_cmd(), do_write() and do_ecmd().
* Return the buffer.
*/
buf_T * setaltfname(ffname, sfname, lnum)
char_u *ffname;
char_u *sfname;
linenr_T lnum;
buf_T *setaltfname(char_u *ffname, char_u *sfname, linenr_T lnum)
{
buf_T *buf;
@ -2364,8 +2326,10 @@ linenr_T lnum;
* Get alternate file name for current window.
* Return NULL if there isn't any, and give error message if requested.
*/
char_u * getaltfname(errmsg)
int errmsg; /* give error message */
char_u *
getaltfname (
int errmsg /* give error message */
)
{
char_u *fname;
linenr_T dummy;
@ -2384,9 +2348,7 @@ int errmsg; /* give error message */
*
* used by qf_init(), main() and doarglist()
*/
int buflist_add(fname, flags)
char_u *fname;
int flags;
int buflist_add(char_u *fname, int flags)
{
buf_T *buf;
@ -2400,7 +2362,7 @@ int flags;
/*
* Adjust slashes in file names. Called after 'shellslash' was set.
*/
void buflist_slash_adjust() {
void buflist_slash_adjust(void) {
buf_T *bp;
for (bp = firstbuf; bp != NULL; bp = bp->b_next) {
@ -2417,8 +2379,7 @@ void buflist_slash_adjust() {
* Set alternate cursor position for the current buffer and window "win".
* Also save the local window option values.
*/
void buflist_altfpos(win)
win_T *win;
void buflist_altfpos(win_T *win)
{
buflist_setfpos(curbuf, win, win->w_cursor.lnum, win->w_cursor.col, TRUE);
}
@ -2427,8 +2388,7 @@ win_T *win;
* Return TRUE if 'ffname' is not the same file as current file.
* Fname must have a full path (expanded by mch_FullName()).
*/
int otherfile(ffname)
char_u *ffname;
int otherfile(char_u *ffname)
{
return otherfile_buf(curbuf, ffname
#ifdef UNIX
@ -2437,16 +2397,11 @@ char_u *ffname;
);
}
static int otherfile_buf(buf, ffname
static int otherfile_buf(buf_T *buf, char_u *ffname
#ifdef UNIX
, stp
#endif
)
buf_T *buf;
char_u *ffname;
#ifdef UNIX
struct stat *stp;
, struct stat *stp
#endif
)
{
/* no name is different */
if (ffname == NULL || *ffname == NUL || buf->b_ffname == NULL)
@ -2487,8 +2442,7 @@ struct stat *stp;
* Set inode and device number for a buffer.
* Must always be called when b_fname is changed!.
*/
void buf_setino(buf)
buf_T *buf;
void buf_setino(buf_T *buf)
{
struct stat st;
@ -2503,9 +2457,7 @@ buf_T *buf;
/*
* Return TRUE if dev/ino in buffer "buf" matches with "stp".
*/
static int buf_same_ino(buf, stp)
buf_T *buf;
struct stat *stp;
static int buf_same_ino(buf_T *buf, struct stat *stp)
{
return buf->b_dev_valid
&& stp->st_dev == buf->b_dev
@ -2516,10 +2468,12 @@ struct stat *stp;
/*
* Print info about the current buffer.
*/
void fileinfo(fullname, shorthelp, dont_truncate)
int fullname; /* when non-zero print full path */
int shorthelp;
int dont_truncate;
void
fileinfo (
int fullname, /* when non-zero print full path */
int shorthelp,
int dont_truncate
)
{
char_u *name;
int n;
@ -2617,11 +2571,7 @@ int dont_truncate;
vim_free(buffer);
}
void col_print(buf, buflen, col, vcol)
char_u *buf;
size_t buflen;
int col;
int vcol;
void col_print(char_u *buf, size_t buflen, int col, int vcol)
{
if (col == vcol)
vim_snprintf((char *)buf, buflen, "%d", col);
@ -2636,7 +2586,7 @@ int vcol;
static char_u *lasttitle = NULL;
static char_u *lasticon = NULL;
void maketitle() {
void maketitle(void) {
char_u *p;
char_u *t_str = NULL;
char_u *i_name;
@ -2803,9 +2753,7 @@ void maketitle() {
* from "str" if it does.
* Return TRUE when "*last" changed.
*/
static int ti_change(str, last)
char_u *str;
char_u **last;
static int ti_change(char_u *str, char_u **last)
{
if ((str == NULL) != (*last == NULL)
|| (str != NULL && *last != NULL && STRCMP(str, *last) != 0)) {
@ -2822,12 +2770,12 @@ char_u **last;
/*
* Put current window title back (used after calling a shell)
*/
void resettitle() {
void resettitle(void) {
mch_settitle(lasttitle, lasticon);
}
# if defined(EXITFREE) || defined(PROTO)
void free_titles() {
void free_titles(void) {
vim_free(lasttitle);
vim_free(lasticon);
}
@ -2849,17 +2797,18 @@ void free_titles() {
* If maxwidth is not zero, the string will be filled at any middle marker
* or truncated if too long, fillchar is used for all whitespace.
*/
int build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar,
maxwidth, hltab, tabtab)
win_T *wp;
char_u *out; /* buffer to write into != NameBuff */
size_t outlen; /* length of out[] */
char_u *fmt;
int use_sandbox UNUSED; /* "fmt" was set insecurely, use sandbox */
int fillchar;
int maxwidth;
struct stl_hlrec *hltab; /* return: HL attributes (can be NULL) */
struct stl_hlrec *tabtab; /* return: tab page nrs (can be NULL) */
int
build_stl_str_hl (
win_T *wp,
char_u *out, /* buffer to write into != NameBuff */
size_t outlen, /* length of out[] */
char_u *fmt,
int use_sandbox, /* "fmt" was set insecurely, use sandbox */
int fillchar,
int maxwidth,
struct stl_hlrec *hltab, /* return: HL attributes (can be NULL) */
struct stl_hlrec *tabtab /* return: tab page nrs (can be NULL) */
)
{
char_u *p;
char_u *s;
@ -3574,10 +3523,7 @@ struct stl_hlrec *tabtab; /* return: tab page nrs (can be NULL) */
* Get relative cursor position in window into "buf[buflen]", in the form 99%,
* using "Top", "Bot" or "All" when appropriate.
*/
void get_rel_pos(wp, buf, buflen)
win_T *wp;
char_u *buf;
int buflen;
void get_rel_pos(win_T *wp, char_u *buf, int buflen)
{
long above; /* number of lines above window */
long below; /* number of lines below window */
@ -3601,11 +3547,13 @@ int buflen;
* Append (file 2 of 8) to "buf[buflen]", if editing more than one file.
* Return TRUE if it was appended.
*/
static int append_arg_number(wp, buf, buflen, add_file)
win_T *wp;
char_u *buf;
int buflen;
int add_file; /* Add "file" before the arg number */
static int
append_arg_number (
win_T *wp,
char_u *buf,
int buflen,
int add_file /* Add "file" before the arg number */
)
{
char_u *p;
@ -3631,8 +3579,7 @@ int add_file; /* Add "file" before the arg number */
* If fname is not a full path, make it a full path.
* Returns pointer to allocated memory (NULL for failure).
*/
char_u * fix_fname(fname)
char_u *fname;
char_u *fix_fname(char_u *fname)
{
/*
* Force expanding the path always for Unix, because symbolic links may
@ -3674,10 +3621,7 @@ char_u *fname;
* Make "ffname" a full file name, set "sfname" to "ffname" if not NULL.
* "ffname" becomes a pointer to allocated memory (or NULL).
*/
void fname_expand(buf, ffname, sfname)
buf_T *buf UNUSED;
char_u **ffname;
char_u **sfname;
void fname_expand(buf_T *buf, char_u **ffname, char_u **sfname)
{
if (*ffname == NULL) /* if no file name given, nothing to do */
return;
@ -3703,8 +3647,7 @@ char_u **sfname;
/*
* Get the file name for an argument list entry.
*/
char_u * alist_name(aep)
aentry_T *aep;
char_u *alist_name(aentry_T *aep)
{
buf_T *bp;
@ -3718,10 +3661,12 @@ aentry_T *aep;
/*
* do_arg_all(): Open up to 'count' windows, one for each argument.
*/
void do_arg_all(count, forceit, keep_tabs)
int count;
int forceit; /* hide buffers in current windows */
int keep_tabs; /* keep current tabs, for ":tab drop file" */
void
do_arg_all (
int count,
int forceit, /* hide buffers in current windows */
int keep_tabs /* keep current tabs, for ":tab drop file" */
)
{
int i;
win_T *wp, *wpnext;
@ -3957,8 +3902,7 @@ int keep_tabs; /* keep current tabs, for ":tab drop file" */
/*
* Open a window for a number of buffers.
*/
void ex_buffer_all(eap)
exarg_T *eap;
void ex_buffer_all(exarg_T *eap)
{
buf_T *buf;
win_T *wp, *wpnext;
@ -4140,8 +4084,7 @@ static int chk_modeline __ARGS((linenr_T, int));
*
* Returns immediately if the "ml" option isn't set.
*/
void do_modelines(flags)
int flags;
void do_modelines(int flags)
{
linenr_T lnum;
int nmlines;
@ -4174,9 +4117,11 @@ int flags;
* chk_modeline() - check a single line for a mode string
* Return FAIL if an error encountered.
*/
static int chk_modeline(lnum, flags)
linenr_T lnum;
int flags; /* Same as for do_modelines(). */
static int
chk_modeline (
linenr_T lnum,
int flags /* Same as for do_modelines(). */
)
{
char_u *s;
char_u *e;
@ -4281,9 +4226,7 @@ int flags; /* Same as for do_modelines(). */
return retval;
}
int read_viminfo_bufferlist(virp, writing)
vir_T *virp;
int writing;
int read_viminfo_bufferlist(vir_T *virp, int writing)
{
char_u *tab;
linenr_T lnum;
@ -4330,8 +4273,7 @@ int writing;
return viminfo_readline(virp);
}
void write_viminfo_bufferlist(fp)
FILE *fp;
void write_viminfo_bufferlist(FILE *fp)
{
buf_T *buf;
win_T *win;
@ -4379,8 +4321,7 @@ FILE *fp;
* Return special buffer name.
* Returns NULL when the buffer has a normal file name.
*/
char_u * buf_spname(buf)
buf_T *buf;
char_u *buf_spname(buf_T *buf)
{
if (bt_quickfix(buf)) {
win_T *win;
@ -4415,10 +4356,7 @@ buf_T *buf;
* If found OK is returned and "wp" and "tp" are set to the window and tabpage.
* If not found FAIL is returned.
*/
int find_win_for_buf(buf, wp, tp)
buf_T *buf;
win_T **wp;
tabpage_T **tp;
int find_win_for_buf(buf_T *buf, win_T **wp, tabpage_T **tp)
{
FOR_ALL_TAB_WINDOWS(*tp, *wp)
if ((*wp)->w_buffer == buf)
@ -4433,8 +4371,7 @@ win_found:
/*
* Set 'buflisted' for curbuf to "on" and trigger autocommands if it changed.
*/
void set_buflisted(on)
int on;
void set_buflisted(int on)
{
if (on != curbuf->b_p_bl) {
curbuf->b_p_bl = on;
@ -4449,8 +4386,7 @@ int on;
* Read the file for "buf" again and check if the contents changed.
* Return TRUE if it changed or this could not be checked.
*/
int buf_contents_changed(buf)
buf_T *buf;
int buf_contents_changed(buf_T *buf)
{
buf_T *newbuf;
int differ = TRUE;
@ -4502,9 +4438,11 @@ buf_T *buf;
* this buffer. Call this to wipe out a temp buffer that does not contain any
* marks.
*/
void wipe_buffer(buf, aucmd)
buf_T *buf;
int aucmd UNUSED; /* When TRUE trigger autocommands. */
void
wipe_buffer (
buf_T *buf,
int aucmd /* When TRUE trigger autocommands. */
)
{
if (buf->b_fnum == top_file_num - 1)
--top_file_num;

View File

@ -56,13 +56,15 @@ static int chartab_initialized = FALSE;
* Return FAIL if 'iskeyword', 'isident', 'isfname' or 'isprint' option has an
* error, OK otherwise.
*/
int init_chartab() {
int init_chartab(void) {
return buf_init_chartab(curbuf, TRUE);
}
int buf_init_chartab(buf, global)
buf_T *buf;
int global; /* FALSE: only set buf->b_chartab[] */
int
buf_init_chartab (
buf_T *buf,
int global /* FALSE: only set buf->b_chartab[] */
)
{
int c;
int c2;
@ -246,9 +248,7 @@ int global; /* FALSE: only set buf->b_chartab[] */
* The result is a string with only printable characters, but if there is not
* enough room, not all characters will be translated.
*/
void trans_characters(buf, bufsize)
char_u *buf;
int bufsize;
void trans_characters(char_u *buf, int bufsize)
{
int len; /* length of string needing translation */
int room; /* room in buffer after string */
@ -283,8 +283,7 @@ int bufsize;
* Translate a string into allocated memory, replacing special chars with
* printable chars. Returns NULL when out of memory.
*/
char_u * transstr(s)
char_u *s;
char_u *transstr(char_u *s)
{
char_u *res;
char_u *p;
@ -342,11 +341,7 @@ char_u *s;
* When "buf" is NULL returns an allocated string (NULL for out-of-memory).
* Otherwise puts the result in "buf[buflen]".
*/
char_u * str_foldcase(str, orglen, buf, buflen)
char_u *str;
int orglen;
char_u *buf;
int buflen;
char_u *str_foldcase(char_u *str, int orglen, char_u *buf, int buflen)
{
garray_T ga;
int i;
@ -440,8 +435,7 @@ int buflen;
*/
static char_u transchar_buf[7];
char_u * transchar(c)
int c;
char_u *transchar(int c)
{
int i;
@ -469,8 +463,7 @@ int c;
* Like transchar(), but called with a byte instead of a character. Checks
* for an illegal UTF-8 byte.
*/
char_u * transchar_byte(c)
int c;
char_u *transchar_byte(int c)
{
if (enc_utf8 && c >= 0x80) {
transchar_nonprint(transchar_buf, c);
@ -484,9 +477,7 @@ int c;
* "buf[]". "buf" needs to be able to hold five bytes.
* Does NOT work for multi-byte characters, c must be <= 255.
*/
void transchar_nonprint(buf, c)
char_u *buf;
int c;
void transchar_nonprint(char_u *buf, int c)
{
if (c == NL)
c = NUL; /* we use newline in place of a NUL */
@ -518,9 +509,7 @@ int c;
}
}
void transchar_hex(buf, c)
char_u *buf;
int c;
void transchar_hex(char_u *buf, int c)
{
int i = 0;
@ -540,8 +529,7 @@ int c;
* Lower case letters are used to avoid the confusion of <F1> being 0xf1 or
* function key 1.
*/
static unsigned nr2hex(c)
unsigned c;
static unsigned nr2hex(unsigned c)
{
if ((c & 0xf) <= 9)
return (c & 0xf) + '0';
@ -556,8 +544,7 @@ unsigned c;
* For UTF-8 mode this will return 0 for bytes >= 0x80, because the number of
* cells depends on further bytes.
*/
int byte2cells(b)
int b;
int byte2cells(int b)
{
if (enc_utf8 && b >= 0x80)
return 0;
@ -569,8 +556,7 @@ int b;
* "c" can be a special key (negative number) in which case 3 or 4 is returned.
* A TAB is counted as two cells: "^I" or four: "<09>".
*/
int char2cells(c)
int c;
int char2cells(int c)
{
if (IS_SPECIAL(c))
return char2cells(K_SECOND(c)) + 2;
@ -593,8 +579,7 @@ int c;
* Return number of display cells occupied by character at "*p".
* A TAB is counted as two cells: "^I" or four: "<09>".
*/
int ptr2cells(p)
char_u *p;
int ptr2cells(char_u *p)
{
/* For UTF-8 we need to look at more bytes if the first byte is >= 0x80. */
if (enc_utf8 && *p >= 0x80)
@ -607,8 +592,7 @@ char_u *p;
* Return the number of character cells string "s" will take on the screen,
* counting TABs as two characters: "^I".
*/
int vim_strsize(s)
char_u *s;
int vim_strsize(char_u *s)
{
return vim_strnsize(s, (int)MAXCOL);
}
@ -617,9 +601,7 @@ char_u *s;
* Return the number of character cells string "s[len]" will take on the
* screen, counting TABs as two characters: "^I".
*/
int vim_strnsize(s, len)
char_u *s;
int len;
int vim_strnsize(char_u *s, int len)
{
int size = 0;
@ -655,18 +637,13 @@ int len;
#if defined(FEAT_VREPLACE) || defined(FEAT_EX_EXTRA) || defined(FEAT_GUI) \
|| defined(FEAT_VIRTUALEDIT) || defined(PROTO)
int chartabsize(p, col)
char_u *p;
colnr_T col;
int chartabsize(char_u *p, colnr_T col)
{
RET_WIN_BUF_CHARTABSIZE(curwin, curbuf, p, col)
}
#endif
static int win_chartabsize(wp, p, col)
win_T *wp;
char_u *p;
colnr_T col;
static int win_chartabsize(win_T *wp, char_u *p, colnr_T col)
{
RET_WIN_BUF_CHARTABSIZE(wp, wp->w_buffer, p, col)
}
@ -675,8 +652,7 @@ colnr_T col;
* Return the number of characters the string 's' will take on the screen,
* taking into account the size of a tab.
*/
int linetabsize(s)
char_u *s;
int linetabsize(char_u *s)
{
return linetabsize_col(0, s);
}
@ -684,9 +660,7 @@ char_u *s;
/*
* Like linetabsize(), but starting at column "startcol".
*/
int linetabsize_col(startcol, s)
int startcol;
char_u *s;
int linetabsize_col(int startcol, char_u *s)
{
colnr_T col = startcol;
@ -698,10 +672,7 @@ char_u *s;
/*
* Like linetabsize(), but for a given window instead of the current one.
*/
int win_linetabsize(wp, p, len)
win_T *wp;
char_u *p;
colnr_T len;
int win_linetabsize(win_T *wp, char_u *p, colnr_T len)
{
colnr_T col = 0;
char_u *s;
@ -715,8 +686,7 @@ colnr_T len;
* Return TRUE if 'c' is a normal identifier character:
* Letters and characters from the 'isident' option.
*/
int vim_isIDc(c)
int c;
int vim_isIDc(int c)
{
return c > 0 && c < 0x100 && (chartab[c] & CT_ID_CHAR);
}
@ -726,15 +696,12 @@ int c;
* 'iskeyword' option for current buffer.
* For multi-byte characters mb_get_class() is used (builtin rules).
*/
int vim_iswordc(c)
int c;
int vim_iswordc(int c)
{
return vim_iswordc_buf(c, curbuf);
}
int vim_iswordc_buf(c, buf)
int c;
buf_T *buf;
int vim_iswordc_buf(int c, buf_T *buf)
{
if (c >= 0x100) {
if (enc_dbcs != 0)
@ -748,17 +715,14 @@ buf_T *buf;
/*
* Just like vim_iswordc() but uses a pointer to the (multi-byte) character.
*/
int vim_iswordp(p)
char_u *p;
int vim_iswordp(char_u *p)
{
if (has_mbyte && MB_BYTE2LEN(*p) > 1)
return mb_get_class(p) >= 2;
return GET_CHARTAB(curbuf, *p) != 0;
}
int vim_iswordp_buf(p, buf)
char_u *p;
buf_T *buf;
int vim_iswordp_buf(char_u *p, buf_T *buf)
{
if (has_mbyte && MB_BYTE2LEN(*p) > 1)
return mb_get_class(p) >= 2;
@ -769,8 +733,7 @@ buf_T *buf;
* return TRUE if 'c' is a valid file-name character
* Assume characters above 0x100 are valid (multi-byte).
*/
int vim_isfilec(c)
int c;
int vim_isfilec(int c)
{
return c >= 0x100 || (c > 0 && (chartab[c] & CT_FNAME_CHAR));
}
@ -781,8 +744,7 @@ int c;
* Explicitly interpret ']' as a wildcard character as mch_has_wildcard("]")
* returns false.
*/
int vim_isfilec_or_wc(c)
int c;
int vim_isfilec_or_wc(int c)
{
char_u buf[2];
@ -796,8 +758,7 @@ int c;
* Assume characters above 0x100 are printable (multi-byte), except for
* Unicode.
*/
int vim_isprintc(c)
int c;
int vim_isprintc(int c)
{
if (enc_utf8 && c >= 0x100)
return utf_printable(c);
@ -808,8 +769,7 @@ int c;
* Strict version of vim_isprintc(c), don't return TRUE if "c" is the head
* byte of a double-byte character.
*/
int vim_isprintc_strict(c)
int c;
int vim_isprintc_strict(int c)
{
if (enc_dbcs != 0 && c < 0x100 && MB_BYTE2LEN(c) > 1)
return FALSE;
@ -821,9 +781,7 @@ int c;
/*
* like chartabsize(), but also check for line breaks on the screen
*/
int lbr_chartabsize(s, col)
unsigned char *s;
colnr_T col;
int lbr_chartabsize(unsigned char *s, colnr_T col)
{
if (!curwin->w_p_lbr && *p_sbr == NUL) {
if (curwin->w_p_wrap)
@ -836,9 +794,7 @@ colnr_T col;
/*
* Call lbr_chartabsize() and advance the pointer.
*/
int lbr_chartabsize_adv(s, col)
char_u **s;
colnr_T col;
int lbr_chartabsize_adv(char_u **s, colnr_T col)
{
int retval;
@ -854,11 +810,7 @@ colnr_T col;
* string at start of line. Warning: *headp is only set if it's a non-zero
* value, init to 0 before calling.
*/
int win_lbr_chartabsize(wp, s, col, headp)
win_T *wp;
char_u *s;
colnr_T col;
int *headp UNUSED;
int win_lbr_chartabsize(win_T *wp, char_u *s, colnr_T col, int *headp)
{
int c;
int size;
@ -967,11 +919,7 @@ int *headp UNUSED;
* 'wrap' is on. This means we need to check for a double-byte character that
* doesn't fit at the end of the screen line.
*/
static int win_nolbr_chartabsize(wp, s, col, headp)
win_T *wp;
char_u *s;
colnr_T col;
int *headp;
static int win_nolbr_chartabsize(win_T *wp, char_u *s, colnr_T col, int *headp)
{
int n;
@ -994,9 +942,7 @@ int *headp;
* Return TRUE if virtual column "vcol" is in the rightmost column of window
* "wp".
*/
int in_win_border(wp, vcol)
win_T *wp;
colnr_T vcol;
int in_win_border(win_T *wp, colnr_T vcol)
{
int width1; /* width of first line (after line number) */
int width2; /* width of further lines */
@ -1022,12 +968,7 @@ colnr_T vcol;
*
* This is used very often, keep it fast!
*/
void getvcol(wp, pos, start, cursor, end)
win_T *wp;
pos_T *pos;
colnr_T *start;
colnr_T *cursor;
colnr_T *end;
void getvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *end)
{
colnr_T vcol;
char_u *ptr; /* points to current char */
@ -1129,8 +1070,7 @@ colnr_T *end;
/*
* Get virtual cursor column in the current window, pretending 'list' is off.
*/
colnr_T getvcol_nolist(posp)
pos_T *posp;
colnr_T getvcol_nolist(pos_T *posp)
{
int list_save = curwin->w_p_list;
colnr_T vcol;
@ -1144,12 +1084,7 @@ pos_T *posp;
/*
* Get virtual column in virtual mode.
*/
void getvvcol(wp, pos, start, cursor, end)
win_T *wp;
pos_T *pos;
colnr_T *start;
colnr_T *cursor;
colnr_T *end;
void getvvcol(win_T *wp, pos_T *pos, colnr_T *start, colnr_T *cursor, colnr_T *end)
{
colnr_T col;
colnr_T coladd;
@ -1190,10 +1125,7 @@ colnr_T *end;
* Get the leftmost and rightmost virtual column of pos1 and pos2.
* Used for Visual block mode.
*/
void getvcols(wp, pos1, pos2, left, right)
win_T *wp;
pos_T *pos1, *pos2;
colnr_T *left, *right;
void getvcols(win_T *wp, pos_T *pos1, pos_T *pos2, colnr_T *left, colnr_T *right)
{
colnr_T from1, from2, to1, to2;
@ -1220,8 +1152,7 @@ colnr_T *left, *right;
/*
* skipwhite: skip over ' ' and '\t'.
*/
char_u * skipwhite(q)
char_u *q;
char_u *skipwhite(char_u *q)
{
char_u *p = q;
@ -1233,8 +1164,7 @@ char_u *q;
/*
* skip over digits
*/
char_u * skipdigits(q)
char_u *q;
char_u *skipdigits(char_u *q)
{
char_u *p = q;
@ -1246,8 +1176,7 @@ char_u *q;
/*
* skip over digits and hex characters
*/
char_u * skiphex(q)
char_u *q;
char_u *skiphex(char_u *q)
{
char_u *p = q;
@ -1259,8 +1188,7 @@ char_u *q;
/*
* skip to digit (or NUL after the string)
*/
char_u * skiptodigit(q)
char_u *q;
char_u *skiptodigit(char_u *q)
{
char_u *p = q;
@ -1272,8 +1200,7 @@ char_u *q;
/*
* skip to hex character (or NUL after the string)
*/
char_u * skiptohex(q)
char_u *q;
char_u *skiptohex(char_u *q)
{
char_u *p = q;
@ -1288,8 +1215,7 @@ char_u *q;
* superscript 1 to be a digit.
* Use the VIM_ISDIGIT() macro for simple arguments.
*/
int vim_isdigit(c)
int c;
int vim_isdigit(int c)
{
return c >= '0' && c <= '9';
}
@ -1299,8 +1225,7 @@ int c;
* We don't use isxdigit() here, because on some systems it also considers
* superscript 1 to be a digit.
*/
int vim_isxdigit(c)
int c;
int vim_isxdigit(int c)
{
return (c >= '0' && c <= '9')
|| (c >= 'a' && c <= 'f')
@ -1323,8 +1248,7 @@ static char_u latin1upper[257] =
static char_u latin1lower[257] =
" !\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xd7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xdf\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff";
int vim_islower(c)
int c;
int vim_islower(int c)
{
if (c <= '@')
return FALSE;
@ -1345,8 +1269,7 @@ int c;
return islower(c);
}
int vim_isupper(c)
int c;
int vim_isupper(int c)
{
if (c <= '@')
return FALSE;
@ -1367,8 +1290,7 @@ int c;
return isupper(c);
}
int vim_toupper(c)
int c;
int vim_toupper(int c)
{
if (c <= '@')
return c;
@ -1389,8 +1311,7 @@ int c;
return TOUPPER_LOC(c);
}
int vim_tolower(c)
int c;
int vim_tolower(int c)
{
if (c <= '@')
return c;
@ -1414,8 +1335,7 @@ int c;
/*
* skiptowhite: skip over text until ' ' or '\t' or NUL.
*/
char_u * skiptowhite(p)
char_u *p;
char_u *skiptowhite(char_u *p)
{
while (*p != ' ' && *p != '\t' && *p != NUL)
++p;
@ -1427,8 +1347,7 @@ char_u *p;
/*
* skiptowhite_esc: Like skiptowhite(), but also skip escaped chars
*/
char_u * skiptowhite_esc(p)
char_u *p;
char_u *skiptowhite_esc(char_u *p)
{
while (*p != ' ' && *p != '\t' && *p != NUL) {
if ((*p == '\\' || *p == Ctrl_V) && *(p + 1) != NUL)
@ -1443,8 +1362,7 @@ char_u *p;
* Getdigits: Get a number from a string and skip over it.
* Note: the argument is a pointer to a char_u pointer!
*/
long getdigits(pp)
char_u **pp;
long getdigits(char_u **pp)
{
char_u *p;
long retval;
@ -1461,8 +1379,7 @@ char_u **pp;
/*
* Return TRUE if "lbuf" is empty or only contains blanks.
*/
int vim_isblankline(lbuf)
char_u *lbuf;
int vim_isblankline(char_u *lbuf)
{
char_u *p;
@ -1486,15 +1403,17 @@ char_u *lbuf;
* If "dohex" is non-zero recognize hex numbers, when > 1 always assume
* hex number.
*/
void vim_str2nr(start, hexp, len, dooct, dohex, nptr, unptr)
char_u *start;
int *hexp; /* return: type of number 0 = decimal, 'x'
void
vim_str2nr (
char_u *start,
int *hexp, /* return: type of number 0 = decimal, 'x'
or 'X' is hex, '0' = octal */
int *len; /* return: detected length of number */
int dooct; /* recognize octal number */
int dohex; /* recognize hex number */
long *nptr; /* return: signed result */
unsigned long *unptr; /* return: unsigned result */
int *len, /* return: detected length of number */
int dooct, /* recognize octal number */
int dohex, /* recognize hex number */
long *nptr, /* return: signed result */
unsigned long *unptr /* return: unsigned result */
)
{
char_u *ptr = start;
int hex = 0; /* default is decimal */
@ -1569,8 +1488,7 @@ unsigned long *unptr; /* return: unsigned result */
* Return the value of a single hex character.
* Only valid when the argument is '0' - '9', 'A' - 'F' or 'a' - 'f'.
*/
int hex2nr(c)
int c;
int hex2nr(int c)
{
if (c >= 'a' && c <= 'f')
return c - 'a' + 10;
@ -1585,8 +1503,7 @@ int c;
* Convert two hex characters to a byte.
* Return -1 if one of the characters is not hex.
*/
int hexhex2nr(p)
char_u *p;
int hexhex2nr(char_u *p)
{
if (!vim_isxdigit(p[0]) || !vim_isxdigit(p[1]))
return -1;
@ -1607,8 +1524,7 @@ char_u *p;
* character, assume that all multi-byte characters are valid file name
* characters.
*/
int rem_backslash(str)
char_u *str;
int rem_backslash(char_u *str)
{
#ifdef BACKSLASH_IN_FILENAME
return str[0] == '\\'
@ -1628,8 +1544,7 @@ char_u *str;
* For MS-DOS we only do this if the character after the backslash
* is not a normal file character.
*/
void backslash_halve(p)
char_u *p;
void backslash_halve(char_u *p)
{
for (; *p; ++p)
if (rem_backslash(p))
@ -1639,8 +1554,7 @@ char_u *p;
/*
* backslash_halve() plus save the result in allocated memory.
*/
char_u * backslash_halve_save(p)
char_u *p;
char_u *backslash_halve_save(char_u *p)
{
char_u *res;

View File

@ -55,8 +55,7 @@ static diff_T *diff_alloc_new __ARGS((tabpage_T *tp, diff_T *dprev, diff_T *dp))
/*
* Called when deleting or unloading a buffer: No longer make a diff with it.
*/
void diff_buf_delete(buf)
buf_T *buf;
void diff_buf_delete(buf_T *buf)
{
int i;
tabpage_T *tp;
@ -76,8 +75,7 @@ buf_T *buf;
* Check if the current buffer should be added to or removed from the list of
* diff buffers.
*/
void diff_buf_adjust(win)
win_T *win;
void diff_buf_adjust(win_T *win)
{
win_T *wp;
int i;
@ -108,8 +106,7 @@ win_T *win;
* This must be done before any autocmd, because a command may use info
* about the screen contents.
*/
void diff_buf_add(buf)
buf_T *buf;
void diff_buf_add(buf_T *buf)
{
int i;
@ -131,8 +128,7 @@ buf_T *buf;
* Find buffer "buf" in the list of diff buffers for the current tab page.
* Return its index or DB_COUNT if not found.
*/
static int diff_buf_idx(buf)
buf_T *buf;
static int diff_buf_idx(buf_T *buf)
{
int idx;
@ -146,9 +142,7 @@ buf_T *buf;
* Find buffer "buf" in the list of diff buffers for tab page "tp".
* Return its index or DB_COUNT if not found.
*/
static int diff_buf_idx_tp(buf, tp)
buf_T *buf;
tabpage_T *tp;
static int diff_buf_idx_tp(buf_T *buf, tabpage_T *tp)
{
int idx;
@ -162,8 +156,7 @@ tabpage_T *tp;
* Mark the diff info involving buffer "buf" as invalid, it will be updated
* when info is requested.
*/
void diff_invalidate(buf)
buf_T *buf;
void diff_invalidate(buf_T *buf)
{
tabpage_T *tp;
int i;
@ -181,11 +174,7 @@ buf_T *buf;
/*
* Called by mark_adjust(): update line numbers in "curbuf".
*/
void diff_mark_adjust(line1, line2, amount, amount_after)
linenr_T line1;
linenr_T line2;
long amount;
long amount_after;
void diff_mark_adjust(linenr_T line1, linenr_T line2, long amount, long amount_after)
{
int idx;
tabpage_T *tp;
@ -205,13 +194,7 @@ long amount_after;
* new change block and update the line numbers in following blocks.
* When inserting/deleting lines in existing change blocks, update them.
*/
static void diff_mark_adjust_tp(tp, idx, line1, line2, amount, amount_after)
tabpage_T *tp;
int idx;
linenr_T line1;
linenr_T line2;
long amount;
long amount_after;
static void diff_mark_adjust_tp(tabpage_T *tp, int idx, linenr_T line1, linenr_T line2, long amount, long amount_after)
{
diff_T *dp;
diff_T *dprev;
@ -417,10 +400,7 @@ long amount_after;
/*
* Allocate a new diff block and link it between "dprev" and "dp".
*/
static diff_T * diff_alloc_new(tp, dprev, dp)
tabpage_T *tp;
diff_T *dprev;
diff_T *dp;
static diff_T *diff_alloc_new(tabpage_T *tp, diff_T *dprev, diff_T *dp)
{
diff_T *dnew;
@ -441,9 +421,7 @@ diff_T *dp;
* This may result in a change where all buffers have zero lines, the caller
* must take care of removing it.
*/
static void diff_check_unchanged(tp, dp)
tabpage_T *tp;
diff_T *dp;
static void diff_check_unchanged(tabpage_T *tp, diff_T *dp)
{
int i_org;
int i_new;
@ -512,9 +490,7 @@ diff_T *dp;
* Check if a diff block doesn't contain invalid line numbers.
* This can happen when the diff program returns invalid results.
*/
static int diff_check_sanity(tp, dp)
tabpage_T *tp;
diff_T *dp;
static int diff_check_sanity(tabpage_T *tp, diff_T *dp)
{
int i;
@ -529,8 +505,10 @@ diff_T *dp;
/*
* Mark all diff buffers in the current tab page for redraw.
*/
static void diff_redraw(dofold)
int dofold; /* also recompute the folds */
static void
diff_redraw (
int dofold /* also recompute the folds */
)
{
win_T *wp;
int n;
@ -557,9 +535,7 @@ int dofold; /* also recompute the folds */
* Always use 'fileformat' set to "unix".
* Return FAIL for failure
*/
static int diff_write(buf, fname)
buf_T *buf;
char_u *fname;
static int diff_write(buf_T *buf, char_u *fname)
{
int r;
char_u *save_ff;
@ -579,8 +555,10 @@ char_u *fname;
* The buffers are written to a file, also for unmodified buffers (the file
* could have been produced by autocommands, e.g. the netrw plugin).
*/
void ex_diffupdate(eap)
exarg_T *eap UNUSED; /* can be NULL */
void
ex_diffupdate (
exarg_T *eap /* can be NULL */
)
{
buf_T *buf;
int idx_orig;
@ -726,10 +704,7 @@ theend:
/*
* Make a diff between files "tmp_orig" and "tmp_new", results in "tmp_diff".
*/
static void diff_file(tmp_orig, tmp_new, tmp_diff)
char_u *tmp_orig;
char_u *tmp_new;
char_u *tmp_diff;
static void diff_file(char_u *tmp_orig, char_u *tmp_new, char_u *tmp_diff)
{
char_u *cmd;
size_t len;
@ -769,8 +744,7 @@ char_u *tmp_diff;
* The buffer is written to a file, also for unmodified buffers (the file
* could have been produced by autocommands, e.g. the netrw plugin).
*/
void ex_diffpatch(eap)
exarg_T *eap;
void ex_diffpatch(exarg_T *eap)
{
char_u *tmp_orig; /* name of original temp file */
char_u *tmp_new; /* name of patched temp file */
@ -925,8 +899,7 @@ theend:
/*
* Split the window and edit another file, setting options to show the diffs.
*/
void ex_diffsplit(eap)
exarg_T *eap;
void ex_diffsplit(exarg_T *eap)
{
win_T *old_curwin = curwin;
@ -950,8 +923,7 @@ exarg_T *eap;
/*
* Set options to show diffs for the current window.
*/
void ex_diffthis(eap)
exarg_T *eap UNUSED;
void ex_diffthis(exarg_T *eap)
{
/* Set 'diff', 'scrollbind' on and 'wrap' off. */
diff_win_options(curwin, TRUE);
@ -960,9 +932,11 @@ exarg_T *eap UNUSED;
/*
* Set options in window "wp" for diff mode.
*/
void diff_win_options(wp, addbuf)
win_T *wp;
int addbuf; /* Add buffer to diff. */
void
diff_win_options (
win_T *wp,
int addbuf /* Add buffer to diff. */
)
{
win_T *old_curwin = curwin;
@ -1016,8 +990,7 @@ int addbuf; /* Add buffer to diff. */
* Set options not to show diffs. For the current window or all windows.
* Only in the current tab page.
*/
void ex_diffoff(eap)
exarg_T *eap;
void ex_diffoff(exarg_T *eap)
{
win_T *wp;
win_T *old_curwin = curwin;
@ -1079,10 +1052,12 @@ exarg_T *eap;
/*
* Read the diff output and add each entry to the diff list.
*/
static void diff_read(idx_orig, idx_new, fname)
int idx_orig; /* idx of original file */
int idx_new; /* idx of new file */
char_u *fname; /* name of diff output file */
static void
diff_read (
int idx_orig, /* idx of original file */
int idx_new, /* idx of new file */
char_u *fname /* name of diff output file */
)
{
FILE *fd;
diff_T *dprev = NULL;
@ -1251,11 +1226,7 @@ done:
/*
* Copy an entry at "dp" from "idx_orig" to "idx_new".
*/
static void diff_copy_entry(dprev, dp, idx_orig, idx_new)
diff_T *dprev;
diff_T *dp;
int idx_orig;
int idx_new;
static void diff_copy_entry(diff_T *dprev, diff_T *dp, int idx_orig, int idx_new)
{
long off;
@ -1271,8 +1242,7 @@ int idx_new;
/*
* Clear the list of diffblocks for tab page "tp".
*/
void diff_clear(tp)
tabpage_T *tp;
void diff_clear(tabpage_T *tp)
{
diff_T *p, *next_p;
@ -1292,9 +1262,7 @@ tabpage_T *tp;
* when 'diffopt' doesn't contain "filler").
* This should only be used for windows where 'diff' is set.
*/
int diff_check(wp, lnum)
win_T *wp;
linenr_T lnum;
int diff_check(win_T *wp, linenr_T lnum)
{
int idx; /* index in tp_diffbuf[] for this buffer */
diff_T *dp;
@ -1379,10 +1347,7 @@ linenr_T lnum;
/*
* Compare two entries in diff "*dp" and return TRUE if they are equal.
*/
static int diff_equal_entry(dp, idx1, idx2)
diff_T *dp;
int idx1;
int idx2;
static int diff_equal_entry(diff_T *dp, int idx1, int idx2)
{
int i;
char_u *line;
@ -1410,9 +1375,7 @@ int idx2;
* Compare strings "s1" and "s2" according to 'diffopt'.
* Return non-zero when they are different.
*/
static int diff_cmp(s1, s2)
char_u *s1;
char_u *s2;
static int diff_cmp(char_u *s1, char_u *s2)
{
char_u *p1, *p2;
int l;
@ -1463,9 +1426,7 @@ char_u *s2;
/*
* Return the number of filler lines above "lnum".
*/
int diff_check_fill(wp, lnum)
win_T *wp;
linenr_T lnum;
int diff_check_fill(win_T *wp, linenr_T lnum)
{
int n;
@ -1482,9 +1443,7 @@ linenr_T lnum;
* Set the topline of "towin" to match the position in "fromwin", so that they
* show the same diff'ed lines.
*/
void diff_set_topline(fromwin, towin)
win_T *fromwin;
win_T *towin;
void diff_set_topline(win_T *fromwin, win_T *towin)
{
buf_T *frombuf = fromwin->w_buffer;
linenr_T lnum = fromwin->w_topline;
@ -1586,7 +1545,7 @@ win_T *towin;
/*
* This is called when 'diffopt' is changed.
*/
int diffopt_changed() {
int diffopt_changed(void) {
char_u *p;
int diff_context_new = 6;
int diff_flags_new = 0;
@ -1648,7 +1607,7 @@ int diffopt_changed() {
/*
* Return TRUE if 'diffopt' contains "horizontal".
*/
int diffopt_horizontal() {
int diffopt_horizontal(void) {
return (diff_flags & DIFF_HORIZONTAL) != 0;
}
@ -1656,11 +1615,13 @@ int diffopt_horizontal() {
* Find the difference within a changed line.
* Returns TRUE if the line was added, no other buffer has it.
*/
int diff_find_change(wp, lnum, startp, endp)
win_T *wp;
linenr_T lnum;
int *startp; /* first char of the change */
int *endp; /* last char of the change */
int
diff_find_change (
win_T *wp,
linenr_T lnum,
int *startp, /* first char of the change */
int *endp /* last char of the change */
)
{
char_u *line_org;
char_u *line_new;
@ -1763,9 +1724,7 @@ int *endp; /* last char of the change */
* be in a fold.
* Return FALSE if there are no diff blocks at all in this window.
*/
int diff_infold(wp, lnum)
win_T *wp;
linenr_T lnum;
int diff_infold(win_T *wp, linenr_T lnum)
{
int i;
int idx = -1;
@ -1808,8 +1767,7 @@ linenr_T lnum;
/*
* "dp" and "do" commands.
*/
void nv_diffgetput(put)
int put;
void nv_diffgetput(int put)
{
exarg_T ea;
@ -1828,8 +1786,7 @@ int put;
* ":diffget"
* ":diffput"
*/
void ex_diffgetput(eap)
exarg_T *eap;
void ex_diffgetput(exarg_T *eap)
{
linenr_T lnum;
int count;
@ -2107,9 +2064,7 @@ exarg_T *eap;
* Skip buffer with index "skip_idx".
* When there are no diffs, all folds are removed.
*/
static void diff_fold_update(dp, skip_idx)
diff_T *dp;
int skip_idx;
static void diff_fold_update(diff_T *dp, int skip_idx)
{
int i;
win_T *wp;
@ -2124,8 +2079,7 @@ int skip_idx;
/*
* Return TRUE if buffer "buf" is in diff-mode.
*/
int diff_mode_buf(buf)
buf_T *buf;
int diff_mode_buf(buf_T *buf)
{
tabpage_T *tp;
@ -2139,9 +2093,7 @@ buf_T *buf;
* Move "count" times in direction "dir" to the next diff block.
* Return FAIL if there isn't such a diff block.
*/
int diff_move_to(dir, count)
int dir;
long count;
int diff_move_to(int dir, long count)
{
int idx;
linenr_T lnum = curwin->w_cursor.lnum;
@ -2190,11 +2142,7 @@ long count;
return OK;
}
linenr_T diff_get_corresponding_line(buf1, lnum1, buf2, lnum3)
buf_T *buf1;
linenr_T lnum1;
buf_T *buf2;
linenr_T lnum3;
linenr_T diff_get_corresponding_line(buf_T *buf1, linenr_T lnum1, buf_T *buf2, linenr_T lnum3)
{
int idx1;
int idx2;
@ -2257,9 +2205,7 @@ linenr_T lnum3;
* For line "lnum" in the current window find the equivalent lnum in window
* "wp", compensating for inserted/deleted lines.
*/
linenr_T diff_lnum_win(lnum, wp)
linenr_T lnum;
win_T *wp;
linenr_T diff_lnum_win(linenr_T lnum, win_T *wp)
{
diff_T *dp;
int idx;

View File

@ -1623,8 +1623,7 @@ static digr_T digraphdefault[] =
/*
* handle digraphs after typing a character
*/
int do_digraph(c)
int c;
int do_digraph(int c)
{
static int backspaced; /* character before K_BS */
static int lastchar; /* last typed character */
@ -1647,8 +1646,10 @@ int c;
* mode.
* Returns composed character, or NUL when ESC was used.
*/
int get_digraph(cmdline)
int cmdline; /* TRUE when called from the cmdline */
int
get_digraph (
int cmdline /* TRUE when called from the cmdline */
)
{
int c, cc;
@ -1683,10 +1684,7 @@ int cmdline; /* TRUE when called from the cmdline */
* If no match, return "char2".
* If "meta_char" is TRUE and "char1" is a space, return "char2" | 0x80.
*/
static int getexactdigraph(char1, char2, meta_char)
int char1;
int char2;
int meta_char;
static int getexactdigraph(int char1, int char2, int meta_char)
{
int i;
int retval = 0;
@ -1759,10 +1757,7 @@ int meta_char;
* Get digraph.
* Allow for both char1-char2 and char2-char1
*/
int getdigraph(char1, char2, meta_char)
int char1;
int char2;
int meta_char;
int getdigraph(int char1, int char2, int meta_char)
{
int retval;
@ -1777,8 +1772,7 @@ int meta_char;
* Add the digraphs in the argument to the digraph table.
* format: {c1}{c2} char {c1}{c2} char ...
*/
void putdigraph(str)
char_u *str;
void putdigraph(char_u *str)
{
int char1, char2, n;
int i;
@ -1828,7 +1822,7 @@ char_u *str;
}
}
void listdigraphs() {
void listdigraphs(void) {
int i;
digr_T *dp;
@ -1867,8 +1861,7 @@ void listdigraphs() {
wrong, in which case we messed up ScreenLines */
}
static void printdigraph(dp)
digr_T *dp;
static void printdigraph(digr_T *dp)
{
char_u buf[30];
char_u *p;
@ -1925,7 +1918,7 @@ static void keymap_unload __ARGS((void));
* used when setting the option, not later when the value has already been
* checked.
*/
char_u * keymap_init() {
char_u *keymap_init(void) {
curbuf->b_kmap_state &= ~KEYMAP_INIT;
if (*curbuf->b_p_keymap == NUL) {
@ -1967,8 +1960,7 @@ char_u * keymap_init() {
/*
* ":loadkeymap" command: load the following lines as the keymap.
*/
void ex_loadkeymap(eap)
exarg_T *eap;
void ex_loadkeymap(exarg_T *eap)
{
char_u *line;
char_u *p;
@ -2044,7 +2036,7 @@ exarg_T *eap;
/*
* Stop using 'keymap'.
*/
static void keymap_unload() {
static void keymap_unload(void) {
char_u buf[KMAP_MAXLEN + 10];
int i;
char_u *save_cpo = p_cpo;

File diff suppressed because it is too large Load Diff

2511
src/eval.c

File diff suppressed because it is too large Load Diff

View File

@ -32,8 +32,7 @@ help_compare __ARGS((const void *s1, const void *s2));
/*
* ":ascii" and "ga".
*/
void do_ascii(eap)
exarg_T *eap UNUSED;
void do_ascii(exarg_T *eap)
{
int c;
int cval;
@ -113,8 +112,7 @@ exarg_T *eap UNUSED;
/*
* ":left", ":center" and ":right": align text.
*/
void ex_align(eap)
exarg_T *eap;
void ex_align(exarg_T *eap)
{
pos_T save_curpos;
int len;
@ -204,8 +202,7 @@ exarg_T *eap;
/*
* Get the length of the current line, excluding trailing white space.
*/
static int linelen(has_tab)
int *has_tab;
static int linelen(int *has_tab)
{
char_u *line;
char_u *first;
@ -252,9 +249,7 @@ typedef struct {
static int
sort_compare __ARGS((const void *s1, const void *s2));
static int sort_compare(s1, s2)
const void *s1;
const void *s2;
static int sort_compare(const void *s1, const void *s2)
{
sorti_T l1 = *(sorti_T *)s1;
sorti_T l2 = *(sorti_T *)s2;
@ -298,8 +293,7 @@ const void *s2;
/*
* ":sort".
*/
void ex_sort(eap)
exarg_T *eap;
void ex_sort(exarg_T *eap)
{
regmatch_T regmatch;
int len;
@ -509,8 +503,7 @@ sortend:
/*
* ":retab".
*/
void ex_retab(eap)
exarg_T *eap;
void ex_retab(exarg_T *eap)
{
linenr_T lnum;
int got_tab = FALSE;
@ -642,10 +635,7 @@ exarg_T *eap;
*
* return FAIL for failure, OK otherwise
*/
int do_move(line1, line2, dest)
linenr_T line1;
linenr_T line2;
linenr_T dest;
int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
{
char_u *str;
linenr_T l;
@ -747,10 +737,7 @@ linenr_T dest;
/*
* ":copy"
*/
void ex_copy(line1, line2, n)
linenr_T line1;
linenr_T line2;
linenr_T n;
void ex_copy(linenr_T line1, linenr_T line2, linenr_T n)
{
linenr_T count;
char_u *p;
@ -802,7 +789,7 @@ linenr_T n;
static char_u *prevcmd = NULL; /* the previous command */
#if defined(EXITFREE) || defined(PROTO)
void free_prev_shellcmd() {
void free_prev_shellcmd(void) {
vim_free(prevcmd);
}
@ -813,11 +800,7 @@ void free_prev_shellcmd() {
* Bangs in the argument are replaced with the previously entered command.
* Remember the argument.
*/
void do_bang(addr_count, eap, forceit, do_in, do_out)
int addr_count;
exarg_T *eap;
int forceit;
int do_in, do_out;
void do_bang(int addr_count, exarg_T *eap, int forceit, int do_in, int do_out)
{
char_u *arg = eap->arg; /* command */
linenr_T line1 = eap->line1; /* start of range */
@ -952,11 +935,15 @@ int do_in, do_out;
* We use input redirection if do_in is TRUE.
* We use output redirection if do_out is TRUE.
*/
static void do_filter(line1, line2, eap, cmd, do_in, do_out)
linenr_T line1, line2;
exarg_T *eap; /* for forced 'ff' and 'fenc' */
char_u *cmd;
int do_in, do_out;
static void
do_filter (
linenr_T line1,
linenr_T line2,
exarg_T *eap, /* for forced 'ff' and 'fenc' */
char_u *cmd,
int do_in,
int do_out
)
{
char_u *itmp = NULL;
char_u *otmp = NULL;
@ -1164,9 +1151,11 @@ filterend:
* Call a shell to execute a command.
* When "cmd" is NULL start an interactive shell.
*/
void do_shell(cmd, flags)
char_u *cmd;
int flags; /* may be SHELL_DOOUT when output is redirected */
void
do_shell (
char_u *cmd,
int flags /* may be SHELL_DOOUT when output is redirected */
)
{
buf_T *buf;
int save_nwr;
@ -1269,10 +1258,12 @@ int flags; /* may be SHELL_DOOUT when output is redirected */
* output redirection file.
* Returns an allocated string with the shell command, or NULL for failure.
*/
char_u * make_filter_cmd(cmd, itmp, otmp)
char_u *cmd; /* command */
char_u *itmp; /* NULL or name of input file */
char_u *otmp; /* NULL or name of output file */
char_u *
make_filter_cmd (
char_u *cmd, /* command */
char_u *itmp, /* NULL or name of input file */
char_u *otmp /* NULL or name of output file */
)
{
char_u *buf;
long_u len;
@ -1342,11 +1333,7 @@ char_u *otmp; /* NULL or name of output file */
* The caller should make sure that there is enough room:
* STRLEN(opt) + STRLEN(fname) + 3
*/
void append_redir(buf, buflen, opt, fname)
char_u *buf;
int buflen;
char_u *opt;
char_u *fname;
void append_redir(char_u *buf, int buflen, char_u *opt, char_u *fname)
{
char_u *p;
char_u *end;
@ -1373,7 +1360,7 @@ char_u *fname;
static int no_viminfo __ARGS((void));
static int viminfo_errcnt;
static int no_viminfo() {
static int no_viminfo(void) {
/* "vim -i NONE" does not read or write a viminfo file */
return use_viminfo != NULL && STRCMP(use_viminfo, "NONE") == 0;
}
@ -1382,10 +1369,7 @@ static int no_viminfo() {
* Report an error for reading a viminfo file.
* Count the number of errors. When there are more than 10, return TRUE.
*/
int viminfo_error(errnum, message, line)
char *errnum;
char *message;
char_u *line;
int viminfo_error(char *errnum, char *message, char_u *line)
{
vim_snprintf((char *)IObuff, IOSIZE, _("%sviminfo: %s in line: "),
errnum, message);
@ -1404,9 +1388,11 @@ char_u *line;
* read_viminfo() -- Read the viminfo file. Registers etc. which are already
* set are not over-written unless "flags" includes VIF_FORCEIT. -- webb
*/
int read_viminfo(file, flags)
char_u *file; /* file name or NULL to use default name */
int flags; /* VIF_WANT_INFO et al. */
int
read_viminfo (
char_u *file, /* file name or NULL to use default name */
int flags /* VIF_WANT_INFO et al. */
)
{
FILE *fp;
char_u *fname;
@ -1448,9 +1434,7 @@ int flags; /* VIF_WANT_INFO et al. */
* If "forceit" is TRUE, then the old file is not read in, and only internal
* info is written to the file.
*/
void write_viminfo(file, forceit)
char_u *file;
int forceit;
void write_viminfo(char_u *file, int forceit)
{
char_u *fname;
FILE *fp_in = NULL; /* input viminfo file, if any */
@ -1678,8 +1662,7 @@ end:
* expand environment variables.
* Returns an allocated string. NULL when out of memory.
*/
static char_u * viminfo_filename(file)
char_u *file;
static char_u *viminfo_filename(char_u *file)
{
if (file == NULL || *file == NUL) {
if (use_viminfo != NULL)
@ -1707,10 +1690,7 @@ char_u *file;
/*
* do_viminfo() -- Should only be called from read_viminfo() & write_viminfo().
*/
static void do_viminfo(fp_in, fp_out, flags)
FILE *fp_in;
FILE *fp_out;
int flags;
static void do_viminfo(FILE *fp_in, FILE *fp_out, int flags)
{
int count = 0;
int eof = FALSE;
@ -1763,10 +1743,7 @@ int flags;
* first part of the viminfo file which contains everything but the marks that
* are local to a file. Returns TRUE when end-of-file is reached. -- webb
*/
static int read_viminfo_up_to_marks(virp, forceit, writing)
vir_T *virp;
int forceit;
int writing;
static int read_viminfo_up_to_marks(vir_T *virp, int forceit, int writing)
{
int eof;
buf_T *buf;
@ -1843,8 +1820,7 @@ int writing;
* 'encoding'. If different and the 'c' flag is in 'viminfo', setup for
* conversion of text with iconv() in viminfo_readstring().
*/
static int viminfo_encoding(virp)
vir_T *virp;
static int viminfo_encoding(vir_T *virp)
{
char_u *p;
int i;
@ -1868,8 +1844,7 @@ vir_T *virp;
* Read a line from the viminfo file.
* Returns TRUE for end-of-file;
*/
int viminfo_readline(virp)
vir_T *virp;
int viminfo_readline(vir_T *virp)
{
return vim_fgets(virp->vir_line, LSIZE, virp->vir_fd);
}
@ -1884,10 +1859,12 @@ vir_T *virp;
*
* Return the string in allocated memory (NULL when out of memory).
*/
char_u * viminfo_readstring(virp, off, convert)
vir_T *virp;
int off; /* offset for virp->vir_line */
int convert UNUSED; /* convert the string */
char_u *
viminfo_readstring (
vir_T *virp,
int off, /* offset for virp->vir_line */
int convert /* convert the string */
)
{
char_u *retval;
char_u *s, *d;
@ -1945,9 +1922,7 @@ int convert UNUSED; /* convert the string */
* - write " CTRL-V <length> \n " in first line
* - write " < <string> \n " in second line
*/
void viminfo_writestring(fd, p)
FILE *fd;
char_u *p;
void viminfo_writestring(FILE *fd, char_u *p)
{
int c;
char_u *s;
@ -1983,8 +1958,7 @@ char_u *p;
* ^? ^H
* not ^? ^?
*/
void do_fixdel(eap)
exarg_T *eap UNUSED;
void do_fixdel(exarg_T *eap)
{
char_u *p;
@ -1993,10 +1967,7 @@ exarg_T *eap UNUSED;
&& *p == DEL ? (char_u *)CTRL_H_STR : DEL_STR, FALSE);
}
void print_line_no_prefix(lnum, use_number, list)
linenr_T lnum;
int use_number;
int list;
void print_line_no_prefix(linenr_T lnum, int use_number, int list)
{
char_u numbuf[30];
@ -2011,10 +1982,7 @@ int list;
/*
* Print a text line. Also in silent mode ("ex -s").
*/
void print_line(lnum, use_number, list)
linenr_T lnum;
int use_number;
int list;
void print_line(linenr_T lnum, int use_number, int list)
{
int save_silent = silent_mode;
@ -2031,8 +1999,7 @@ int list;
info_message = FALSE;
}
int rename_buffer(new_fname)
char_u *new_fname;
int rename_buffer(char_u *new_fname)
{
char_u *fname, *sfname, *xfname;
buf_T *buf;
@ -2078,8 +2045,7 @@ char_u *new_fname;
/*
* ":file[!] [fname]".
*/
void ex_file(eap)
exarg_T *eap;
void ex_file(exarg_T *eap)
{
/* ":0file" removes the file name. Check for illegal uses ":3file",
* "0file name", etc. */
@ -2102,8 +2068,7 @@ exarg_T *eap;
/*
* ":update".
*/
void ex_update(eap)
exarg_T *eap;
void ex_update(exarg_T *eap)
{
if (curbufIsChanged())
(void)do_write(eap);
@ -2112,8 +2077,7 @@ exarg_T *eap;
/*
* ":write" and ":saveas".
*/
void ex_write(eap)
exarg_T *eap;
void ex_write(exarg_T *eap)
{
if (eap->usefilter) /* input lines to shell command */
do_bang(1, eap, FALSE, TRUE, FALSE);
@ -2129,8 +2093,7 @@ exarg_T *eap;
*
* return FAIL for failure, OK otherwise
*/
int do_write(eap)
exarg_T *eap;
int do_write(exarg_T *eap)
{
int other;
char_u *fname = NULL; /* init to shut up gcc */
@ -2287,13 +2250,15 @@ theend:
* May set eap->forceit if a dialog says it's OK to overwrite.
* Return OK if it's OK, FAIL if it is not.
*/
int check_overwrite(eap, buf, fname, ffname, other)
exarg_T *eap;
buf_T *buf;
char_u *fname; /* file name to be used (can differ from
int
check_overwrite (
exarg_T *eap,
buf_T *buf,
char_u *fname, /* file name to be used (can differ from
buf->ffname) */
char_u *ffname; /* full path version of fname */
int other; /* writing under other name */
char_u *ffname, /* full path version of fname */
int other /* writing under other name */
)
{
/*
* write to other file or b_flags set or not writing the whole file:
@ -2384,8 +2349,7 @@ int other; /* writing under other name */
/*
* Handle ":wnext", ":wNext" and ":wprevious" commands.
*/
void ex_wnext(eap)
exarg_T *eap;
void ex_wnext(exarg_T *eap)
{
int i;
@ -2402,8 +2366,7 @@ exarg_T *eap;
/*
* ":wall", ":wqall" and ":xall": Write all changed files (and exit).
*/
void do_wqall(eap)
exarg_T *eap;
void do_wqall(exarg_T *eap)
{
buf_T *buf;
int error = 0;
@ -2453,7 +2416,7 @@ exarg_T *eap;
* Check the 'write' option.
* Return TRUE and give a message when it's not st.
*/
int not_writing() {
int not_writing(void) {
if (p_write)
return FALSE;
EMSG(_("E142: File not written: Writing is disabled by 'write' option"));
@ -2465,9 +2428,7 @@ int not_writing() {
* read-only). Ask for overruling in a dialog. Return TRUE and give an error
* message when the buffer is readonly.
*/
static int check_readonly(forceit, buf)
int *forceit;
buf_T *buf;
static int check_readonly(int *forceit, buf_T *buf)
{
struct stat st;
@ -2517,13 +2478,7 @@ buf_T *buf;
* -1 for successfully opening another file.
* 'lnum' is the line number for the cursor in the new file (if non-zero).
*/
int getfile(fnum, ffname, sfname, setpm, lnum, forceit)
int fnum;
char_u *ffname;
char_u *sfname;
int setpm;
linenr_T lnum;
int forceit;
int getfile(int fnum, char_u *ffname, char_u *sfname, int setpm, linenr_T lnum, int forceit)
{
int other;
int retval;
@ -2607,14 +2562,16 @@ theend:
*
* return FAIL for failure, OK otherwise
*/
int do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin)
int fnum;
char_u *ffname;
char_u *sfname;
exarg_T *eap; /* can be NULL! */
linenr_T newlnum;
int flags;
win_T *oldwin;
int
do_ecmd (
int fnum,
char_u *ffname,
char_u *sfname,
exarg_T *eap, /* can be NULL! */
linenr_T newlnum,
int flags,
win_T *oldwin
)
{
int other_file; /* TRUE if editing another file */
int oldbuf; /* TRUE if using existing buffer */
@ -3173,8 +3130,7 @@ theend:
return retval;
}
static void delbuf_msg(name)
char_u *name;
static void delbuf_msg(char_u *name)
{
EMSG2(_("E143: Autocommands unexpectedly deleted new buffer %s"),
name == NULL ? (char_u *)"" : name);
@ -3187,8 +3143,7 @@ static int append_indent = 0; /* autoindent for first line */
/*
* ":insert" and ":append", also used by ":change"
*/
void ex_append(eap)
exarg_T *eap;
void ex_append(exarg_T *eap)
{
char_u *theline;
int did_undo = FALSE;
@ -3312,8 +3267,7 @@ exarg_T *eap;
/*
* ":change"
*/
void ex_change(eap)
exarg_T *eap;
void ex_change(exarg_T *eap)
{
linenr_T lnum;
@ -3340,8 +3294,7 @@ exarg_T *eap;
ex_append(eap);
}
void ex_z(eap)
exarg_T *eap;
void ex_z(exarg_T *eap)
{
char_u *x;
int bigness;
@ -3460,7 +3413,7 @@ exarg_T *eap;
* If so, give an error message and return TRUE.
* Otherwise, return FALSE.
*/
int check_restricted() {
int check_restricted(void) {
if (restricted) {
EMSG(_("E145: Shell commands not allowed in rvim"));
return TRUE;
@ -3473,7 +3426,7 @@ int check_restricted() {
* If so, give an error message and return TRUE.
* Otherwise, return FALSE.
*/
int check_secure() {
int check_secure(void) {
if (secure) {
secure = 2;
EMSG(_(e_curdir));
@ -3504,8 +3457,7 @@ static int global_need_beginline; /* call beginline() after ":g" */
*
* The usual escapes are supported as described in the regexp docs.
*/
void do_sub(eap)
exarg_T *eap;
void do_sub(exarg_T *eap)
{
linenr_T lnum;
long i = 0;
@ -4416,8 +4368,10 @@ outofmem:
* Can also be used after a ":global" command.
* Return TRUE if a message was given.
*/
int do_sub_msg(count_only)
int count_only; /* used 'n' flag for ":s" */
int
do_sub_msg (
int count_only /* used 'n' flag for ":s" */
)
{
/*
* Only report substitutions when:
@ -4473,8 +4427,7 @@ int count_only; /* used 'n' flag for ":s" */
* for each line that has a mark. This is required because after deleting
* lines we do not know where to search for the next match.
*/
void ex_global(eap)
exarg_T *eap;
void ex_global(exarg_T *eap)
{
linenr_T lnum; /* line number according to old situation */
int ndone = 0;
@ -4571,8 +4524,7 @@ exarg_T *eap;
/*
* Execute "cmd" on lines marked with ml_setmarked().
*/
void global_exe(cmd)
char_u *cmd;
void global_exe(char_u *cmd)
{
linenr_T old_lcount; /* b_ml.ml_line_count before the command */
buf_T *old_buf = curbuf; /* remember what buffer we started in */
@ -4626,9 +4578,7 @@ char_u *cmd;
msgmore(curbuf->b_ml.ml_line_count - old_lcount);
}
int read_viminfo_sub_string(virp, force)
vir_T *virp;
int force;
int read_viminfo_sub_string(vir_T *virp, int force)
{
if (force)
vim_free(old_sub);
@ -4637,8 +4587,7 @@ int force;
return viminfo_readline(virp);
}
void write_viminfo_sub_string(fp)
FILE *fp;
void write_viminfo_sub_string(FILE *fp)
{
if (get_viminfo_parameter('/') != 0 && old_sub != NULL) {
fputs(_("\n# Last Substitute String:\n$"), fp);
@ -4647,7 +4596,7 @@ FILE *fp;
}
#if defined(EXITFREE) || defined(PROTO)
void free_old_sub() {
void free_old_sub(void) {
vim_free(old_sub);
}
@ -4657,8 +4606,10 @@ void free_old_sub() {
* Set up for a tagpreview.
* Return TRUE when it was created.
*/
int prepare_tagpreview(undo_sync)
int undo_sync; /* sync undo when leaving the window */
int
prepare_tagpreview (
int undo_sync /* sync undo when leaving the window */
)
{
win_T *wp;
@ -4696,8 +4647,7 @@ int undo_sync; /* sync undo when leaving the window */
/*
* ":help": open a read-only window on a help file
*/
void ex_help(eap)
exarg_T *eap;
void ex_help(exarg_T *eap)
{
char_u *arg;
char_u *tag;
@ -4870,8 +4820,7 @@ erret:
* Changes the "@" to NUL if found, and returns a pointer to "xx".
* Returns NULL if not found.
*/
char_u * check_help_lang(arg)
char_u *arg;
char_u *check_help_lang(char_u *arg)
{
int len = (int)STRLEN(arg);
@ -4894,10 +4843,12 @@ char_u *arg;
* Assumption is made that the matched_string passed has already been found to
* match some string for which help is requested. webb.
*/
int help_heuristic(matched_string, offset, wrong_case)
char_u *matched_string;
int offset; /* offset for match */
int wrong_case; /* no matching case */
int
help_heuristic (
char_u *matched_string,
int offset, /* offset for match */
int wrong_case /* no matching case */
)
{
int num_letters;
char_u *p;
@ -4934,9 +4885,7 @@ int wrong_case; /* no matching case */
* Compare functions for qsort() below, that checks the help heuristics number
* that has been put after the tagname by find_tags().
*/
static int help_compare(s1, s2)
const void *s1;
const void *s2;
static int help_compare(const void *s1, const void *s2)
{
char *p1;
char *p2;
@ -4952,11 +4901,7 @@ const void *s2;
* The matches will be sorted with a "best" match algorithm.
* When "keep_lang" is TRUE try keeping the language of the current buffer.
*/
int find_help_tags(arg, num_matches, matches, keep_lang)
char_u *arg;
int *num_matches;
char_u ***matches;
int keep_lang;
int find_help_tags(char_u *arg, int *num_matches, char_u ***matches, int keep_lang)
{
char_u *s, *d;
int i;
@ -5135,7 +5080,7 @@ int keep_lang;
* After reading a help file: May cleanup a help buffer when syntax
* highlighting is not used.
*/
void fix_help_buffer() {
void fix_help_buffer(void) {
linenr_T lnum;
char_u *line;
int in_example = FALSE;
@ -5331,8 +5276,7 @@ void fix_help_buffer() {
/*
* ":exusage"
*/
void ex_exusage(eap)
exarg_T *eap UNUSED;
void ex_exusage(exarg_T *eap)
{
do_cmdline_cmd((char_u *)"help ex-cmd-index");
}
@ -5340,8 +5284,7 @@ exarg_T *eap UNUSED;
/*
* ":viusage"
*/
void ex_viusage(eap)
exarg_T *eap UNUSED;
void ex_viusage(exarg_T *eap)
{
do_cmdline_cmd((char_u *)"help normal-index");
}
@ -5352,8 +5295,7 @@ static void helptags_one __ARGS((char_u *dir, char_u *ext, char_u *lang,
/*
* ":helptags"
*/
void ex_helptags(eap)
exarg_T *eap;
void ex_helptags(exarg_T *eap)
{
garray_T ga;
int i, j;
@ -5454,11 +5396,13 @@ exarg_T *eap;
vim_free(dirname);
}
static void helptags_one(dir, ext, tagfname, add_help_tags)
char_u *dir; /* doc directory */
char_u *ext; /* suffix, ".txt", ".itx", ".frx", etc. */
char_u *tagfname; /* "tags" for English, "tags-fr" for French. */
int add_help_tags; /* add "help-tags" tag */
static void
helptags_one (
char_u *dir, /* doc directory */
char_u *ext, /* suffix, ".txt", ".itx", ".frx", etc. */
char_u *tagfname, /* "tags" for English, "tags-fr" for French. */
int add_help_tags /* add "help-tags" tag */
)
{
FILE *fd_tags;
FILE *fd;

View File

@ -64,8 +64,7 @@ static int debug_greedy = FALSE; /* batch mode debugging: don't save
* do_debug(): Debug mode.
* Repeatedly get Ex commands, until told to continue normal execution.
*/
void do_debug(cmd)
char_u *cmd;
void do_debug(char_u *cmd)
{
int save_msg_scroll = msg_scroll;
int save_State = State;
@ -247,8 +246,7 @@ char_u *cmd;
/*
* ":debug".
*/
void ex_debug(eap)
exarg_T *eap;
void ex_debug(exarg_T *eap)
{
int debug_break_level_save = debug_break_level;
@ -277,8 +275,7 @@ static char_u *debug_skipped_name;
* decide to execute something themselves.
* Called from do_one_cmd() before executing a command.
*/
void dbg_check_breakpoint(eap)
exarg_T *eap;
void dbg_check_breakpoint(exarg_T *eap)
{
char_u *p;
@ -317,8 +314,7 @@ exarg_T *eap;
* Go to debug mode if skipped by dbg_check_breakpoint() because eap->skip was
* set. Return TRUE when the debug mode is entered this time.
*/
int dbg_check_skipped(eap)
exarg_T *eap;
int dbg_check_skipped(exarg_T *eap)
{
int prev_got_int;
@ -374,9 +370,11 @@ static linenr_T debuggy_find __ARGS((int file,char_u *fname, linenr_T after,
* is allocated.
* Returns FAIL for failure.
*/
static int dbg_parsearg(arg, gap)
char_u *arg;
garray_T *gap; /* either &dbg_breakp or &prof_ga */
static int
dbg_parsearg (
char_u *arg,
garray_T *gap /* either &dbg_breakp or &prof_ga */
)
{
char_u *p = arg;
char_u *q;
@ -456,8 +454,7 @@ garray_T *gap; /* either &dbg_breakp or &prof_ga */
/*
* ":breakadd".
*/
void ex_breakadd(eap)
exarg_T *eap;
void ex_breakadd(exarg_T *eap)
{
struct debuggy *bp;
char_u *pat;
@ -493,8 +490,7 @@ exarg_T *eap;
/*
* ":debuggreedy".
*/
void ex_debuggreedy(eap)
exarg_T *eap;
void ex_debuggreedy(exarg_T *eap)
{
if (eap->addr_count == 0 || eap->line2 != 0)
debug_greedy = TRUE;
@ -505,8 +501,7 @@ exarg_T *eap;
/*
* ":breakdel" and ":profdel".
*/
void ex_breakdel(eap)
exarg_T *eap;
void ex_breakdel(exarg_T *eap)
{
struct debuggy *bp, *bpi;
int nr;
@ -577,8 +572,7 @@ exarg_T *eap;
/*
* ":breaklist".
*/
void ex_breaklist(eap)
exarg_T *eap UNUSED;
void ex_breaklist(exarg_T *eap)
{
struct debuggy *bp;
int i;
@ -602,10 +596,12 @@ exarg_T *eap UNUSED;
* Find a breakpoint for a function or sourced file.
* Returns line number at which to break; zero when no matching breakpoint.
*/
linenr_T dbg_find_breakpoint(file, fname, after)
int file; /* TRUE for a file, FALSE for a function */
char_u *fname; /* file or function name */
linenr_T after; /* after this line number */
linenr_T
dbg_find_breakpoint (
int file, /* TRUE for a file, FALSE for a function */
char_u *fname, /* file or function name */
linenr_T after /* after this line number */
)
{
return debuggy_find(file, fname, after, &dbg_breakp, NULL);
}
@ -613,10 +609,12 @@ linenr_T after; /* after this line number */
/*
* Return TRUE if profiling is on for a function or sourced file.
*/
int has_profiling(file, fname, fp)
int file; /* TRUE for a file, FALSE for a function */
char_u *fname; /* file or function name */
int *fp; /* return: forceit */
int
has_profiling (
int file, /* TRUE for a file, FALSE for a function */
char_u *fname, /* file or function name */
int *fp /* return: forceit */
)
{
return debuggy_find(file, fname, (linenr_T)0, &prof_ga, fp)
!= (linenr_T)0;
@ -625,12 +623,14 @@ int *fp; /* return: forceit */
/*
* Common code for dbg_find_breakpoint() and has_profiling().
*/
static linenr_T debuggy_find(file, fname, after, gap, fp)
int file; /* TRUE for a file, FALSE for a function */
char_u *fname; /* file or function name */
linenr_T after; /* after this line number */
garray_T *gap; /* either &dbg_breakp or &prof_ga */
int *fp; /* if not NULL: return forceit */
static linenr_T
debuggy_find (
int file, /* TRUE for a file, FALSE for a function */
char_u *fname, /* file or function name */
linenr_T after, /* after this line number */
garray_T *gap, /* either &dbg_breakp or &prof_ga */
int *fp /* if not NULL: return forceit */
)
{
struct debuggy *bp;
int i;
@ -687,9 +687,7 @@ int *fp; /* if not NULL: return forceit */
/*
* Called when a breakpoint was encountered.
*/
void dbg_breakpoint(name, lnum)
char_u *name;
linenr_T lnum;
void dbg_breakpoint(char_u *name, linenr_T lnum)
{
/* We need to check if this line is actually executed in do_one_cmd() */
debug_breakpoint_name = name;
@ -901,8 +899,7 @@ static proftime_T pause_time;
/*
* ":profile cmd args"
*/
void ex_profile(eap)
exarg_T *eap;
void ex_profile(exarg_T *eap)
{
char_u *e;
int len;
@ -960,9 +957,7 @@ static char *pexpand_cmds[] = {
* Function given to ExpandGeneric() to obtain the profile command
* specific expansion.
*/
char_u * get_profile_name(xp, idx)
expand_T *xp UNUSED;
int idx;
char_u *get_profile_name(expand_T *xp, int idx)
{
switch (pexpand_what) {
case PEXP_SUBCMD:
@ -976,9 +971,7 @@ int idx;
/*
* Handle command line completion for :profile command.
*/
void set_context_in_profile_cmd(xp, arg)
expand_T *xp;
char_u *arg;
void set_context_in_profile_cmd(expand_T *xp, char_u *arg)
{
char_u *end_subcmd;
@ -1004,7 +997,7 @@ char_u *arg;
/*
* Dump the profiling info.
*/
void profile_dump() {
void profile_dump(void) {
FILE *fd;
if (profile_fname != NULL) {
@ -1022,8 +1015,7 @@ void profile_dump() {
/*
* Start profiling script "fp".
*/
static void script_do_profile(si)
scriptitem_T *si;
static void script_do_profile(scriptitem_T *si)
{
si->sn_pr_count = 0;
profile_zero(&si->sn_pr_total);
@ -1075,14 +1067,14 @@ static proftime_T inchar_time;
/*
* Called when starting to wait for the user to type a character.
*/
void prof_inchar_enter() {
void prof_inchar_enter(void) {
profile_start(&inchar_time);
}
/*
* Called when finished waiting for the user to type a character.
*/
void prof_inchar_exit() {
void prof_inchar_exit(void) {
profile_end(&inchar_time);
profile_add(&prof_wait_time, &inchar_time);
}
@ -1090,8 +1082,7 @@ void prof_inchar_exit() {
/*
* Dump the profiling results for all scripts in file "fd".
*/
static void script_dump_profile(fd)
FILE *fd;
static void script_dump_profile(FILE *fd)
{
int id;
scriptitem_T *si;
@ -1142,7 +1133,7 @@ FILE *fd;
* Return TRUE when a function defined in the current script should be
* profiled.
*/
int prof_def_func() {
int prof_def_func(void) {
if (current_SID > 0)
return SCRIPT_ITEM(current_SID).sn_pr_force;
return FALSE;
@ -1154,9 +1145,7 @@ int prof_def_func() {
*
* return FAIL for failure, OK otherwise
*/
int autowrite(buf, forceit)
buf_T *buf;
int forceit;
int autowrite(buf_T *buf, int forceit)
{
int r;
@ -1177,7 +1166,7 @@ int forceit;
/*
* flush all buffers, except the ones that are readonly
*/
void autowrite_all() {
void autowrite_all(void) {
buf_T *buf;
if (!(p_aw || p_awa) || !p_write)
@ -1195,9 +1184,7 @@ void autowrite_all() {
* Return TRUE if buffer was changed and cannot be abandoned.
* For flags use the CCGD_ values.
*/
int check_changed(buf, flags)
buf_T *buf;
int flags;
int check_changed(buf_T *buf, int flags)
{
int forceit = (flags & CCGD_FORCEIT);
@ -1239,9 +1226,11 @@ int flags;
* Ask the user what to do when abandoning a changed buffer.
* Must check 'write' option first!
*/
void dialog_changed(buf, checkall)
buf_T *buf;
int checkall; /* may abandon all changed buffers */
void
dialog_changed (
buf_T *buf,
int checkall /* may abandon all changed buffers */
)
{
char_u buff[DIALOG_MSG_SIZE];
int ret;
@ -1300,9 +1289,7 @@ int checkall; /* may abandon all changed buffers */
* Return TRUE if the buffer "buf" can be abandoned, either by making it
* hidden, autowriting it or unloading it.
*/
int can_abandon(buf, forceit)
buf_T *buf;
int forceit;
int can_abandon(buf_T *buf, int forceit)
{
return P_HID(buf)
|| !bufIsChanged(buf)
@ -1316,10 +1303,7 @@ static void add_bufnum __ARGS((int *bufnrs, int *bufnump, int nr));
/*
* Add a buffer number to "bufnrs", unless it's already there.
*/
static void add_bufnum(bufnrs, bufnump, nr)
int *bufnrs;
int *bufnump;
int nr;
static void add_bufnum(int *bufnrs, int *bufnump, int nr)
{
int i;
@ -1334,8 +1318,10 @@ int nr;
* Return TRUE if any buffer was changed and cannot be abandoned.
* That changed buffer becomes the current buffer.
*/
int check_changed_any(hidden)
int hidden; /* Only check hidden buffers */
int
check_changed_any (
int hidden /* Only check hidden buffers */
)
{
int ret = FALSE;
buf_T *buf;
@ -1440,7 +1426,7 @@ theend:
* return FAIL if there is no file name, OK if there is one
* give error message for FAIL
*/
int check_fname() {
int check_fname(void) {
if (curbuf->b_ffname == NULL) {
EMSG(_(e_noname));
return FAIL;
@ -1453,9 +1439,7 @@ int check_fname() {
*
* return FAIL for failure, OK otherwise
*/
int buf_write_all(buf, forceit)
buf_T *buf;
int forceit;
int buf_write_all(buf_T *buf, int forceit)
{
int retval;
buf_T *old_curbuf = curbuf;
@ -1488,8 +1472,7 @@ static int alist_add_list __ARGS((int count, char_u **files, int after));
* Changes the argument in-place, puts a NUL after it. Backticks remain.
* Return a pointer to the start of the next argument.
*/
static char_u * do_one_arg(str)
char_u *str;
static char_u *do_one_arg(char_u *str)
{
char_u *p;
int inbacktick;
@ -1520,9 +1503,7 @@ char_u *str;
* Separate the arguments in "str" and return a list of pointers in the
* growarray "gap".
*/
int get_arglist(gap, str)
garray_T *gap;
char_u *str;
int get_arglist(garray_T *gap, char_u *str)
{
ga_init2(gap, (int)sizeof(char_u *), 20);
while (*str != NUL) {
@ -1543,11 +1524,7 @@ char_u *str;
* "fnames[fcountp]". When "wig" is TRUE, removes files matching 'wildignore'.
* Return FAIL or OK.
*/
int get_arglist_exp(str, fcountp, fnamesp, wig)
char_u *str;
int *fcountp;
char_u ***fnamesp;
int wig;
int get_arglist_exp(char_u *str, int *fcountp, char_u ***fnamesp, int wig)
{
garray_T ga;
int i;
@ -1573,10 +1550,12 @@ int wig;
*
* Return FAIL for failure, OK otherwise.
*/
static int do_arglist(str, what, after)
char_u *str;
int what UNUSED;
int after UNUSED; /* 0 means before first one */
static int
do_arglist (
char_u *str,
int what,
int after /* 0 means before first one */
)
{
garray_T new_ga;
int exp_count;
@ -1657,7 +1636,7 @@ int after UNUSED; /* 0 means before first one */
/*
* Check the validity of the arg_idx for each other window.
*/
static void alist_check_arg_idx() {
static void alist_check_arg_idx(void) {
win_T *win;
tabpage_T *tp;
@ -1670,8 +1649,7 @@ static void alist_check_arg_idx() {
* Return TRUE if window "win" is editing the file at the current argument
* index.
*/
static int editing_arg_idx(win)
win_T *win;
static int editing_arg_idx(win_T *win)
{
return !(win->w_arg_idx >= WARGCOUNT(win)
|| (win->w_buffer->b_fnum
@ -1685,8 +1663,7 @@ win_T *win;
/*
* Check if window "win" is editing the w_arg_idx file in its argument list.
*/
void check_arg_idx(win)
win_T *win;
void check_arg_idx(win_T *win)
{
if (WARGCOUNT(win) > 1 && !editing_arg_idx(win)) {
/* We are not editing the current entry in the argument list.
@ -1716,8 +1693,7 @@ win_T *win;
/*
* ":args", ":argslocal" and ":argsglobal".
*/
void ex_args(eap)
exarg_T *eap;
void ex_args(exarg_T *eap)
{
int i;
@ -1773,8 +1749,7 @@ exarg_T *eap;
/*
* ":previous", ":sprevious", ":Next" and ":sNext".
*/
void ex_previous(eap)
exarg_T *eap;
void ex_previous(exarg_T *eap)
{
/* If past the last one already, go to the last one. */
if (curwin->w_arg_idx - (int)eap->line2 >= ARGCOUNT)
@ -1786,8 +1761,7 @@ exarg_T *eap;
/*
* ":rewind", ":first", ":sfirst" and ":srewind".
*/
void ex_rewind(eap)
exarg_T *eap;
void ex_rewind(exarg_T *eap)
{
do_argfile(eap, 0);
}
@ -1795,8 +1769,7 @@ exarg_T *eap;
/*
* ":last" and ":slast".
*/
void ex_last(eap)
exarg_T *eap;
void ex_last(exarg_T *eap)
{
do_argfile(eap, ARGCOUNT - 1);
}
@ -1804,8 +1777,7 @@ exarg_T *eap;
/*
* ":argument" and ":sargument".
*/
void ex_argument(eap)
exarg_T *eap;
void ex_argument(exarg_T *eap)
{
int i;
@ -1819,9 +1791,7 @@ exarg_T *eap;
/*
* Edit file "argn" of the argument lists.
*/
void do_argfile(eap, argn)
exarg_T *eap;
int argn;
void do_argfile(exarg_T *eap, int argn)
{
int other;
char_u *p;
@ -1884,8 +1854,7 @@ int argn;
/*
* ":next", and commands that behave like it.
*/
void ex_next(eap)
exarg_T *eap;
void ex_next(exarg_T *eap)
{
int i;
@ -1911,8 +1880,7 @@ exarg_T *eap;
/*
* ":argedit"
*/
void ex_argedit(eap)
exarg_T *eap;
void ex_argedit(exarg_T *eap)
{
int fnum;
int i;
@ -1946,8 +1914,7 @@ exarg_T *eap;
/*
* ":argadd"
*/
void ex_argadd(eap)
exarg_T *eap;
void ex_argadd(exarg_T *eap)
{
do_arglist(eap->arg, AL_ADD,
eap->addr_count > 0 ? (int)eap->line2 : curwin->w_arg_idx + 1);
@ -1957,8 +1924,7 @@ exarg_T *eap;
/*
* ":argdelete"
*/
void ex_argdelete(eap)
exarg_T *eap;
void ex_argdelete(exarg_T *eap)
{
int i;
int n;
@ -1991,8 +1957,7 @@ exarg_T *eap;
/*
* ":argdo", ":windo", ":bufdo", ":tabdo"
*/
void ex_listdo(eap)
exarg_T *eap;
void ex_listdo(exarg_T *eap)
{
int i;
win_T *wp;
@ -2120,10 +2085,12 @@ exarg_T *eap;
* Files[] itself is not taken over.
* Returns index of first added argument. Returns -1 when failed (out of mem).
*/
static int alist_add_list(count, files, after)
int count;
char_u **files;
int after; /* where to add: 0 = before first one */
static int
alist_add_list (
int count,
char_u **files,
int after /* where to add: 0 = before first one */
)
{
int i;
@ -2154,8 +2121,7 @@ int after; /* where to add: 0 = before first one */
/*
* ":compiler[!] {name}"
*/
void ex_compiler(eap)
exarg_T *eap;
void ex_compiler(exarg_T *eap)
{
char_u *buf;
char_u *old_cur_comp = NULL;
@ -2216,17 +2182,14 @@ exarg_T *eap;
/*
* ":runtime {name}"
*/
void ex_runtime(eap)
exarg_T *eap;
void ex_runtime(exarg_T *eap)
{
source_runtime(eap->arg, eap->forceit);
}
static void source_callback __ARGS((char_u *fname, void *cookie));
static void source_callback(fname, cookie)
char_u *fname;
void *cookie UNUSED;
static void source_callback(char_u *fname, void *cookie)
{
(void)do_source(fname, FALSE, DOSO_NONE);
}
@ -2237,9 +2200,7 @@ void *cookie UNUSED;
* When "all" is TRUE, source all files, otherwise only the first one.
* return FAIL when no file could be sourced, OK otherwise.
*/
int source_runtime(name, all)
char_u *name;
int all;
int source_runtime(char_u *name, int all)
{
return do_in_runtimepath(name, all, source_callback, NULL);
}
@ -2339,8 +2300,7 @@ void *cookie;
/*
* ":options"
*/
void ex_options(eap)
exarg_T *eap UNUSED;
void ex_options(exarg_T *eap)
{
cmd_source((char_u *)SYS_OPTWIN_FILE, NULL);
}
@ -2348,15 +2308,12 @@ exarg_T *eap UNUSED;
/*
* ":source {fname}"
*/
void ex_source(eap)
exarg_T *eap;
void ex_source(exarg_T *eap)
{
cmd_source(eap->arg, eap);
}
static void cmd_source(fname, eap)
char_u *fname;
exarg_T *eap;
static void cmd_source(char_u *fname, exarg_T *eap)
{
if (*fname == NUL)
EMSG(_(e_argreq));
@ -2406,8 +2363,7 @@ struct source_cookie {
/*
* Return the address holding the next breakpoint line for a source cookie.
*/
linenr_T * source_breakpoint(cookie)
void *cookie;
linenr_T *source_breakpoint(void *cookie)
{
return &((struct source_cookie *)cookie)->breakpoint;
}
@ -2415,8 +2371,7 @@ void *cookie;
/*
* Return the address holding the debug tick for a source cookie.
*/
int * source_dbg_tick(cookie)
void *cookie;
int *source_dbg_tick(void *cookie)
{
return &((struct source_cookie *)cookie)->dbg_tick;
}
@ -2424,8 +2379,7 @@ void *cookie;
/*
* Return the nesting level for a source cookie.
*/
int source_level(cookie)
void *cookie;
int source_level(void *cookie)
{
return ((struct source_cookie *)cookie)->level;
}
@ -2440,8 +2394,7 @@ static FILE *fopen_noinh_readbin __ARGS((char *filename));
* Special function to open a file without handle inheritance.
* When possible the handle is closed on exec().
*/
static FILE * fopen_noinh_readbin(filename)
char *filename;
static FILE *fopen_noinh_readbin(char *filename)
{
int fd_tmp = mch_open(filename, O_RDONLY, 0);
@ -2468,10 +2421,12 @@ char *filename;
*
* return FAIL if file could not be opened, OK otherwise
*/
int do_source(fname, check_other, is_vimrc)
char_u *fname;
int check_other; /* check for .vimrc and _vimrc */
int is_vimrc; /* DOSO_ value */
int
do_source (
char_u *fname,
int check_other, /* check for .vimrc and _vimrc */
int is_vimrc /* DOSO_ value */
)
{
struct source_cookie cookie;
char_u *save_sourcing_name;
@ -2773,8 +2728,7 @@ theend:
/*
* ":scriptnames"
*/
void ex_scriptnames(eap)
exarg_T *eap UNUSED;
void ex_scriptnames(exarg_T *eap)
{
int i;
@ -2790,7 +2744,7 @@ exarg_T *eap UNUSED;
/*
* Fix slashes in the list of script names for 'shellslash'.
*/
void scriptnames_slash_adjust() {
void scriptnames_slash_adjust(void) {
int i;
for (i = 1; i <= script_items.ga_len; ++i)
@ -2803,8 +2757,7 @@ void scriptnames_slash_adjust() {
/*
* Get a pointer to a script name. Used for ":verbose set".
*/
char_u * get_scriptname(id)
scid_T id;
char_u *get_scriptname(scid_T id)
{
if (id == SID_MODELINE)
return (char_u *)_("modeline");
@ -2820,7 +2773,7 @@ scid_T id;
}
# if defined(EXITFREE) || defined(PROTO)
void free_scriptnames() {
void free_scriptnames(void) {
int i;
for (i = script_items.ga_len; i > 0; --i)
@ -2840,10 +2793,7 @@ void free_scriptnames() {
* Test with earlier versions, MSL 2.2 is the library supplied with
* Codewarrior Pro 2.
*/
char * fgets_cr(s, n, stream)
char *s;
int n;
FILE *stream;
char *fgets_cr(char *s, int n, FILE *stream)
{
return fgets(s, n, stream);
}
@ -2854,10 +2804,7 @@ FILE *stream;
* For older versions of the Metrowerks library.
* At least CodeWarrior 9 needed this code.
*/
char * fgets_cr(s, n, stream)
char *s;
int n;
FILE *stream;
char *fgets_cr(char *s, int n, FILE *stream)
{
int c = 0;
int char_read = 0;
@ -2893,10 +2840,7 @@ FILE *stream;
* Return a pointer to the line in allocated memory.
* Return NULL for end-of-file or some error.
*/
char_u * getsourceline(c, cookie, indent)
int c UNUSED;
void *cookie;
int indent UNUSED;
char_u *getsourceline(int c, void *cookie, int indent)
{
struct source_cookie *sp = (struct source_cookie *)cookie;
char_u *line;
@ -2987,8 +2931,7 @@ int indent UNUSED;
return line;
}
static char_u * get_one_sourceline(sp)
struct source_cookie *sp;
static char_u *get_one_sourceline(struct source_cookie *sp)
{
garray_T ga;
int len;
@ -3126,7 +3069,7 @@ struct source_cookie *sp;
* When skipping lines it may not actually be executed, but we won't find out
* until later and we need to store the time now.
*/
void script_line_start() {
void script_line_start(void) {
scriptitem_T *si;
sn_prl_T *pp;
@ -3157,7 +3100,7 @@ void script_line_start() {
/*
* Called when actually executing a function line.
*/
void script_line_exec() {
void script_line_exec(void) {
scriptitem_T *si;
if (current_SID <= 0 || current_SID > script_items.ga_len)
@ -3170,7 +3113,7 @@ void script_line_exec() {
/*
* Called when done with a function line.
*/
void script_line_end() {
void script_line_end(void) {
scriptitem_T *si;
sn_prl_T *pp;
@ -3196,8 +3139,7 @@ void script_line_end() {
* ":scriptencoding": Set encoding conversion for a sourced script.
* Without the multi-byte feature it's simply ignored.
*/
void ex_scriptencoding(eap)
exarg_T *eap UNUSED;
void ex_scriptencoding(exarg_T *eap)
{
struct source_cookie *sp;
char_u *name;
@ -3225,8 +3167,7 @@ exarg_T *eap UNUSED;
/*
* ":finish": Mark a sourced file as finished.
*/
void ex_finish(eap)
exarg_T *eap;
void ex_finish(exarg_T *eap)
{
if (getline_equal(eap->getline, eap->cookie, getsourceline))
do_finish(eap, FALSE);
@ -3239,9 +3180,7 @@ exarg_T *eap;
* Also called for a pending finish at the ":endtry" or after returning from
* an extra do_cmdline(). "reanimate" is used in the latter case.
*/
void do_finish(eap, reanimate)
exarg_T *eap;
int reanimate;
void do_finish(exarg_T *eap, int reanimate)
{
int idx;
@ -3282,8 +3221,7 @@ void *cookie;
/*
* ":checktime [buffer]"
*/
void ex_checktime(eap)
exarg_T *eap;
void ex_checktime(exarg_T *eap)
{
buf_T *buf;
int save_no_check_timestamps = no_check_timestamps;
@ -3304,8 +3242,7 @@ exarg_T *eap;
# define HAVE_GET_LOCALE_VAL
static char *get_locale_val __ARGS((int what));
static char * get_locale_val(what)
int what;
static char *get_locale_val(int what)
{
char *loc;
@ -3324,7 +3261,7 @@ int what;
* Obtain the current messages language. Used to set the default for
* 'helplang'. May return NULL or an empty string.
*/
char_u * get_mess_lang() {
char_u *get_mess_lang(void) {
char_u *p;
# ifdef HAVE_GET_LOCALE_VAL
@ -3355,7 +3292,7 @@ static char_u *get_mess_env __ARGS((void));
/*
* Get the language used for messages from the environment.
*/
static char_u * get_mess_env() {
static char_u *get_mess_env(void) {
char_u *p;
p = mch_getenv((char_u *)"LC_ALL");
@ -3381,7 +3318,7 @@ static char_u * get_mess_env() {
* Set the "v:lang" variable according to the current locale setting.
* Also do "v:lc_time"and "v:ctype".
*/
void set_lang_var() {
void set_lang_var(void) {
char_u *loc;
# ifdef HAVE_GET_LOCALE_VAL
@ -3411,8 +3348,7 @@ void set_lang_var() {
/*
* ":language": Set the language (locale).
*/
void ex_language(eap)
exarg_T *eap;
void ex_language(exarg_T *eap)
{
char *loc;
char_u *p;
@ -3519,7 +3455,7 @@ static char_u **find_locales __ARGS((void));
/*
* Lazy initialization of all available locales.
*/
static void init_locales() {
static void init_locales(void) {
if (!did_init_locales) {
did_init_locales = TRUE;
locales = find_locales();
@ -3528,7 +3464,7 @@ static void init_locales() {
/* Return an array of strings for all available locales + NULL for the
* last element. Return NULL in case of error. */
static char_u ** find_locales() {
static char_u **find_locales(void) {
garray_T locales_ga;
char_u *loc;
@ -3564,7 +3500,7 @@ static char_u ** find_locales() {
}
# if defined(EXITFREE) || defined(PROTO)
void free_locales() {
void free_locales(void) {
int i;
if (locales != NULL) {
for (i = 0; locales[i] != NULL; i++)
@ -3580,9 +3516,7 @@ void free_locales() {
* Function given to ExpandGeneric() to obtain the possible arguments of the
* ":language" command.
*/
char_u * get_lang_arg(xp, idx)
expand_T *xp UNUSED;
int idx;
char_u *get_lang_arg(expand_T *xp, int idx)
{
if (idx == 0)
return (char_u *)"messages";
@ -3600,9 +3534,7 @@ int idx;
/*
* Function given to ExpandGeneric() to obtain the available locales.
*/
char_u * get_locales(xp, idx)
expand_T *xp UNUSED;
int idx;
char_u *get_locales(expand_T *xp, int idx)
{
init_locales();
if (locales == NULL)

File diff suppressed because it is too large Load Diff

View File

@ -84,7 +84,7 @@ static int cause_abort = FALSE;
* cancellation of an expression evaluation after an aborting function call or
* due to a parsing error, aborting() always returns the same value.
*/
int aborting() {
int aborting(void) {
return (did_emsg && force_abort) || got_int || did_throw;
}
@ -94,7 +94,7 @@ int aborting() {
* be necessary to restore "force_abort" even before the throw point for the
* error message has been reached. update_force_abort() should be called then.
*/
void update_force_abort() {
void update_force_abort(void) {
if (cause_abort)
force_abort = TRUE;
}
@ -105,8 +105,7 @@ void update_force_abort() {
* execution of a failing subcommand as long as the error message has not been
* displayed and actually caused the abortion.
*/
int should_abort(retcode)
int retcode;
int should_abort(int retcode)
{
return (retcode == FAIL && trylevel != 0 && !emsg_silent) || aborting();
}
@ -117,7 +116,7 @@ int retcode;
* to find finally clauses to be executed, and that some errors in skipped
* commands are still reported.
*/
int aborted_in_try() {
int aborted_in_try(void) {
/* This function is only called after an error. In this case, "force_abort"
* determines whether searching for finally clauses is necessary. */
return force_abort;
@ -132,10 +131,7 @@ int aborted_in_try() {
* most specific one and used as the exception value. The "severe" flag can be
* set to TRUE, if a later but severer message should be used instead.
*/
int cause_errthrow(mesg, severe, ignore)
char_u *mesg;
int severe;
int *ignore;
int cause_errthrow(char_u *mesg, int severe, int *ignore)
{
struct msglist *elem;
struct msglist **plist;
@ -275,8 +271,7 @@ int *ignore;
/*
* Free a "msg_list" and the messages it contains.
*/
static void free_msglist(l)
struct msglist *l;
static void free_msglist(struct msglist *l)
{
struct msglist *messages, *next;
@ -293,7 +288,7 @@ struct msglist *l;
* Free global "*msg_list" and the messages it contains, then set "*msg_list"
* to NULL.
*/
void free_global_msglist() {
void free_global_msglist(void) {
free_msglist(*msg_list);
*msg_list = NULL;
}
@ -303,9 +298,7 @@ void free_global_msglist() {
* error exception. If cstack is NULL, postpone the throw until do_cmdline()
* has returned (see do_one_cmd()).
*/
void do_errthrow(cstack, cmdname)
struct condstack *cstack;
char_u *cmdname;
void do_errthrow(struct condstack *cstack, char_u *cmdname)
{
/*
* Ensure that all commands in nested function calls and sourced files
@ -337,8 +330,7 @@ char_u *cmdname;
* exception if appropriate. Return TRUE if the current exception is discarded,
* FALSE otherwise.
*/
int do_intthrow(cstack)
struct condstack *cstack;
int do_intthrow(struct condstack *cstack)
{
/*
* If no interrupt occurred or no try conditional is active and no exception
@ -384,11 +376,7 @@ struct condstack *cstack;
/*
* Get an exception message that is to be stored in current_exception->value.
*/
char_u * get_exception_string(value, type, cmdname, should_free)
void *value;
int type;
char_u *cmdname;
int *should_free;
char_u *get_exception_string(void *value, int type, char_u *cmdname, int *should_free)
{
char_u *ret, *mesg;
int cmdlen;
@ -457,10 +445,7 @@ int *should_free;
* user or interrupt exception, or points to a message list in case of an
* error exception.
*/
static int throw_exception(value, type, cmdname)
void *value;
int type;
char_u *cmdname;
static int throw_exception(void *value, int type, char_u *cmdname)
{
except_T *excp;
int should_free;
@ -541,9 +526,7 @@ fail:
* Discard an exception. "was_finished" is set when the exception has been
* caught and the catch clause has been ended normally.
*/
static void discard_exception(excp, was_finished)
except_T *excp;
int was_finished;
static void discard_exception(except_T *excp, int was_finished)
{
char_u *saved_IObuff;
@ -589,7 +572,7 @@ int was_finished;
/*
* Discard the exception currently being thrown.
*/
void discard_current_exception() {
void discard_current_exception(void) {
discard_exception(current_exception, FALSE);
current_exception = NULL;
did_throw = FALSE;
@ -599,8 +582,7 @@ void discard_current_exception() {
/*
* Put an exception on the caught stack.
*/
static void catch_exception(excp)
except_T *excp;
static void catch_exception(except_T *excp)
{
excp->caught = caught_stack;
caught_stack = excp;
@ -643,8 +625,7 @@ except_T *excp;
/*
* Remove an exception from the caught stack.
*/
static void finish_exception(excp)
except_T *excp;
static void finish_exception(except_T *excp)
{
if (excp != caught_stack)
EMSG(_(e_internal));
@ -687,10 +668,7 @@ except_T *excp;
* what is pending. "value" specifies the return value for a pending ":return"
* or the exception value for a pending exception.
*/
static void report_pending(action, pending, value)
int action;
int pending;
void *value;
static void report_pending(int action, int pending, void *value)
{
char_u *mesg;
char *s;
@ -765,9 +743,7 @@ void *value;
* If something is made pending in a finally clause, report it if required by
* the 'verbose' option or when debugging.
*/
void report_make_pending(pending, value)
int pending;
void *value;
void report_make_pending(int pending, void *value)
{
if (p_verbose >= 14 || debug_break_level > 0) {
if (debug_break_level <= 0)
@ -782,9 +758,7 @@ void *value;
* If something pending in a finally clause is resumed at the ":endtry", report
* it if required by the 'verbose' option or when debugging.
*/
void report_resume_pending(pending, value)
int pending;
void *value;
void report_resume_pending(int pending, void *value)
{
if (p_verbose >= 14 || debug_break_level > 0) {
if (debug_break_level <= 0)
@ -799,9 +773,7 @@ void *value;
* If something pending in a finally clause is discarded, report it if required
* by the 'verbose' option or when debugging.
*/
void report_discard_pending(pending, value)
int pending;
void *value;
void report_discard_pending(int pending, void *value)
{
if (p_verbose >= 14 || debug_break_level > 0) {
if (debug_break_level <= 0)
@ -816,8 +788,7 @@ void *value;
/*
* ":if".
*/
void ex_if(eap)
exarg_T *eap;
void ex_if(exarg_T *eap)
{
int error;
int skip;
@ -854,8 +825,7 @@ exarg_T *eap;
/*
* ":endif".
*/
void ex_endif(eap)
exarg_T *eap;
void ex_endif(exarg_T *eap)
{
did_endif = TRUE;
if (eap->cstack->cs_idx < 0
@ -883,8 +853,7 @@ exarg_T *eap;
/*
* ":else" and ":elseif".
*/
void ex_else(eap)
exarg_T *eap;
void ex_else(exarg_T *eap)
{
int error;
int skip;
@ -965,8 +934,7 @@ exarg_T *eap;
/*
* Handle ":while" and ":for".
*/
void ex_while(eap)
exarg_T *eap;
void ex_while(exarg_T *eap)
{
int error;
int skip;
@ -1055,8 +1023,7 @@ exarg_T *eap;
/*
* ":continue"
*/
void ex_continue(eap)
exarg_T *eap;
void ex_continue(exarg_T *eap)
{
int idx;
struct condstack *cstack = eap->cstack;
@ -1089,8 +1056,7 @@ exarg_T *eap;
/*
* ":break"
*/
void ex_break(eap)
exarg_T *eap;
void ex_break(exarg_T *eap)
{
int idx;
struct condstack *cstack = eap->cstack;
@ -1113,8 +1079,7 @@ exarg_T *eap;
/*
* ":endwhile" and ":endfor"
*/
void ex_endwhile(eap)
exarg_T *eap;
void ex_endwhile(exarg_T *eap)
{
struct condstack *cstack = eap->cstack;
int idx;
@ -1190,8 +1155,7 @@ exarg_T *eap;
/*
* ":throw expr"
*/
void ex_throw(eap)
exarg_T *eap;
void ex_throw(exarg_T *eap)
{
char_u *arg = eap->arg;
char_u *value;
@ -1218,8 +1182,7 @@ exarg_T *eap;
* for ":throw" (user exception) and error and interrupt exceptions. Also
* used for rethrowing an uncaught exception.
*/
void do_throw(cstack)
struct condstack *cstack;
void do_throw(struct condstack *cstack)
{
int idx;
int inactivate_try = FALSE;
@ -1279,8 +1242,7 @@ struct condstack *cstack;
/*
* ":try"
*/
void ex_try(eap)
exarg_T *eap;
void ex_try(exarg_T *eap)
{
int skip;
struct condstack *cstack = eap->cstack;
@ -1347,8 +1309,7 @@ exarg_T *eap;
/*
* ":catch /{pattern}/" and ":catch"
*/
void ex_catch(eap)
exarg_T *eap;
void ex_catch(exarg_T *eap)
{
int idx = 0;
int give_up = FALSE;
@ -1489,8 +1450,7 @@ exarg_T *eap;
/*
* ":finally"
*/
void ex_finally(eap)
exarg_T *eap;
void ex_finally(exarg_T *eap)
{
int idx;
int skip = FALSE;
@ -1608,8 +1568,7 @@ exarg_T *eap;
/*
* ":endtry"
*/
void ex_endtry(eap)
exarg_T *eap;
void ex_endtry(exarg_T *eap)
{
int idx;
int skip;
@ -1797,8 +1756,7 @@ exarg_T *eap;
* do_cmdline() that is going to be made for the cleanup autocommand
* execution.
*/
void enter_cleanup(csp)
cleanup_T *csp;
void enter_cleanup(cleanup_T *csp)
{
int pending = CSTP_NONE;
@ -1854,8 +1812,7 @@ cleanup_T *csp;
* cleanup autocommands. In the latter case, the saved error/interrupt/
* exception state is discarded.
*/
void leave_cleanup(csp)
cleanup_T *csp;
void leave_cleanup(cleanup_T *csp)
{
int pending = csp->pending;
@ -1935,10 +1892,7 @@ cleanup_T *csp;
* entered, is restored (used by ex_endtry()). This is normally done only
* when such a try conditional is left.
*/
int cleanup_conditionals(cstack, searched_cond, inclusive)
struct condstack *cstack;
int searched_cond;
int inclusive;
int cleanup_conditionals(struct condstack *cstack, int searched_cond, int inclusive)
{
int idx;
int stop = FALSE;
@ -2046,8 +2000,7 @@ int inclusive;
/*
* Return an appropriate error message for a missing endwhile/endfor/endif.
*/
static char_u * get_end_emsg(cstack)
struct condstack *cstack;
static char_u *get_end_emsg(struct condstack *cstack)
{
if (cstack->cs_flags[cstack->cs_idx] & CSF_WHILE)
return e_endwhile;
@ -2064,11 +2017,7 @@ struct condstack *cstack;
* type.
* Also free "for info" structures where needed.
*/
void rewind_conditionals(cstack, idx, cond_type, cond_level)
struct condstack *cstack;
int idx;
int cond_type;
int *cond_level;
void rewind_conditionals(struct condstack *cstack, int idx, int cond_type, int *cond_level)
{
while (cstack->cs_idx > idx) {
if (cstack->cs_flags[cstack->cs_idx] & cond_type)
@ -2082,8 +2031,7 @@ int *cond_level;
/*
* ":endfunction" when not after a ":function"
*/
void ex_endfunction(eap)
exarg_T *eap UNUSED;
void ex_endfunction(exarg_T *eap)
{
EMSG(_("E193: :endfunction not inside a function"));
}
@ -2091,8 +2039,7 @@ exarg_T *eap UNUSED;
/*
* Return TRUE if the string "p" looks like a ":while" or ":for" command.
*/
int has_loop_cmd(p)
char_u *p;
int has_loop_cmd(char_u *p)
{
int len;

View File

@ -125,10 +125,12 @@ sort_func_compare __ARGS((const void *s1, const void *s2));
* Return pointer to allocated string if there is a commandline, NULL
* otherwise.
*/
char_u * getcmdline(firstc, count, indent)
int firstc;
long count UNUSED; /* only used for incremental search */
int indent; /* indent for inside conditionals */
char_u *
getcmdline (
int firstc,
long count, /* only used for incremental search */
int indent /* indent for inside conditionals */
)
{
int c;
int i;
@ -1545,12 +1547,14 @@ returncmd:
* f_input() when evaluating an expression from CTRL-R =).
* Returns the command line in allocated memory, or NULL.
*/
char_u * getcmdline_prompt(firstc, prompt, attr, xp_context, xp_arg)
int firstc;
char_u *prompt; /* command line prompt */
int attr; /* attributes for prompt */
int xp_context; /* type of expansion */
char_u *xp_arg; /* user-defined expansion argument */
char_u *
getcmdline_prompt (
int firstc,
char_u *prompt, /* command line prompt */
int attr, /* attributes for prompt */
int xp_context, /* type of expansion */
char_u *xp_arg /* user-defined expansion argument */
)
{
char_u *s;
struct cmdline_info save_ccline;
@ -1579,7 +1583,7 @@ char_u *xp_arg; /* user-defined expansion argument */
* another window or buffer. Used when editing the command line, evaluating
* 'balloonexpr', etc.
*/
int text_locked() {
int text_locked(void) {
if (cmdwin_type != 0)
return TRUE;
return textlock != 0;
@ -1589,7 +1593,7 @@ int text_locked() {
* Give an error message for a command that isn't allowed while the cmdline
* window is open or editing the cmdline in another way.
*/
void text_locked_msg() {
void text_locked_msg(void) {
if (cmdwin_type != 0)
EMSG(_(e_cmdwin));
else
@ -1600,7 +1604,7 @@ void text_locked_msg() {
* Check if "curbuf_lock" or "allbuf_lock" is set and return TRUE when it is
* and give an error message.
*/
int curbuf_locked() {
int curbuf_locked(void) {
if (curbuf_lock > 0) {
EMSG(_("E788: Not allowed to edit another buffer now"));
return TRUE;
@ -1612,7 +1616,7 @@ int curbuf_locked() {
* Check if "allbuf_lock" is set and return TRUE when it is and give an error
* message.
*/
int allbuf_locked() {
int allbuf_locked(void) {
if (allbuf_lock > 0) {
EMSG(_("E811: Not allowed to change buffer information now"));
return TRUE;
@ -1620,8 +1624,7 @@ int allbuf_locked() {
return FALSE;
}
static int cmdline_charsize(idx)
int idx;
static int cmdline_charsize(int idx)
{
if (cmdline_star > 0) /* showing '*', always 1 position */
return 1;
@ -1632,7 +1635,7 @@ int idx;
* Compute the offset of the cursor on the command line for the prompt and
* indent.
*/
static void set_cmdspos() {
static void set_cmdspos(void) {
if (ccline.cmdfirstc != NUL)
ccline.cmdspos = 1 + ccline.cmdindent;
else
@ -1642,7 +1645,7 @@ static void set_cmdspos() {
/*
* Compute the screen position for the cursor on the command line.
*/
static void set_cmdspos_cursor() {
static void set_cmdspos_cursor(void) {
int i, m, c;
set_cmdspos();
@ -1672,9 +1675,7 @@ static void set_cmdspos_cursor() {
* Check if the character at "idx", which is "cells" wide, is a multi-byte
* character that doesn't fit, so that a ">" must be displayed.
*/
static void correct_cmdspos(idx, cells)
int idx;
int cells;
static void correct_cmdspos(int idx, int cells)
{
if ((*mb_ptr2len)(ccline.cmdbuff + idx) > 1
&& (*mb_ptr2cells)(ccline.cmdbuff + idx) > 1
@ -1685,10 +1686,12 @@ int cells;
/*
* Get an Ex command line for the ":" command.
*/
char_u * getexline(c, cookie, indent)
int c; /* normally ':', NUL for ":append" */
void *cookie UNUSED;
int indent; /* indent for inside conditionals */
char_u *
getexline (
int c, /* normally ':', NUL for ":append" */
void *cookie,
int indent /* indent for inside conditionals */
)
{
/* When executing a register, remove ':' that's in front of each line. */
if (exec_from_reg && vpeekc() == ':')
@ -1702,11 +1705,13 @@ int indent; /* indent for inside conditionals */
* mappings or abbreviations.
* Returns a string in allocated memory or NULL.
*/
char_u * getexmodeline(promptc, cookie, indent)
int promptc; /* normally ':', NUL for ":append" and '?' for
char_u *
getexmodeline (
int promptc, /* normally ':', NUL for ":append" and '?' for
:s prompt */
void *cookie UNUSED;
int indent; /* indent for inside conditionals */
void *cookie,
int indent /* indent for inside conditionals */
)
{
garray_T line_ga;
char_u *pend;
@ -1932,14 +1937,14 @@ redraw:
/*
* Return TRUE if ccline.overstrike is on.
*/
int cmdline_overstrike() {
int cmdline_overstrike(void) {
return ccline.overstrike;
}
/*
* Return TRUE if the cursor is at the end of the cmdline.
*/
int cmdline_at_end() {
int cmdline_at_end(void) {
return ccline.cmdpos >= ccline.cmdlen;
}
@ -1952,8 +1957,7 @@ int cmdline_at_end() {
* Assigns the new buffer to ccline.cmdbuff and ccline.cmdbufflen.
* Returns the new value of ccline.cmdbuff and ccline.cmdbufflen.
*/
static void alloc_cmdbuff(len)
int len;
static void alloc_cmdbuff(int len)
{
/*
* give some extra space to avoid having to allocate all the time
@ -1971,8 +1975,7 @@ int len;
* Re-allocate the command line to length len + something extra.
* return FAIL for failure, OK otherwise
*/
static int realloc_cmdbuff(len)
int len;
static int realloc_cmdbuff(int len)
{
char_u *p;
@ -2009,7 +2012,7 @@ int len;
static char_u *arshape_buf = NULL;
# if defined(EXITFREE) || defined(PROTO)
void free_cmdline_buf() {
void free_cmdline_buf(void) {
vim_free(arshape_buf);
}
@ -2019,9 +2022,7 @@ void free_cmdline_buf() {
* Draw part of the cmdline at the current cursor position. But draw stars
* when cmdline_star is TRUE.
*/
static void draw_cmdline(start, len)
int start;
int len;
static void draw_cmdline(int start, int len)
{
int i;
@ -2120,9 +2121,7 @@ int len;
* right when "shift" is TRUE. Used for CTRL-V, CTRL-K, etc.
* "c" must be printable (fit in one display cell)!
*/
void putcmdline(c, shift)
int c;
int shift;
void putcmdline(int c, int shift)
{
if (cmd_silent)
return;
@ -2137,7 +2136,7 @@ int shift;
/*
* Undo a putcmdline(c, FALSE).
*/
void unputcmdline() {
void unputcmdline(void) {
if (cmd_silent)
return;
msg_no_more = TRUE;
@ -2160,10 +2159,7 @@ void unputcmdline() {
* twice in a row, then 'redraw' should be FALSE and redrawcmd() should be
* called afterwards.
*/
int put_on_cmdline(str, len, redraw)
char_u *str;
int len;
int redraw;
int put_on_cmdline(char_u *str, int len, int redraw)
{
int retval;
int i;
@ -2298,8 +2294,7 @@ static int prev_ccline_used = FALSE;
* and overwrite it. But get_cmdline_str() may need it, thus make it
* available globally in prev_ccline.
*/
static void save_cmdline(ccp)
struct cmdline_info *ccp;
static void save_cmdline(struct cmdline_info *ccp)
{
if (!prev_ccline_used) {
vim_memset(&prev_ccline, 0, sizeof(struct cmdline_info));
@ -2315,8 +2310,7 @@ struct cmdline_info *ccp;
/*
* Restore ccline after it has been saved with save_cmdline().
*/
static void restore_cmdline(ccp)
struct cmdline_info *ccp;
static void restore_cmdline(struct cmdline_info *ccp)
{
ccline = prev_ccline;
prev_ccline = *ccp;
@ -2327,7 +2321,7 @@ struct cmdline_info *ccp;
* passed to restore_cmdline_alloc() later.
* Returns NULL when failed.
*/
char_u * save_cmdline_alloc() {
char_u *save_cmdline_alloc(void) {
struct cmdline_info *p;
p = (struct cmdline_info *)alloc((unsigned)sizeof(struct cmdline_info));
@ -2339,8 +2333,7 @@ char_u * save_cmdline_alloc() {
/*
* Restore the command line from the return value of save_cmdline_alloc().
*/
void restore_cmdline_alloc(p)
char_u *p;
void restore_cmdline_alloc(char_u *p)
{
if (p != NULL) {
restore_cmdline((struct cmdline_info *)p);
@ -2356,10 +2349,12 @@ char_u *p;
*
* return FAIL for failure, OK otherwise
*/
static int cmdline_paste(regname, literally, remcr)
int regname;
int literally; /* Insert text literally instead of "as typed" */
int remcr; /* remove trailing CR */
static int
cmdline_paste (
int regname,
int literally, /* Insert text literally instead of "as typed" */
int remcr /* remove trailing CR */
)
{
long i;
char_u *arg;
@ -2433,9 +2428,7 @@ int remcr; /* remove trailing CR */
* When "literally" is FALSE, insert as typed, but don't leave the command
* line.
*/
void cmdline_paste_str(s, literally)
char_u *s;
int literally;
void cmdline_paste_str(char_u *s, int literally)
{
int c, cv;
@ -2465,8 +2458,7 @@ int literally;
* Delete characters on the command line, from "from" to the current
* position.
*/
static void cmdline_del(from)
int from;
static void cmdline_del(int from)
{
mch_memmove(ccline.cmdbuff + from, ccline.cmdbuff + ccline.cmdpos,
(size_t)(ccline.cmdlen - ccline.cmdpos + 1));
@ -2478,7 +2470,7 @@ int from;
* this function is called when the screen size changes and with incremental
* search
*/
void redrawcmdline() {
void redrawcmdline(void) {
if (cmd_silent)
return;
need_wait_return = FALSE;
@ -2487,7 +2479,7 @@ void redrawcmdline() {
cursorcmd();
}
static void redrawcmdprompt() {
static void redrawcmdprompt(void) {
int i;
if (cmd_silent)
@ -2508,7 +2500,7 @@ static void redrawcmdprompt() {
/*
* Redraw what is currently on the command line.
*/
void redrawcmd() {
void redrawcmd(void) {
if (cmd_silent)
return;
@ -2541,7 +2533,7 @@ void redrawcmd() {
skip_redraw = FALSE;
}
void compute_cmdrow() {
void compute_cmdrow(void) {
if (exmode_active || msg_scrolled != 0)
cmdline_row = Rows - 1;
else
@ -2549,7 +2541,7 @@ void compute_cmdrow() {
+ W_STATUS_HEIGHT(lastwin);
}
static void cursorcmd() {
static void cursorcmd(void) {
if (cmd_silent)
return;
@ -2568,8 +2560,7 @@ static void cursorcmd() {
windgoto(msg_row, msg_col);
}
void gotocmdline(clr)
int clr;
void gotocmdline(int clr)
{
msg_start();
if (cmdmsg_rl)
@ -2587,8 +2578,7 @@ int clr;
* When an abbreviation is recognized it is removed from the text with
* backspaces and the replacement string is inserted, followed by "c".
*/
static int ccheck_abbr(c)
int c;
static int ccheck_abbr(int c)
{
if (p_paste || no_abbr) /* no abbreviations or in paste mode */
return FALSE;
@ -2596,9 +2586,7 @@ int c;
return check_abbr(c, ccline.cmdbuff, ccline.cmdpos, 0);
}
static int sort_func_compare(s1, s2)
const void *s1;
const void *s2;
static int sort_func_compare(const void *s1, const void *s2)
{
char_u *p1 = *(char_u **)s1;
char_u *p2 = *(char_u **)s2;
@ -2614,11 +2602,13 @@ const void *s2;
* For the caller, this means that the character is just passed through like a
* normal character (instead of being expanded). This allows :s/^I^D etc.
*/
static int nextwild(xp, type, options, escape)
expand_T *xp;
int type;
int options; /* extra options for ExpandOne() */
int escape; /* if TRUE, escape the returned matches */
static int
nextwild (
expand_T *xp,
int type,
int options, /* extra options for ExpandOne() */
int escape /* if TRUE, escape the returned matches */
)
{
int i, j;
char_u *p1;
@ -2753,12 +2743,14 @@ int escape; /* if TRUE, escape the returned matches */
*
* The variables xp->xp_context and xp->xp_backslash must have been set!
*/
char_u * ExpandOne(xp, str, orig, options, mode)
expand_T *xp;
char_u *str;
char_u *orig; /* allocated copy of original of expanded string */
int options;
int mode;
char_u *
ExpandOne (
expand_T *xp,
char_u *str,
char_u *orig, /* allocated copy of original of expanded string */
int options,
int mode
)
{
char_u *ss = NULL;
static int findex;
@ -2937,8 +2929,7 @@ int mode;
/*
* Prepare an expand structure for use.
*/
void ExpandInit(xp)
expand_T *xp;
void ExpandInit(expand_T *xp)
{
xp->xp_pattern = NULL;
xp->xp_pattern_len = 0;
@ -2955,8 +2946,7 @@ expand_T *xp;
/*
* Cleanup an expand structure after use.
*/
void ExpandCleanup(xp)
expand_T *xp;
void ExpandCleanup(expand_T *xp)
{
if (xp->xp_numfiles >= 0) {
FreeWild(xp->xp_numfiles, xp->xp_files);
@ -2964,12 +2954,7 @@ expand_T *xp;
}
}
void ExpandEscape(xp, str, numfiles, files, options)
expand_T *xp;
char_u *str;
int numfiles;
char_u **files;
int options;
void ExpandEscape(expand_T *xp, char_u *str, int numfiles, char_u **files, int options)
{
int i;
char_u *p;
@ -3048,9 +3033,7 @@ int options;
* after a Vim command, or, when "shell" is non-zero, a shell command.
* Returns the result in allocated memory.
*/
char_u * vim_strsave_fnameescape(fname, shell)
char_u *fname;
int shell;
char_u *vim_strsave_fnameescape(char_u *fname, int shell)
{
char_u *p;
#ifdef BACKSLASH_IN_FILENAME
@ -3087,8 +3070,7 @@ int shell;
/*
* Put a backslash before the file name in "pp", which is in allocated memory.
*/
static void escape_fname(pp)
char_u **pp;
static void escape_fname(char_u **pp)
{
char_u *p;
@ -3105,10 +3087,7 @@ char_u **pp;
* For each file name in files[num_files]:
* If 'orig_pat' starts with "~/", replace the home directory with "~".
*/
void tilde_replace(orig_pat, num_files, files)
char_u *orig_pat;
int num_files;
char_u **files;
void tilde_replace(char_u *orig_pat, int num_files, char_u **files)
{
int i;
char_u *p;
@ -3129,9 +3108,7 @@ char_u **files;
* Returns EXPAND_NOTHING when the character that triggered expansion should
* be inserted like a normal character.
*/
static int showmatches(xp, wildmenu)
expand_T *xp;
int wildmenu UNUSED;
static int showmatches(expand_T *xp, int wildmenu)
{
#define L_SHOWFILE(m) (showtail ? sm_gettail(files_found[m]) : files_found[m])
int num_files;
@ -3285,8 +3262,7 @@ int wildmenu UNUSED;
* Private gettail for showmatches() (and win_redr_status_matches()):
* Find tail of file name path, but ignore trailing "/".
*/
char_u * sm_gettail(s)
char_u *s;
char_u *sm_gettail(char_u *s)
{
char_u *p;
char_u *t = s;
@ -3313,8 +3289,7 @@ char_u *s;
* When not completing file names or there is a wildcard in the path FALSE is
* returned.
*/
static int expand_showtail(xp)
expand_T *xp;
static int expand_showtail(expand_T *xp)
{
char_u *s;
char_u *end;
@ -3347,10 +3322,12 @@ expand_T *xp;
* When expanding other names: The string will be used with regcomp(). Copy
* the name into allocated memory and prepend "^".
*/
char_u * addstar(fname, len, context)
char_u *fname;
int len;
int context; /* EXPAND_FILES etc. */
char_u *
addstar (
char_u *fname,
int len,
int context /* EXPAND_FILES etc. */
)
{
char_u *retval;
int i, j;
@ -3505,8 +3482,7 @@ int context; /* EXPAND_FILES etc. */
* EXPAND_ENV_VARS Complete environment variable names
* EXPAND_USER Complete user names
*/
static void set_expand_context(xp)
expand_T *xp;
static void set_expand_context(expand_T *xp)
{
/* only expansion for ':', '>' and '=' command-lines */
if (ccline.cmdfirstc != ':'
@ -3519,11 +3495,13 @@ expand_T *xp;
set_cmd_context(xp, ccline.cmdbuff, ccline.cmdlen, ccline.cmdpos);
}
void set_cmd_context(xp, str, len, col)
expand_T *xp;
char_u *str; /* start of command line */
int len; /* length of command line (excl. NUL) */
int col; /* position of cursor */
void
set_cmd_context (
expand_T *xp,
char_u *str, /* start of command line */
int len, /* length of command line (excl. NUL) */
int col /* position of cursor */
)
{
int old_char = NUL;
char_u *nextcomm;
@ -3567,12 +3545,14 @@ int col; /* position of cursor */
* key that triggered expansion literally.
* Returns EXPAND_OK otherwise.
*/
int expand_cmdline(xp, str, col, matchcount, matches)
expand_T *xp;
char_u *str; /* start of command line */
int col; /* position of cursor */
int *matchcount; /* return: nr of matches */
char_u ***matches; /* return: array of pointers to matches */
int
expand_cmdline (
expand_T *xp,
char_u *str, /* start of command line */
int col, /* position of cursor */
int *matchcount, /* return: nr of matches */
char_u ***matches /* return: array of pointers to matches */
)
{
char_u *file_str = NULL;
int options = WILD_ADD_SLASH|WILD_SILENT;
@ -3610,9 +3590,7 @@ char_u ***matches; /* return: array of pointers to matches */
*/
static void cleanup_help_tags __ARGS((int num_file, char_u **file));
static void cleanup_help_tags(num_file, file)
int num_file;
char_u **file;
static void cleanup_help_tags(int num_file, char_u **file)
{
int i, j;
int len;
@ -3636,12 +3614,14 @@ char_u **file;
/*
* Do the expansion based on xp->xp_context and "pat".
*/
static int ExpandFromContext(xp, pat, num_file, file, options)
expand_T *xp;
char_u *pat;
int *num_file;
char_u ***file;
int options; /* EW_ flags */
static int
ExpandFromContext (
expand_T *xp,
char_u *pat,
int *num_file,
char_u ***file,
int options /* EW_ flags */
)
{
regmatch_T regmatch;
int ret;
@ -3900,11 +3880,13 @@ int escaped;
* Complete a shell command.
* Returns FAIL or OK;
*/
static int expand_shellcmd(filepat, num_file, file, flagsarg)
char_u *filepat; /* pattern to match with command names */
int *num_file; /* return: number of matches */
char_u ***file; /* return: array with matches */
int flagsarg; /* EW_ flags */
static int
expand_shellcmd (
char_u *filepat, /* pattern to match with command names */
int *num_file, /* return: number of matches */
char_u ***file, /* return: array with matches */
int flagsarg /* EW_ flags */
)
{
char_u *pat;
int i;
@ -4051,11 +4033,7 @@ char_u ***file;
/*
* Expand names with a function defined by the user.
*/
static int ExpandUserDefined(xp, regmatch, num_file, file)
expand_T *xp;
regmatch_T *regmatch;
int *num_file;
char_u ***file;
static int ExpandUserDefined(expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file)
{
char_u *retstr;
char_u *s;
@ -4101,10 +4079,7 @@ char_u ***file;
/*
* Expand names with a list returned by a function defined by the user.
*/
static int ExpandUserList(xp, num_file, file)
expand_T *xp;
int *num_file;
char_u ***file;
static int ExpandUserList(expand_T *xp, int *num_file, char_u ***file)
{
list_T *retlist;
listitem_T *li;
@ -4139,11 +4114,7 @@ char_u ***file;
* 'runtimepath'/{dirnames}/{pat}.vim
* "dirnames" is an array with one or more directory names.
*/
static int ExpandRTDir(pat, num_file, file, dirnames)
char_u *pat;
int *num_file;
char_u ***file;
char *dirnames[];
static int ExpandRTDir(char_u *pat, int *num_file, char_u ***file, char *dirnames[])
{
char_u *matches;
char_u *s;
@ -4207,10 +4178,7 @@ char *dirnames[];
* Returns an allocated string with all matches concatenated, separated by
* newlines. Returns NULL for an error or no matches.
*/
char_u * globpath(path, file, expand_options)
char_u *path;
char_u *file;
int expand_options;
char_u *globpath(char_u *path, char_u *file, int expand_options)
{
expand_T xpc;
char_u *buf;
@ -4273,8 +4241,7 @@ int expand_options;
/*
* Translate a history character to the associated type number.
*/
static int hist_char2type(c)
int c;
static int hist_char2type(int c)
{
if (c == ':')
return HIST_CMD;
@ -4307,9 +4274,7 @@ static char *(history_names[]) =
* Function given to ExpandGeneric() to obtain the possible first
* arguments of the ":history command.
*/
static char_u * get_history_arg(xp, idx)
expand_T *xp UNUSED;
int idx;
static char_u *get_history_arg(expand_T *xp, int idx)
{
static char_u compl[2] = { NUL, NUL };
char *short_names = ":=@>?/";
@ -4331,7 +4296,7 @@ int idx;
* init_history() - Initialize the command line history.
* Also used to re-allocate the history when the size changes.
*/
void init_history() {
void init_history(void) {
int newlen; /* new length of history table */
histentry_T *temp;
int i;
@ -4394,8 +4359,7 @@ void init_history() {
}
}
static void clear_hist_entry(hisptr)
histentry_T *hisptr;
static void clear_hist_entry(histentry_T *hisptr)
{
hisptr->hisnum = 0;
hisptr->viminfo = FALSE;
@ -4406,12 +4370,14 @@ histentry_T *hisptr;
* Check if command line 'str' is already in history.
* If 'move_to_front' is TRUE, matching entry is moved to end of history.
*/
static int in_history(type, str, move_to_front, sep, writing)
int type;
char_u *str;
int move_to_front; /* Move the entry to the front if it exists */
int sep;
int writing; /* ignore entries read from viminfo */
static int
in_history (
int type,
char_u *str,
int move_to_front, /* Move the entry to the front if it exists */
int sep,
int writing /* ignore entries read from viminfo */
)
{
int i;
int last_i = -1;
@ -4460,8 +4426,7 @@ int writing; /* ignore entries read from viminfo */
* When "name" is empty, return "cmd" history.
* Returns -1 for unknown history name.
*/
int get_histtype(name)
char_u *name;
int get_histtype(char_u *name)
{
int i;
int len = (int)STRLEN(name);
@ -4487,11 +4452,13 @@ static int last_maptick = -1; /* last seen maptick */
* history then it is moved to the front. "histype" may be one of he HIST_
* values.
*/
void add_to_history(histype, new_entry, in_map, sep)
int histype;
char_u *new_entry;
int in_map; /* consider maptick when inside a mapping */
int sep; /* separator character used (search hist) */
void
add_to_history (
int histype,
char_u *new_entry,
int in_map, /* consider maptick when inside a mapping */
int sep /* separator character used (search hist) */
)
{
histentry_T *hisptr;
int len;
@ -4543,8 +4510,7 @@ int sep; /* separator character used (search hist) */
* Get identifier of newest history entry.
* "histype" may be one of the HIST_ values.
*/
int get_history_idx(histype)
int histype;
int get_history_idx(int histype)
{
if (hislen == 0 || histype < 0 || histype >= HIST_COUNT
|| hisidx[histype] < 0)
@ -4559,7 +4525,7 @@ static struct cmdline_info *get_ccline_ptr __ARGS((void));
* Get pointer to the command line info to use. cmdline_paste() may clear
* ccline and put the previous value in prev_ccline.
*/
static struct cmdline_info * get_ccline_ptr()
static struct cmdline_info *get_ccline_ptr(void)
{
if ((State & CMDLINE) == 0)
return NULL;
@ -4575,7 +4541,7 @@ static struct cmdline_info * get_ccline_ptr()
* Only works when the command line is being edited.
* Returns NULL when something is wrong.
*/
char_u * get_cmdline_str() {
char_u *get_cmdline_str(void) {
struct cmdline_info *p = get_ccline_ptr();
if (p == NULL)
@ -4589,7 +4555,7 @@ char_u * get_cmdline_str() {
* Only works when the command line is being edited.
* Returns -1 when something is wrong.
*/
int get_cmdline_pos() {
int get_cmdline_pos(void) {
struct cmdline_info *p = get_ccline_ptr();
if (p == NULL)
@ -4602,8 +4568,7 @@ int get_cmdline_pos() {
* Only works when the command line is being edited.
* Returns 1 when failed, 0 when OK.
*/
int set_cmdline_pos(pos)
int pos;
int set_cmdline_pos(int pos)
{
struct cmdline_info *p = get_ccline_ptr();
@ -4625,7 +4590,7 @@ int pos;
* Only works when the command line is being edited.
* Returns NUL when something is wrong.
*/
int get_cmdline_type() {
int get_cmdline_type(void) {
struct cmdline_info *p = get_ccline_ptr();
if (p == NULL)
@ -4641,9 +4606,7 @@ int get_cmdline_type() {
* num < 0: relative position in history wrt newest entry
* "histype" may be one of the HIST_ values.
*/
static int calc_hist_idx(histype, num)
int histype;
int num;
static int calc_hist_idx(int histype, int num)
{
int i;
histentry_T *hist;
@ -4678,9 +4641,7 @@ int num;
* Get a history entry by its index.
* "histype" may be one of the HIST_ values.
*/
char_u * get_history_entry(histype, idx)
int histype;
int idx;
char_u *get_history_entry(int histype, int idx)
{
idx = calc_hist_idx(histype, idx);
if (idx >= 0)
@ -4693,8 +4654,7 @@ int idx;
* Clear all entries of a history.
* "histype" may be one of the HIST_ values.
*/
int clr_history(histype)
int histype;
int clr_history(int histype)
{
int i;
histentry_T *hisptr;
@ -4716,9 +4676,7 @@ int histype;
* Remove all entries matching {str} from a history.
* "histype" may be one of the HIST_ values.
*/
int del_history_entry(histype, str)
int histype;
char_u *str;
int del_history_entry(int histype, char_u *str)
{
regmatch_T regmatch;
histentry_T *hisptr;
@ -4767,9 +4725,7 @@ char_u *str;
* Remove an indexed entry from a history.
* "histype" may be one of the HIST_ values.
*/
int del_history_idx(histype, idx)
int histype;
int idx;
int del_history_idx(int histype, int idx)
{
int i, j;
@ -4802,7 +4758,7 @@ int idx;
* Very specific function to remove the value in ":set key=val" from the
* history.
*/
void remove_key_from_history() {
void remove_key_from_history(void) {
char_u *p;
int i;
@ -4830,10 +4786,7 @@ void remove_key_from_history() {
* text lines in a buffer!) from a string. Used for ":history" and ":clist".
* Returns OK if parsed successfully, otherwise FAIL.
*/
int get_list_range(str, num1, num2)
char_u **str;
int *num1;
int *num2;
int get_list_range(char_u **str, int *num1, int *num2)
{
int len;
int first = FALSE;
@ -4863,8 +4816,7 @@ int *num2;
/*
* :history command - print a history
*/
void ex_history(eap)
exarg_T *eap;
void ex_history(exarg_T *eap)
{
histentry_T *hist;
int histype1 = HIST_CMD;
@ -4956,9 +4908,11 @@ static int hist_type2char __ARGS((int type, int use_question));
/*
* Translate a history type number to the associated character.
*/
static int hist_type2char(type, use_question)
int type;
int use_question; /* use '?' instead of '/' */
static int
hist_type2char (
int type,
int use_question /* use '?' instead of '/' */
)
{
if (type == HIST_CMD)
return ':';
@ -4977,9 +4931,7 @@ int use_question; /* use '?' instead of '/' */
* Prepare for reading the history from the viminfo file.
* This allocates history arrays to store the read history lines.
*/
void prepare_viminfo_history(asklen, writing)
int asklen;
int writing;
void prepare_viminfo_history(int asklen, int writing)
{
int i;
int num;
@ -5017,9 +4969,7 @@ int writing;
* Accept a line from the viminfo, store it in the history array when it's
* new.
*/
int read_viminfo_history(virp, writing)
vir_T *virp;
int writing;
int read_viminfo_history(vir_T *virp, int writing)
{
int type;
long_u len;
@ -5061,7 +5011,7 @@ int writing;
/*
* Finish reading history lines from viminfo. Not used when writing viminfo.
*/
void finish_viminfo_history() {
void finish_viminfo_history(void) {
int idx;
int i;
int type;
@ -5114,9 +5064,7 @@ void finish_viminfo_history() {
* file, data is in viminfo_history[].
* When "merge" is FALSE just write all history lines. Used for ":wviminfo!".
*/
void write_viminfo_history(fp, merge)
FILE *fp;
int merge;
void write_viminfo_history(FILE *fp, int merge)
{
int i;
int type;
@ -5202,8 +5150,7 @@ int merge;
* Write a character at the current cursor+offset position.
* It is directly written into the command buffer block.
*/
void cmd_pchar(c, offset)
int c, offset;
void cmd_pchar(int c, int offset)
{
if (ccline.cmdpos + offset >= ccline.cmdlen || ccline.cmdpos + offset < 0) {
EMSG(_("E198: cmd_pchar beyond the command length"));
@ -5213,8 +5160,7 @@ int c, offset;
ccline.cmdbuff[ccline.cmdlen] = NUL;
}
int cmd_gchar(offset)
int offset;
int cmd_gchar(int offset)
{
if (ccline.cmdpos + offset >= ccline.cmdlen || ccline.cmdpos + offset < 0) {
/* EMSG(_("cmd_gchar beyond the command length")); */
@ -5231,7 +5177,7 @@ int offset;
* Ctrl_C if it is to be abandoned
* K_IGNORE if editing continues
*/
static int ex_window() {
static int ex_window(void) {
struct cmdline_info save_ccline;
buf_T *old_curbuf = curbuf;
win_T *old_curwin = curwin;
@ -5447,9 +5393,7 @@ static int ex_window() {
* endmarker
* Returns a pointer to allocated memory with {script} or NULL.
*/
char_u * script_get(eap, cmd)
exarg_T *eap;
char_u *cmd;
char_u *script_get(exarg_T *eap, char_u *cmd)
{
char_u *theline;
char *end_pattern = NULL;

View File

@ -37,8 +37,7 @@ static void lrswapbuf __ARGS((char_u *buf, int len));
/*
** Convert the given Farsi character into a _X or _X_ type
*/
static int toF_Xor_X_(c)
int c;
static int toF_Xor_X_(int c)
{
int tempc;
@ -127,8 +126,7 @@ int c;
/*
** Convert the given Farsi character into Farsi capital character .
*/
int toF_TyA(c)
int c;
int toF_TyA(int c)
{
switch (c) {
case ALEF_:
@ -205,8 +203,7 @@ int c;
** That is a character that is combined with the others.
** Note: the offset is used only for command line buffer.
*/
static int F_is_TyB_TyC_TyD(src, offset)
int src, offset;
static int F_is_TyB_TyC_TyD(int src, int offset)
{
int c;
@ -255,8 +252,7 @@ int src, offset;
/*
** Is the Farsi character one of the terminating only type.
*/
static int F_is_TyE(c)
int c;
static int F_is_TyE(int c)
{
switch (c) {
case ALEF_A:
@ -277,8 +273,7 @@ int c;
/*
** Is the Farsi character one of the none leading type.
*/
static int F_is_TyC_TyD(c)
int c;
static int F_is_TyC_TyD(int c)
{
switch (c) {
case ALEF_:
@ -300,8 +295,7 @@ int c;
/*
** Convert a none leading Farsi char into a leading type.
*/
static int toF_TyB(c)
int c;
static int toF_TyB(int c)
{
switch (c) {
case ALEF_: return ALEF;
@ -322,8 +316,7 @@ int c;
/*
** Overwrite the current redo and cursor characters + left adjust
*/
static void put_curr_and_l_to_X(c)
int c;
static void put_curr_and_l_to_X(int c)
{
int tempc;
@ -353,8 +346,7 @@ int c;
put_and_redo(c);
}
static void put_and_redo(c)
int c;
static void put_and_redo(int c)
{
pchar_cursor(c);
AppendCharToRedobuff(K_BS);
@ -364,7 +356,7 @@ int c;
/*
** Change the char. under the cursor to a X_ or X type
*/
static void chg_c_toX_orX() {
static void chg_c_toX_orX(void) {
int tempc, curc;
switch ((curc = gchar_cursor())) {
@ -481,7 +473,7 @@ static void chg_c_toX_orX() {
** Change the char. under the cursor to a _X_ or X_ type
*/
static void chg_c_to_X_orX_() {
static void chg_c_to_X_orX_(void) {
int tempc;
switch (gchar_cursor()) {
@ -529,7 +521,7 @@ static void chg_c_to_X_orX_() {
/*
** Change the char. under the cursor to a _X_ or _X type
*/
static void chg_c_to_X_or_X () {
static void chg_c_to_X_or_X(void) {
int tempc;
tempc = gchar_cursor();
@ -556,7 +548,7 @@ static void chg_c_to_X_or_X () {
/*
** Change the character left to the cursor to a _X_ or X_ type
*/
static void chg_l_to_X_orX_ () {
static void chg_l_to_X_orX_(void) {
int tempc;
if (curwin->w_cursor.col != 0 &&
@ -622,7 +614,7 @@ static void chg_l_to_X_orX_ () {
** Change the character left to the cursor to a X or _X type
*/
static void chg_l_toXor_X () {
static void chg_l_toXor_X(void) {
int tempc;
if (curwin->w_cursor.col != 0 &&
@ -688,7 +680,7 @@ static void chg_l_toXor_X () {
** Change the character right to the cursor to a _X or _X_ type
*/
static void chg_r_to_Xor_X_() {
static void chg_r_to_Xor_X_(void) {
int tempc, c;
if (curwin->w_cursor.col) {
@ -710,8 +702,7 @@ static void chg_r_to_Xor_X_() {
** Map Farsi keyboard when in fkmap mode.
*/
int fkmap(c)
int c;
int fkmap(int c)
{
int tempc;
static int revins;
@ -1387,8 +1378,7 @@ int c;
/*
** Convert a none leading Farsi char into a leading type.
*/
static int toF_leading(c)
int c;
static int toF_leading(int c)
{
switch (c) {
case ALEF_: return ALEF;
@ -1440,8 +1430,7 @@ int c;
/*
** Convert a given Farsi char into right joining type.
*/
static int toF_Rjoin(c)
int c;
static int toF_Rjoin(int c)
{
switch (c) {
case ALEF: return ALEF_;
@ -1495,8 +1484,7 @@ int c;
/*
** Can a given Farsi character join via its left edj.
*/
static int canF_Ljoin(c)
int c;
static int canF_Ljoin(int c)
{
switch (c) {
case _BE:
@ -1568,8 +1556,7 @@ int c;
/*
** Can a given Farsi character join via its right edj.
*/
static int canF_Rjoin(c)
int c;
static int canF_Rjoin(int c)
{
switch (c) {
case ALEF:
@ -1595,8 +1582,7 @@ int c;
/*
** is a given Farsi character a terminating type.
*/
static int F_isterm(c)
int c;
static int F_isterm(int c)
{
switch (c) {
case ALEF:
@ -1621,8 +1607,7 @@ int c;
/*
** Convert the given Farsi character into a ending type .
*/
static int toF_ending(c)
int c;
static int toF_ending(int c)
{
switch (c) {
@ -1697,7 +1682,7 @@ int c;
/*
** Convert the Farsi 3342 standard into Farsi VIM.
*/
void conv_to_pvim() {
void conv_to_pvim(void) {
char_u *ptr;
int lnum, llen, i;
@ -1739,7 +1724,7 @@ void conv_to_pvim() {
/*
* Convert the Farsi VIM into Farsi 3342 standard.
*/
void conv_to_pstd() {
void conv_to_pstd(void) {
char_u *ptr;
int lnum, llen, i;
@ -1768,9 +1753,7 @@ void conv_to_pstd() {
/*
* left-right swap the characters in buf[len].
*/
static void lrswapbuf(buf, len)
char_u *buf;
int len;
static void lrswapbuf(char_u *buf, int len)
{
char_u *s, *e;
int c;
@ -1790,8 +1773,7 @@ int len;
/*
* swap all the characters in reverse direction
*/
char_u * lrswap(ibuf)
char_u *ibuf;
char_u *lrswap(char_u *ibuf)
{
if (ibuf != NULL && *ibuf != NUL)
lrswapbuf(ibuf, (int)STRLEN(ibuf));
@ -1801,9 +1783,7 @@ char_u *ibuf;
/*
* swap all the Farsi characters in reverse direction
*/
char_u * lrFswap(cmdbuf, len)
char_u *cmdbuf;
int len;
char_u *lrFswap(char_u *cmdbuf, int len)
{
int i, cnt;
@ -1831,8 +1811,7 @@ int len;
* accordingly.
* TODO: handle different separator characters. Use skip_regexp().
*/
char_u * lrF_sub(ibuf)
char_u *ibuf;
char_u *lrF_sub(char_u *ibuf)
{
char_u *p, *ep;
int i, cnt;
@ -1870,8 +1849,7 @@ char_u *ibuf;
/*
* Map Farsi keyboard when in cmd_fkmap mode.
*/
int cmdl_fkmap(c)
int c;
int cmdl_fkmap(int c)
{
int tempc;
@ -2124,8 +2102,7 @@ int c;
/*
* F_isalpha returns TRUE if 'c' is a Farsi alphabet
*/
int F_isalpha(c)
int c;
int F_isalpha(int c)
{
return ( c >= TEE_ && c <= _YE)
|| (c >= ALEF_A && c <= YE)
@ -2135,8 +2112,7 @@ int c;
/*
* F_isdigit returns TRUE if 'c' is a Farsi digit
*/
int F_isdigit(c)
int c;
int F_isdigit(int c)
{
return c >= FARSI_0 && c <= FARSI_9;
}
@ -2144,14 +2120,12 @@ int c;
/*
* F_ischar returns TRUE if 'c' is a Farsi character.
*/
int F_ischar(c)
int c;
int F_ischar(int c)
{
return c >= TEE_ && c <= YE_;
}
void farsi_fkey(cap)
cmdarg_T *cap;
void farsi_fkey(cmdarg_T *cap)
{
int c = cap->cmdchar;

File diff suppressed because it is too large Load Diff

View File

@ -104,9 +104,7 @@ static int foldendmarkerlen;
/*
* Copy that folding state from window "wp_from" to window "wp_to".
*/
void copyFoldingState(wp_from, wp_to)
win_T *wp_from;
win_T *wp_to;
void copyFoldingState(win_T *wp_from, win_T *wp_to)
{
wp_to->w_fold_manual = wp_from->w_fold_manual;
wp_to->w_foldinvalid = wp_from->w_foldinvalid;
@ -117,8 +115,7 @@ win_T *wp_to;
/*
* Return TRUE if there may be folded lines in the current window.
*/
int hasAnyFolding(win)
win_T *win;
int hasAnyFolding(win_T *win)
{
/* very simple now, but can become more complex later */
return win->w_p_fen
@ -132,22 +129,21 @@ win_T *win;
* When returning TRUE, *firstp and *lastp are set to the first and last
* lnum of the sequence of folded lines (skipped when NULL).
*/
int hasFolding(lnum, firstp, lastp)
linenr_T lnum;
linenr_T *firstp;
linenr_T *lastp;
int hasFolding(linenr_T lnum, linenr_T *firstp, linenr_T *lastp)
{
return hasFoldingWin(curwin, lnum, firstp, lastp, TRUE, NULL);
}
/* hasFoldingWin() {{{2 */
int hasFoldingWin(win, lnum, firstp, lastp, cache, infop)
win_T *win;
linenr_T lnum;
linenr_T *firstp;
linenr_T *lastp;
int cache; /* when TRUE: use cached values of window */
foldinfo_T *infop; /* where to store fold info */
int
hasFoldingWin (
win_T *win,
linenr_T lnum,
linenr_T *firstp,
linenr_T *lastp,
int cache, /* when TRUE: use cached values of window */
foldinfo_T *infop /* where to store fold info */
)
{
int had_folded = FALSE;
linenr_T first = 0;
@ -242,8 +238,7 @@ foldinfo_T *infop; /* where to store fold info */
/*
* Return fold level at line number "lnum" in the current window.
*/
int foldLevel(lnum)
linenr_T lnum;
int foldLevel(linenr_T lnum)
{
/* While updating the folds lines between invalid_top and invalid_bot have
* an undefined fold level. Otherwise update the folds first. */
@ -268,9 +263,7 @@ linenr_T lnum;
* Return FALSE if line is not folded.
* Return MAYBE if the line is folded when next to a folded line.
*/
int lineFolded(win, lnum)
win_T *win;
linenr_T lnum;
int lineFolded(win_T *win, linenr_T lnum)
{
return foldedCount(win, lnum, NULL) != 0;
}
@ -284,10 +277,7 @@ linenr_T lnum;
* Returns number of folded lines from "lnum", or 0 if line is not folded.
* When "infop" is not NULL, fills *infop with the fold level info.
*/
long foldedCount(win, lnum, infop)
win_T *win;
linenr_T lnum;
foldinfo_T *infop;
long foldedCount(win_T *win, linenr_T lnum, foldinfo_T *infop)
{
linenr_T last;
@ -300,8 +290,7 @@ foldinfo_T *infop;
/*
* Return TRUE if 'foldmethod' is "manual"
*/
int foldmethodIsManual(wp)
win_T *wp;
int foldmethodIsManual(win_T *wp)
{
return wp->w_p_fdm[3] == 'u';
}
@ -310,8 +299,7 @@ win_T *wp;
/*
* Return TRUE if 'foldmethod' is "indent"
*/
int foldmethodIsIndent(wp)
win_T *wp;
int foldmethodIsIndent(win_T *wp)
{
return wp->w_p_fdm[0] == 'i';
}
@ -320,8 +308,7 @@ win_T *wp;
/*
* Return TRUE if 'foldmethod' is "expr"
*/
int foldmethodIsExpr(wp)
win_T *wp;
int foldmethodIsExpr(win_T *wp)
{
return wp->w_p_fdm[1] == 'x';
}
@ -330,8 +317,7 @@ win_T *wp;
/*
* Return TRUE if 'foldmethod' is "marker"
*/
int foldmethodIsMarker(wp)
win_T *wp;
int foldmethodIsMarker(win_T *wp)
{
return wp->w_p_fdm[2] == 'r';
}
@ -340,8 +326,7 @@ win_T *wp;
/*
* Return TRUE if 'foldmethod' is "syntax"
*/
int foldmethodIsSyntax(wp)
win_T *wp;
int foldmethodIsSyntax(win_T *wp)
{
return wp->w_p_fdm[0] == 's';
}
@ -350,8 +335,7 @@ win_T *wp;
/*
* Return TRUE if 'foldmethod' is "diff"
*/
int foldmethodIsDiff(wp)
win_T *wp;
int foldmethodIsDiff(win_T *wp)
{
return wp->w_p_fdm[0] == 'd';
}
@ -361,9 +345,7 @@ win_T *wp;
* Close fold for current window at line "lnum".
* Repeat "count" times.
*/
void closeFold(lnum, count)
linenr_T lnum;
long count;
void closeFold(linenr_T lnum, long count)
{
setFoldRepeat(lnum, count, FALSE);
}
@ -372,8 +354,7 @@ long count;
/*
* Close fold for current window at line "lnum" recursively.
*/
void closeFoldRecurse(lnum)
linenr_T lnum;
void closeFoldRecurse(linenr_T lnum)
{
(void)setManualFold(lnum, FALSE, TRUE, NULL);
}
@ -383,12 +364,14 @@ linenr_T lnum;
* Open or Close folds for current window in lines "first" to "last".
* Used for "zo", "zO", "zc" and "zC" in Visual mode.
*/
void opFoldRange(first, last, opening, recurse, had_visual)
linenr_T first;
linenr_T last;
int opening; /* TRUE to open, FALSE to close */
int recurse; /* TRUE to do it recursively */
int had_visual; /* TRUE when Visual selection used */
void
opFoldRange (
linenr_T first,
linenr_T last,
int opening, /* TRUE to open, FALSE to close */
int recurse, /* TRUE to do it recursively */
int had_visual /* TRUE when Visual selection used */
)
{
int done = DONE_NOTHING; /* avoid error messages */
linenr_T lnum;
@ -418,9 +401,7 @@ int had_visual; /* TRUE when Visual selection used */
* Open fold for current window at line "lnum".
* Repeat "count" times.
*/
void openFold(lnum, count)
linenr_T lnum;
long count;
void openFold(linenr_T lnum, long count)
{
setFoldRepeat(lnum, count, TRUE);
}
@ -429,8 +410,7 @@ long count;
/*
* Open fold for current window at line "lnum" recursively.
*/
void openFoldRecurse(lnum)
linenr_T lnum;
void openFoldRecurse(linenr_T lnum)
{
(void)setManualFold(lnum, TRUE, TRUE, NULL);
}
@ -439,7 +419,7 @@ linenr_T lnum;
/*
* Open folds until the cursor line is not in a closed fold.
*/
void foldOpenCursor() {
void foldOpenCursor(void) {
int done;
checkupdate(curwin);
@ -456,7 +436,7 @@ void foldOpenCursor() {
/*
* Set new foldlevel for current window.
*/
void newFoldLevel() {
void newFoldLevel(void) {
newFoldLevelWin(curwin);
if (foldmethodIsDiff(curwin) && curwin->w_p_scb) {
@ -475,8 +455,7 @@ void newFoldLevel() {
}
}
static void newFoldLevelWin(wp)
win_T *wp;
static void newFoldLevelWin(win_T *wp)
{
fold_T *fp;
int i;
@ -498,7 +477,7 @@ win_T *wp;
/*
* Apply 'foldlevel' to all folds that don't contain the cursor.
*/
void foldCheckClose() {
void foldCheckClose(void) {
if (*p_fcl != NUL) { /* can only be "all" right now */
checkupdate(curwin);
if (checkCloseRec(&curwin->w_folds, curwin->w_cursor.lnum,
@ -508,10 +487,7 @@ void foldCheckClose() {
}
/* checkCloseRec() {{{2 */
static int checkCloseRec(gap, lnum, level)
garray_T *gap;
linenr_T lnum;
int level;
static int checkCloseRec(garray_T *gap, linenr_T lnum, int level)
{
fold_T *fp;
int retval = FALSE;
@ -538,8 +514,7 @@ int level;
* Return TRUE if it's allowed to manually create or delete a fold.
* Give an error message and return FALSE if not.
*/
int foldManualAllowed(create)
int create;
int foldManualAllowed(int create)
{
if (foldmethodIsManual(curwin) || foldmethodIsMarker(curwin))
return TRUE;
@ -555,9 +530,7 @@ int create;
* Create a fold from line "start" to line "end" (inclusive) in the current
* window.
*/
void foldCreate(start, end)
linenr_T start;
linenr_T end;
void foldCreate(linenr_T start, linenr_T end)
{
fold_T *fp;
garray_T *gap;
@ -671,11 +644,13 @@ linenr_T end;
* When "end" is not 0, delete all folds from "start" to "end".
* When "recursive" is TRUE delete recursively.
*/
void deleteFold(start, end, recursive, had_visual)
linenr_T start;
linenr_T end;
int recursive;
int had_visual; /* TRUE when Visual selection used */
void
deleteFold (
linenr_T start,
linenr_T end,
int recursive,
int had_visual /* TRUE when Visual selection used */
)
{
garray_T *gap;
fold_T *fp;
@ -757,8 +732,7 @@ int had_visual; /* TRUE when Visual selection used */
/*
* Remove all folding for window "win".
*/
void clearFolding(win)
win_T *win;
void clearFolding(win_T *win)
{
deleteFoldRecurse(&win->w_folds);
win->w_foldinvalid = FALSE;
@ -771,10 +745,7 @@ win_T *win;
* calling foldMarkAdjust().
* The changes in lines from top to bot (inclusive).
*/
void foldUpdate(wp, top, bot)
win_T *wp;
linenr_T top;
linenr_T bot;
void foldUpdate(win_T *wp, linenr_T top, linenr_T bot)
{
fold_T *fp;
@ -807,8 +778,7 @@ linenr_T bot;
* The actual updating is postponed until fold info is used, to avoid doing
* every time a setting is changed or a syntax item is added.
*/
void foldUpdateAll(win)
win_T *win;
void foldUpdateAll(win_T *win)
{
win->w_foldinvalid = TRUE;
redraw_win_later(win, NOT_VALID);
@ -820,10 +790,12 @@ win_T *win;
* If "updown" is TRUE: move to fold at the same level.
* If not moved return FAIL.
*/
int foldMoveTo(updown, dir, count)
int updown;
int dir; /* FORWARD or BACKWARD */
long count;
int
foldMoveTo (
int updown,
int dir, /* FORWARD or BACKWARD */
long count
)
{
long n;
int retval = FAIL;
@ -936,8 +908,7 @@ long count;
/*
* Init the fold info in a new window.
*/
void foldInitWin(new_win)
win_T *new_win;
void foldInitWin(win_T *new_win)
{
ga_init2(&new_win->w_folds, (int)sizeof(fold_T), 10);
}
@ -949,9 +920,7 @@ win_T *new_win;
* line number can be wrong).
* Returns index of entry or -1 if not found.
*/
int find_wl_entry(win, lnum)
win_T *win;
linenr_T lnum;
int find_wl_entry(win_T *win, linenr_T lnum)
{
int i;
@ -969,7 +938,7 @@ linenr_T lnum;
/*
* Adjust the Visual area to include any fold at the start or end completely.
*/
void foldAdjustVisual() {
void foldAdjustVisual(void) {
pos_T *start, *end;
char_u *ptr;
@ -1000,7 +969,7 @@ void foldAdjustVisual() {
/*
* Move the cursor to the first line of a closed fold.
*/
void foldAdjustCursor() {
void foldAdjustCursor(void) {
(void)hasFolding(curwin->w_cursor.lnum, &curwin->w_cursor.lnum, NULL);
}
@ -1011,9 +980,7 @@ void foldAdjustCursor() {
*
* Return FAIL if the operation cannot be completed, otherwise OK.
*/
void cloneFoldGrowArray(from, to)
garray_T *from;
garray_T *to;
void cloneFoldGrowArray(garray_T *from, garray_T *to)
{
int i;
fold_T *from_p;
@ -1045,10 +1012,7 @@ garray_T *to;
* the first fold below it (careful: it can be beyond the end of the array!).
* Returns FALSE when there is no fold that contains "lnum".
*/
static int foldFind(gap, lnum, fpp)
garray_T *gap;
linenr_T lnum;
fold_T **fpp;
static int foldFind(garray_T *gap, linenr_T lnum, fold_T **fpp)
{
linenr_T low, high;
fold_T *fp;
@ -1084,9 +1048,7 @@ fold_T **fpp;
/*
* Return fold level at line number "lnum" in window "wp".
*/
static int foldLevelWin(wp, lnum)
win_T *wp;
linenr_T lnum;
static int foldLevelWin(win_T *wp, linenr_T lnum)
{
fold_T *fp;
linenr_T lnum_rel = lnum;
@ -1111,8 +1073,7 @@ linenr_T lnum;
/*
* Check if the folds in window "wp" are invalid and update them if needed.
*/
static void checkupdate(wp)
win_T *wp;
static void checkupdate(win_T *wp)
{
if (wp->w_foldinvalid) {
foldUpdate(wp, (linenr_T)1, (linenr_T)MAXLNUM); /* will update all */
@ -1125,10 +1086,7 @@ win_T *wp;
* Open or close fold for current window at line "lnum".
* Repeat "count" times.
*/
static void setFoldRepeat(lnum, count, do_open)
linenr_T lnum;
long count;
int do_open;
static void setFoldRepeat(linenr_T lnum, long count, int do_open)
{
int done;
long n;
@ -1150,11 +1108,13 @@ int do_open;
* Open or close the fold in the current window which contains "lnum".
* Also does this for other windows in diff mode when needed.
*/
static linenr_T setManualFold(lnum, opening, recurse, donep)
linenr_T lnum;
int opening; /* TRUE when opening, FALSE when closing */
int recurse; /* TRUE when closing/opening recursive */
int *donep;
static linenr_T
setManualFold (
linenr_T lnum,
int opening, /* TRUE when opening, FALSE when closing */
int recurse, /* TRUE when closing/opening recursive */
int *donep
)
{
if (foldmethodIsDiff(curwin) && curwin->w_p_scb) {
win_T *wp;
@ -1187,12 +1147,14 @@ int *donep;
* Return the line number of the next line that could be closed.
* It's only valid when "opening" is TRUE!
*/
static linenr_T setManualFoldWin(wp, lnum, opening, recurse, donep)
win_T *wp;
linenr_T lnum;
int opening; /* TRUE when opening, FALSE when closing */
int recurse; /* TRUE when closing/opening recursive */
int *donep;
static linenr_T
setManualFoldWin (
win_T *wp,
linenr_T lnum,
int opening, /* TRUE when opening, FALSE when closing */
int recurse, /* TRUE when closing/opening recursive */
int *donep
)
{
fold_T *fp;
fold_T *fp2;
@ -1286,8 +1248,7 @@ int *donep;
/*
* Open all nested folds in fold "fpr" recursively.
*/
static void foldOpenNested(fpr)
fold_T *fpr;
static void foldOpenNested(fold_T *fpr)
{
int i;
fold_T *fp;
@ -1305,10 +1266,7 @@ fold_T *fpr;
* When "recursive" is TRUE also delete all the folds contained in it.
* When "recursive" is FALSE contained folds are moved one level up.
*/
static void deleteFoldEntry(gap, idx, recursive)
garray_T *gap;
int idx;
int recursive;
static void deleteFoldEntry(garray_T *gap, int idx, int recursive)
{
fold_T *fp;
int i;
@ -1356,8 +1314,7 @@ int recursive;
/*
* Delete nested folds in a fold.
*/
void deleteFoldRecurse(gap)
garray_T *gap;
void deleteFoldRecurse(garray_T *gap)
{
int i;
@ -1370,12 +1327,7 @@ garray_T *gap;
/*
* Update line numbers of folds for inserted/deleted lines.
*/
void foldMarkAdjust(wp, line1, line2, amount, amount_after)
win_T *wp;
linenr_T line1;
linenr_T line2;
long amount;
long amount_after;
void foldMarkAdjust(win_T *wp, linenr_T line1, linenr_T line2, long amount, long amount_after)
{
/* If deleting marks from line1 to line2, but not deleting all those
* lines, set line2 so that only deleted lines have their folds removed. */
@ -1389,12 +1341,7 @@ long amount_after;
}
/* foldMarkAdjustRecurse() {{{2 */
static void foldMarkAdjustRecurse(gap, line1, line2, amount, amount_after)
garray_T *gap;
linenr_T line1;
linenr_T line2;
long amount;
long amount_after;
static void foldMarkAdjustRecurse(garray_T *gap, linenr_T line1, linenr_T line2, long amount, long amount_after)
{
fold_T *fp;
int i;
@ -1487,13 +1434,12 @@ long amount_after;
* Get the lowest 'foldlevel' value that makes the deepest nested fold in the
* current window open.
*/
int getDeepestNesting() {
int getDeepestNesting(void) {
checkupdate(curwin);
return getDeepestNestingRecurse(&curwin->w_folds);
}
static int getDeepestNestingRecurse(gap)
garray_T *gap;
static int getDeepestNestingRecurse(garray_T *gap)
{
int i;
int level;
@ -1514,13 +1460,15 @@ garray_T *gap;
/*
* Check if a fold is closed and update the info needed to check nested folds.
*/
static int check_closed(win, fp, use_levelp, level, maybe_smallp, lnum_off)
win_T *win;
fold_T *fp;
int *use_levelp; /* TRUE: outer fold had FD_LEVEL */
int level; /* folding depth */
int *maybe_smallp; /* TRUE: outer this had fd_small == MAYBE */
linenr_T lnum_off; /* line number offset for fp->fd_top */
static int
check_closed (
win_T *win,
fold_T *fp,
int *use_levelp, /* TRUE: outer fold had FD_LEVEL */
int level, /* folding depth */
int *maybe_smallp, /* TRUE: outer this had fd_small == MAYBE */
linenr_T lnum_off /* line number offset for fp->fd_top */
)
{
int closed = FALSE;
@ -1550,10 +1498,12 @@ linenr_T lnum_off; /* line number offset for fp->fd_top */
/*
* Update fd_small field of fold "fp".
*/
static void checkSmall(wp, fp, lnum_off)
win_T *wp;
fold_T *fp;
linenr_T lnum_off; /* offset for fp->fd_top */
static void
checkSmall (
win_T *wp,
fold_T *fp,
linenr_T lnum_off /* offset for fp->fd_top */
)
{
int count;
int n;
@ -1582,8 +1532,7 @@ linenr_T lnum_off; /* offset for fp->fd_top */
/*
* Set small flags in "gap" to MAYBE.
*/
static void setSmallMaybe(gap)
garray_T *gap;
static void setSmallMaybe(garray_T *gap)
{
int i;
fold_T *fp;
@ -1598,9 +1547,7 @@ garray_T *gap;
* Create a fold from line "start" to line "end" (inclusive) in the current
* window by adding markers.
*/
static void foldCreateMarkers(start, end)
linenr_T start;
linenr_T end;
static void foldCreateMarkers(linenr_T start, linenr_T end)
{
if (!curbuf->b_p_ma) {
EMSG(_(e_modifiable));
@ -1620,10 +1567,7 @@ linenr_T end;
/*
* Add "marker[markerlen]" in 'commentstring' to line "lnum".
*/
static void foldAddMarker(lnum, marker, markerlen)
linenr_T lnum;
char_u *marker;
int markerlen;
static void foldAddMarker(linenr_T lnum, char_u *marker, int markerlen)
{
char_u *cms = curbuf->b_p_cms;
char_u *line;
@ -1656,10 +1600,12 @@ int markerlen;
/*
* Delete the markers for a fold, causing it to be deleted.
*/
static void deleteFoldMarkers(fp, recursive, lnum_off)
fold_T *fp;
int recursive;
linenr_T lnum_off; /* offset for fp->fd_top */
static void
deleteFoldMarkers (
fold_T *fp,
int recursive,
linenr_T lnum_off /* offset for fp->fd_top */
)
{
int i;
@ -1679,10 +1625,7 @@ linenr_T lnum_off; /* offset for fp->fd_top */
* If the marker is not found, there is no error message. Could a missing
* close-marker.
*/
static void foldDelMarker(lnum, marker, markerlen)
linenr_T lnum;
char_u *marker;
int markerlen;
static void foldDelMarker(linenr_T lnum, char_u *marker, int markerlen)
{
char_u *line;
char_u *newline;
@ -1727,11 +1670,7 @@ int markerlen;
* When 'foldtext' isn't set puts the result in "buf[51]". Otherwise the
* result is in allocated memory.
*/
char_u * get_foldtext(wp, lnum, lnume, foldinfo, buf)
win_T *wp;
linenr_T lnum, lnume;
foldinfo_T *foldinfo;
char_u *buf;
char_u *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume, foldinfo_T *foldinfo, char_u *buf)
{
char_u *text = NULL;
/* an error occurred when evaluating 'fdt' setting */
@ -1827,8 +1766,7 @@ char_u *buf;
/*
* Remove 'foldmarker' and 'commentstring' from "str" (in-place).
*/
void foldtext_cleanup(str)
char_u *str;
void foldtext_cleanup(char_u *str)
{
char_u *cms_start; /* first part or the whole comment */
int cms_slen = 0; /* length of cms_start */
@ -1943,10 +1881,7 @@ static void foldlevelSyntax __ARGS((fline_T *flp));
* Update the folding for window "wp", at least from lines "top" to "bot".
* Return TRUE if any folds did change.
*/
static void foldUpdateIEMS(wp, top, bot)
win_T *wp;
linenr_T top;
linenr_T bot;
static void foldUpdateIEMS(win_T *wp, linenr_T top, linenr_T bot)
{
linenr_T start;
linenr_T end;
@ -2550,9 +2485,7 @@ int topflags; /* flags used by containing fold */
* Insert a new fold in "gap" at position "i".
* Returns OK for success, FAIL for failure.
*/
static int foldInsert(gap, i)
garray_T *gap;
int i;
static int foldInsert(garray_T *gap, int i)
{
fold_T *fp;
@ -2574,11 +2507,7 @@ int i;
* The caller must first have taken care of any nested folds from "top" to
* "bot"!
*/
static void foldSplit(gap, i, top, bot)
garray_T *gap;
int i;
linenr_T top;
linenr_T bot;
static void foldSplit(garray_T *gap, int i, linenr_T top, linenr_T bot)
{
fold_T *fp;
fold_T *fp2;
@ -2635,10 +2564,7 @@ linenr_T bot;
* 5: made to start below "bot".
* 6: not changed
*/
static void foldRemove(gap, top, bot)
garray_T *gap;
linenr_T top;
linenr_T bot;
static void foldRemove(garray_T *gap, linenr_T top, linenr_T bot)
{
fold_T *fp = NULL;
@ -2692,10 +2618,7 @@ linenr_T bot;
* The resulting fold is "fp1", nested folds are moved from "fp2" to "fp1".
* Fold entry "fp2" in "gap" is deleted.
*/
static void foldMerge(fp1, gap, fp2)
fold_T *fp1;
garray_T *gap;
fold_T *fp2;
static void foldMerge(fold_T *fp1, garray_T *gap, fold_T *fp2)
{
fold_T *fp3;
fold_T *fp4;
@ -2730,8 +2653,7 @@ fold_T *fp2;
* Doesn't use any caching.
* Returns a level of -1 if the foldlevel depends on surrounding lines.
*/
static void foldlevelIndent(flp)
fline_T *flp;
static void foldlevelIndent(fline_T *flp)
{
char_u *s;
buf_T *buf;
@ -2762,8 +2684,7 @@ fline_T *flp;
* Low level function to get the foldlevel for the "diff" method.
* Doesn't use any caching.
*/
static void foldlevelDiff(flp)
fline_T *flp;
static void foldlevelDiff(fline_T *flp)
{
if (diff_infold(flp->wp, flp->lnum + flp->off))
flp->lvl = 1;
@ -2777,8 +2698,7 @@ fline_T *flp;
* Doesn't use any caching.
* Returns a level of -1 if the foldlevel depends on surrounding lines.
*/
static void foldlevelExpr(flp)
fline_T *flp;
static void foldlevelExpr(fline_T *flp)
{
win_T *win;
int n;
@ -2869,8 +2789,7 @@ fline_T *flp;
* "foldendmarkerlen".
* Relies on the option value to have been checked for correctness already.
*/
static void parseMarker(wp)
win_T *wp;
static void parseMarker(win_T *wp)
{
foldendmarker = vim_strchr(wp->w_p_fmr, ',');
foldstartmarkerlen = (int)(foldendmarker++ - wp->w_p_fmr);
@ -2887,8 +2806,7 @@ win_T *wp;
* Doesn't use any caching.
* Sets flp->start when a start marker was found.
*/
static void foldlevelMarker(flp)
fline_T *flp;
static void foldlevelMarker(fline_T *flp)
{
char_u *startmarker;
int cstart;
@ -2958,8 +2876,7 @@ fline_T *flp;
* Low level function to get the foldlevel for the "syntax" method.
* Doesn't use any caching.
*/
static void foldlevelSyntax(flp)
fline_T *flp;
static void foldlevelSyntax(fline_T *flp)
{
linenr_T lnum = flp->lnum + flp->off;
int n;
@ -2987,9 +2904,7 @@ static int put_fold_open_close __ARGS((FILE *fd, fold_T *fp, linenr_T off));
* Write commands to "fd" to restore the manual folds in window "wp".
* Return FAIL if writing fails.
*/
int put_folds(fd, wp)
FILE *fd;
win_T *wp;
int put_folds(FILE *fd, win_T *wp)
{
if (foldmethodIsManual(wp)) {
if (put_line(fd, "silent! normal! zE") == FAIL
@ -3009,10 +2924,7 @@ win_T *wp;
* Write commands to "fd" to recreate manually created folds.
* Returns FAIL when writing failed.
*/
static int put_folds_recurse(fd, gap, off)
FILE *fd;
garray_T *gap;
linenr_T off;
static int put_folds_recurse(FILE *fd, garray_T *gap, linenr_T off)
{
int i;
fold_T *fp;
@ -3036,11 +2948,7 @@ linenr_T off;
* Write commands to "fd" to open and close manually opened/closed folds.
* Returns FAIL when writing failed.
*/
static int put_foldopen_recurse(fd, wp, gap, off)
FILE *fd;
win_T *wp;
garray_T *gap;
linenr_T off;
static int put_foldopen_recurse(FILE *fd, win_T *wp, garray_T *gap, linenr_T off)
{
int i;
int level;
@ -3086,10 +2994,7 @@ linenr_T off;
* Write the open or close command to "fd".
* Returns FAIL when writing failed.
*/
static int put_fold_open_close(fd, fp, off)
FILE *fd;
fold_T *fp;
linenr_T off;
static int put_fold_open_close(FILE *fd, fold_T *fp, linenr_T off)
{
if (fprintf(fd, "%ld", fp->fd_top + off) < 0
|| put_eol(fd) == FAIL

View File

@ -134,8 +134,7 @@ static char_u *eval_map_expr __ARGS((char_u *str, int c));
/*
* Free and clear a buffer.
*/
void free_buff(buf)
struct buffheader *buf;
void free_buff(struct buffheader *buf)
{
struct buffblock *p, *np;
@ -150,9 +149,11 @@ struct buffheader *buf;
* Return the contents of a buffer as a single string.
* K_SPECIAL and CSI in the returned string are escaped.
*/
static char_u * get_buffcont(buffer, dozero)
struct buffheader *buffer;
int dozero; /* count == zero is not an error */
static char_u *
get_buffcont (
struct buffheader *buffer,
int dozero /* count == zero is not an error */
)
{
long_u count = 0;
char_u *p = NULL;
@ -179,7 +180,7 @@ int dozero; /* count == zero is not an error */
* and clear the record buffer.
* K_SPECIAL and CSI in the returned string are escaped.
*/
char_u * get_recorded() {
char_u *get_recorded(void) {
char_u *p;
size_t len;
@ -210,7 +211,7 @@ char_u * get_recorded() {
* Return the contents of the redo buffer as a single string.
* K_SPECIAL and CSI in the returned string are escaped.
*/
char_u * get_inserted() {
char_u *get_inserted(void) {
return get_buffcont(&redobuff, FALSE);
}
@ -218,10 +219,12 @@ char_u * get_inserted() {
* Add string "s" after the current block of buffer "buf".
* K_SPECIAL and CSI should have been escaped already.
*/
static void add_buff(buf, s, slen)
struct buffheader *buf;
char_u *s;
long slen; /* length of "s" or -1 */
static void
add_buff (
struct buffheader *buf,
char_u *s,
long slen /* length of "s" or -1 */
)
{
struct buffblock *p;
long_u len;
@ -269,9 +272,7 @@ long slen; /* length of "s" or -1 */
/*
* Add number "n" to buffer "buf".
*/
static void add_num_buff(buf, n)
struct buffheader *buf;
long n;
static void add_num_buff(struct buffheader *buf, long n)
{
char_u number[32];
@ -283,9 +284,7 @@ long n;
* Add character 'c' to buffer "buf".
* Translates special keys, NUL, CSI, K_SPECIAL and multibyte characters.
*/
static void add_char_buff(buf, c)
struct buffheader *buf;
int c;
static void add_char_buff(struct buffheader *buf, int c)
{
char_u bytes[MB_MAXBYTES + 1];
int len;
@ -319,8 +318,7 @@ int c;
* If advance == TRUE go to the next char.
* No translation is done K_SPECIAL and CSI are escaped.
*/
static int read_stuff(advance)
int advance;
static int read_stuff(int advance)
{
char_u c;
struct buffblock *curr;
@ -344,7 +342,7 @@ int advance;
/*
* Prepare the stuff buffer for reading (if it contains something).
*/
static void start_stuff() {
static void start_stuff(void) {
if (stuffbuff.bh_first.b_next != NULL) {
stuffbuff.bh_curr = &(stuffbuff.bh_first);
stuffbuff.bh_space = 0;
@ -354,15 +352,14 @@ static void start_stuff() {
/*
* Return TRUE if the stuff buffer is empty.
*/
int stuff_empty() {
int stuff_empty(void) {
return stuffbuff.bh_first.b_next == NULL;
}
/*
* Set a typeahead character that won't be flushed.
*/
void typeahead_noflush(c)
int c;
void typeahead_noflush(int c)
{
typeahead_char = c;
}
@ -372,8 +369,7 @@ int c;
* typeahead buffer (used in case of an error). If "flush_typeahead" is true,
* flush all typeahead characters (used when interrupted by a CTRL-C).
*/
void flush_buffers(flush_typeahead)
int flush_typeahead;
void flush_buffers(int flush_typeahead)
{
init_typebuf();
@ -406,7 +402,7 @@ int flush_typeahead;
* The previous contents of the redo buffer is kept in old_redobuffer.
* This is used for the CTRL-O <.> command in insert mode.
*/
void ResetRedobuff() {
void ResetRedobuff(void) {
if (!block_redo) {
free_buff(&old_redobuff);
old_redobuff = redobuff;
@ -418,7 +414,7 @@ void ResetRedobuff() {
* Discard the contents of the redo buffer and restore the previous redo
* buffer.
*/
void CancelRedo() {
void CancelRedo(void) {
if (!block_redo) {
free_buff(&redobuff);
redobuff = old_redobuff;
@ -435,7 +431,7 @@ void CancelRedo() {
*/
static int save_level = 0;
void saveRedobuff() {
void saveRedobuff(void) {
char_u *s;
if (save_level++ == 0) {
@ -457,7 +453,7 @@ void saveRedobuff() {
* Restore redobuff and old_redobuff from save_redobuff and save_old_redobuff.
* Used after executing autocommands and user functions.
*/
void restoreRedobuff() {
void restoreRedobuff(void) {
if (--save_level == 0) {
free_buff(&redobuff);
redobuff = save_redobuff;
@ -470,8 +466,7 @@ void restoreRedobuff() {
* Append "s" to the redo buffer.
* K_SPECIAL and CSI should already have been escaped.
*/
void AppendToRedobuff(s)
char_u *s;
void AppendToRedobuff(char_u *s)
{
if (!block_redo)
add_buff(&redobuff, s, -1L);
@ -481,9 +476,11 @@ char_u *s;
* Append to Redo buffer literally, escaping special characters with CTRL-V.
* K_SPECIAL and CSI are escaped as well.
*/
void AppendToRedobuffLit(str, len)
char_u *str;
int len; /* length of "str" or -1 for up to the NUL */
void
AppendToRedobuffLit (
char_u *str,
int len /* length of "str" or -1 for up to the NUL */
)
{
char_u *s = str;
int c;
@ -532,8 +529,7 @@ int len; /* length of "str" or -1 for up to the NUL */
* Append a character to the redo buffer.
* Translates special keys, NUL, CSI, K_SPECIAL and multibyte characters.
*/
void AppendCharToRedobuff(c)
int c;
void AppendCharToRedobuff(int c)
{
if (!block_redo)
add_char_buff(&redobuff, c);
@ -542,8 +538,7 @@ int c;
/*
* Append a number to the redo buffer.
*/
void AppendNumberToRedobuff(n)
long n;
void AppendNumberToRedobuff(long n)
{
if (!block_redo)
add_num_buff(&redobuff, n);
@ -553,15 +548,12 @@ long n;
* Append string "s" to the stuff buffer.
* CSI and K_SPECIAL must already have been escaped.
*/
void stuffReadbuff(s)
char_u *s;
void stuffReadbuff(char_u *s)
{
add_buff(&stuffbuff, s, -1L);
}
void stuffReadbuffLen(s, len)
char_u *s;
long len;
void stuffReadbuffLen(char_u *s, long len)
{
add_buff(&stuffbuff, s, len);
}
@ -571,8 +563,7 @@ long len;
* escaping other K_SPECIAL and CSI bytes.
* Change CR, LF and ESC into a space.
*/
void stuffReadbuffSpec(s)
char_u *s;
void stuffReadbuffSpec(char_u *s)
{
int c;
@ -594,8 +585,7 @@ char_u *s;
* Append a character to the stuff buffer.
* Translates special keys, NUL, CSI, K_SPECIAL and multibyte characters.
*/
void stuffcharReadbuff(c)
int c;
void stuffcharReadbuff(int c)
{
add_char_buff(&stuffbuff, c);
}
@ -603,8 +593,7 @@ int c;
/*
* Append a number to the stuff buffer.
*/
void stuffnumReadbuff(n)
long n;
void stuffnumReadbuff(long n)
{
add_num_buff(&stuffbuff, n);
}
@ -617,9 +606,7 @@ long n;
* otherwise.
* If old is TRUE, use old_redobuff instead of redobuff.
*/
static int read_redo(init, old_redo)
int init;
int old_redo;
static int read_redo(int init, int old_redo)
{
static struct buffblock *bp;
static char_u *p;
@ -675,8 +662,7 @@ int old_redo;
* If old_redo is TRUE, use old_redobuff instead of redobuff.
* The escaped K_SPECIAL and CSI are copied without translation.
*/
static void copy_redo(old_redo)
int old_redo;
static void copy_redo(int old_redo)
{
int c;
@ -693,9 +679,7 @@ int old_redo;
*
* return FAIL for failure, OK otherwise
*/
int start_redo(count, old_redo)
long count;
int old_redo;
int start_redo(long count, int old_redo)
{
int c;
@ -744,7 +728,7 @@ int old_redo;
* the redo buffer into the stuffbuff.
* return FAIL for failure, OK otherwise
*/
int start_redo_ins() {
int start_redo_ins(void) {
int c;
if (read_redo(TRUE, FALSE) == FAIL)
@ -766,7 +750,7 @@ int start_redo_ins() {
return OK;
}
void stop_redo_ins() {
void stop_redo_ins(void) {
block_redo = FALSE;
}
@ -775,7 +759,7 @@ void stop_redo_ins() {
* alloc() cannot be used here: In out-of-memory situations it would
* be impossible to type anything.
*/
static void init_typebuf() {
static void init_typebuf(void) {
if (typebuf.tb_buf == NULL) {
typebuf.tb_buf = typebuf_init;
typebuf.tb_noremap = noremapbuf_init;
@ -805,12 +789,7 @@ static void init_typebuf() {
*
* return FAIL for failure, OK otherwise
*/
int ins_typebuf(str, noremap, offset, nottyped, silent)
char_u *str;
int noremap;
int offset;
int nottyped;
int silent;
int ins_typebuf(char_u *str, int noremap, int offset, int nottyped, int silent)
{
char_u *s1, *s2;
int newlen;
@ -931,8 +910,7 @@ int silent;
* Uses cmd_silent, KeyTyped and KeyNoremap to restore the flags belonging to
* the char.
*/
void ins_char_typebuf(c)
int c;
void ins_char_typebuf(int c)
{
char_u buf[MB_MAXBYTES + 1];
if (IS_SPECIAL(c)) {
@ -955,8 +933,10 @@ int c;
* Or "typebuf.tb_off" may have been changed and we would overwrite characters
* that was just added.
*/
int typebuf_changed(tb_change_cnt)
int tb_change_cnt; /* old value of typebuf.tb_change_cnt */
int
typebuf_changed (
int tb_change_cnt /* old value of typebuf.tb_change_cnt */
)
{
return tb_change_cnt != 0 && (typebuf.tb_change_cnt != tb_change_cnt
|| typebuf_was_filled
@ -967,23 +947,21 @@ int tb_change_cnt; /* old value of typebuf.tb_change_cnt */
* Return TRUE if there are no characters in the typeahead buffer that have
* not been typed (result from a mapping or come from ":normal").
*/
int typebuf_typed() {
int typebuf_typed(void) {
return typebuf.tb_maplen == 0;
}
/*
* Return the number of characters that are mapped (or not typed).
*/
int typebuf_maplen() {
int typebuf_maplen(void) {
return typebuf.tb_maplen;
}
/*
* remove "len" characters from typebuf.tb_buf[typebuf.tb_off + offset]
*/
void del_typebuf(len, offset)
int len;
int offset;
void del_typebuf(int len, int offset)
{
int i;
@ -1053,9 +1031,7 @@ int offset;
* Write typed characters to script file.
* If recording is on put the character in the recordbuffer.
*/
static void gotchars(chars, len)
char_u *chars;
int len;
static void gotchars(char_u *chars, int len)
{
char_u *s = chars;
int c;
@ -1095,7 +1071,7 @@ int len;
* - While reading a script file.
* - When no_u_sync is non-zero.
*/
static void may_sync_undo() {
static void may_sync_undo(void) {
if ((!(State & (INSERT + CMDLINE)) || arrow_used)
&& scriptin[curscript] == NULL)
u_sync(FALSE);
@ -1105,7 +1081,7 @@ static void may_sync_undo() {
* Make "typebuf" empty and allocate new buffers.
* Returns FAIL when out of memory.
*/
int alloc_typebuf() {
int alloc_typebuf(void) {
typebuf.tb_buf = alloc(TYPELEN_INIT);
typebuf.tb_noremap = alloc(TYPELEN_INIT);
if (typebuf.tb_buf == NULL || typebuf.tb_noremap == NULL) {
@ -1126,7 +1102,7 @@ int alloc_typebuf() {
/*
* Free the buffers of "typebuf".
*/
void free_typebuf() {
void free_typebuf(void) {
if (typebuf.tb_buf == typebuf_init)
EMSG2(_(e_intern2), "Free typebuf 1");
else
@ -1143,7 +1119,7 @@ void free_typebuf() {
*/
static typebuf_T saved_typebuf[NSCRIPT];
int save_typebuf() {
int save_typebuf(void) {
init_typebuf();
saved_typebuf[curscript] = typebuf;
/* If out of memory: restore typebuf and close file. */
@ -1163,8 +1139,7 @@ static int old_mouse_col; /* mouse_col related to old_char */
/*
* Save all three kinds of typeahead, so that the user must type at a prompt.
*/
void save_typeahead(tp)
tasave_T *tp;
void save_typeahead(tasave_T *tp)
{
tp->save_typebuf = typebuf;
tp->typebuf_valid = (alloc_typebuf() == OK);
@ -1186,8 +1161,7 @@ tasave_T *tp;
* Restore the typeahead to what it was before calling save_typeahead().
* The allocated memory is freed, can only be called once!
*/
void restore_typeahead(tp)
tasave_T *tp;
void restore_typeahead(tasave_T *tp)
{
if (tp->typebuf_valid) {
free_typebuf();
@ -1207,9 +1181,11 @@ tasave_T *tp;
/*
* Open a new script file for the ":source!" command.
*/
void openscript(name, directly)
char_u *name;
int directly; /* when TRUE execute directly */
void
openscript (
char_u *name,
int directly /* when TRUE execute directly */
)
{
if (curscript + 1 == NSCRIPT) {
EMSG(_(e_nesting));
@ -1272,7 +1248,7 @@ int directly; /* when TRUE execute directly */
/*
* Close the currently active input script.
*/
static void closescript() {
static void closescript(void) {
free_typebuf();
typebuf = saved_typebuf[curscript];
@ -1283,7 +1259,7 @@ static void closescript() {
}
#if defined(EXITFREE) || defined(PROTO)
void close_all_scripts() {
void close_all_scripts(void) {
while (scriptin[0] != NULL)
closescript();
}
@ -1293,7 +1269,7 @@ void close_all_scripts() {
/*
* Return TRUE when reading keys from a script file.
*/
int using_script() {
int using_script(void) {
return scriptin[curscript] != NULL;
}
@ -1301,7 +1277,7 @@ int using_script() {
* This function is called just before doing a blocking wait. Thus after
* waiting 'updatetime' for a character to arrive.
*/
void before_blocking() {
void before_blocking(void) {
updatescript(0);
if (may_garbage_collect)
garbage_collect();
@ -1314,8 +1290,7 @@ void before_blocking() {
* All the changed memfiles are synced if c == 0 or when the number of typed
* characters reaches 'updatecount' and 'updatecount' is non-zero.
*/
void updatescript(c)
int c;
void updatescript(int c)
{
static int count = 0;
@ -1336,7 +1311,7 @@ int c;
* Collects the bytes of a multibyte character into the whole character.
* Returns the modifiers in the global "mod_mask".
*/
int vgetc() {
int vgetc(void) {
int c, c2;
int n;
char_u buf[MB_MAXBYTES + 1];
@ -1481,7 +1456,7 @@ int vgetc() {
* Like vgetc(), but never return a NUL when called recursively, get a key
* directly from the user (ignoring typeahead).
*/
int safe_vgetc() {
int safe_vgetc(void) {
int c;
c = vgetc();
@ -1494,7 +1469,7 @@ int safe_vgetc() {
* Like safe_vgetc(), but loop to handle K_IGNORE.
* Also ignore scrollbar events.
*/
int plain_vgetc() {
int plain_vgetc(void) {
int c;
do {
@ -1508,7 +1483,7 @@ int plain_vgetc() {
* If the next character is a special character or multi-byte, the returned
* character is not valid!.
*/
int vpeekc() {
int vpeekc(void) {
if (old_char != -1)
return old_char;
return vgetorpeek(FALSE);
@ -1518,7 +1493,7 @@ int vpeekc() {
* Like vpeekc(), but don't allow mapping. Do allow checking for terminal
* codes.
*/
int vpeekc_nomap() {
int vpeekc_nomap(void) {
int c;
++no_mapping;
@ -1534,7 +1509,7 @@ int vpeekc_nomap() {
* Trick: when no typeahead found, but there is something in the typeahead
* buffer, it must be an ESC that is recognized as the start of a key code.
*/
int vpeekc_any() {
int vpeekc_any(void) {
int c;
c = vpeekc();
@ -1547,7 +1522,7 @@ int vpeekc_any() {
* Call vpeekc() without causing anything to be mapped.
* Return TRUE if a character is available, FALSE otherwise.
*/
int char_avail() {
int char_avail(void) {
int retval;
++no_mapping;
@ -1556,8 +1531,10 @@ int char_avail() {
return retval != NUL;
}
void vungetc(c) /* unget one character (can only be done once!) */
int c;
void
vungetc ( /* unget one character (can only be done once!) */
int c
)
{
old_char = c;
old_mod_mask = mod_mask;
@ -1588,8 +1565,7 @@ int c;
* Only returns one byte (of a multi-byte character).
* K_SPECIAL and CSI may be escaped, need to get two more bytes then.
*/
static int vgetorpeek(advance)
int advance;
static int vgetorpeek(int advance)
{
int c, c1;
int keylen;
@ -2363,11 +2339,13 @@ int advance;
* Return the number of obtained characters.
* Return -1 when end of input script reached.
*/
int inchar(buf, maxlen, wait_time, tb_change_cnt)
char_u *buf;
int maxlen;
long wait_time; /* milli seconds */
int tb_change_cnt;
int
inchar (
char_u *buf,
int maxlen,
long wait_time, /* milli seconds */
int tb_change_cnt
)
{
int len = 0; /* init for GCC */
int retesc = FALSE; /* return ESC with gotint */
@ -2464,10 +2442,12 @@ int tb_change_cnt;
* buf[] must have room to triple the number of bytes!
* Returns the new length.
*/
int fix_input_buffer(buf, len, script)
char_u *buf;
int len;
int script; /* TRUE when reading from a script */
int
fix_input_buffer (
char_u *buf,
int len,
int script /* TRUE when reading from a script */
)
{
int i;
char_u *p = buf;
@ -2505,7 +2485,7 @@ int script; /* TRUE when reading from a script */
* or feedkeys() may insert characters in the typeahead buffer while we are
* waiting for input to arrive.
*/
int input_available() {
int input_available(void) {
return !vim_is_input_buf_empty()
|| typebuf_was_filled
;
@ -2551,11 +2531,13 @@ int input_available() {
* 4 for out of mem
* 5 for entry not unique
*/
int do_map(maptype, arg, mode, abbrev)
int maptype;
char_u *arg;
int mode;
int abbrev; /* not a mapping but an abbreviation */
int
do_map (
int maptype,
char_u *arg,
int mode,
int abbrev /* not a mapping but an abbreviation */
)
{
char_u *keys;
mapblock_T *mp, **mpp;
@ -3020,8 +3002,7 @@ theend:
* Delete one entry from the abbrlist or maphash[].
* "mpp" is a pointer to the m_next field of the PREVIOUS entry!
*/
static void map_free(mpp)
mapblock_T **mpp;
static void map_free(mapblock_T **mpp)
{
mapblock_T *mp;
@ -3036,7 +3017,7 @@ mapblock_T **mpp;
/*
* Initialize maphash[] for first use.
*/
static void validate_maphash() {
static void validate_maphash(void) {
if (!maphash_valid) {
vim_memset(maphash, 0, sizeof(maphash));
maphash_valid = TRUE;
@ -3046,9 +3027,7 @@ static void validate_maphash() {
/*
* Get the mapping mode from the command name.
*/
int get_map_mode(cmdp, forceit)
char_u **cmdp;
int forceit;
int get_map_mode(char_u **cmdp, int forceit)
{
char_u *p;
int modec;
@ -3088,11 +3067,7 @@ int forceit;
* Clear all mappings or abbreviations.
* 'abbr' should be FALSE for mappings, TRUE for abbreviations.
*/
void map_clear(cmdp, arg, forceit, abbr)
char_u *cmdp;
char_u *arg UNUSED;
int forceit;
int abbr;
void map_clear(char_u *cmdp, char_u *arg, int forceit, int abbr)
{
int mode;
int local;
@ -3112,11 +3087,13 @@ int abbr;
/*
* Clear all mappings in "mode".
*/
void map_clear_int(buf, mode, local, abbr)
buf_T *buf UNUSED; /* buffer for local mappings */
int mode; /* mode in which to delete */
int local UNUSED; /* TRUE for buffer-local mappings */
int abbr; /* TRUE for abbreviations */
void
map_clear_int (
buf_T *buf, /* buffer for local mappings */
int mode, /* mode in which to delete */
int local, /* TRUE for buffer-local mappings */
int abbr /* TRUE for abbreviations */
)
{
mapblock_T *mp, **mpp;
int hash;
@ -3171,8 +3148,7 @@ int abbr; /* TRUE for abbreviations */
* Return characters to represent the map mode in an allocated string.
* Returns NULL when out of memory.
*/
char_u * map_mode_to_chars(mode)
int mode;
char_u *map_mode_to_chars(int mode)
{
garray_T mapmode;
@ -3208,9 +3184,11 @@ int mode;
return (char_u *)mapmode.ga_data;
}
static void showmap(mp, local)
mapblock_T *mp;
int local; /* TRUE for buffer-local map */
static void
showmap (
mapblock_T *mp,
int local /* TRUE for buffer-local map */
)
{
int len = 1;
char_u *mapchars;
@ -3274,10 +3252,7 @@ int local; /* TRUE for buffer-local map */
* Recognize termcap codes in "str".
* Also checks mappings local to the current buffer.
*/
int map_to_exists(str, modechars, abbr)
char_u *str;
char_u *modechars;
int abbr;
int map_to_exists(char_u *str, char_u *modechars, int abbr)
{
int mode = 0;
char_u *rhs;
@ -3313,10 +3288,7 @@ int abbr;
* Return TRUE if a map exists that has "str" in the rhs for mode "mode".
* Also checks mappings local to the current buffer.
*/
int map_to_exists_mode(rhs, mode, abbr)
char_u *rhs;
int mode;
int abbr;
int map_to_exists_mode(char_u *rhs, int mode, int abbr)
{
mapblock_T *mp;
int hash;
@ -3363,15 +3335,16 @@ static int expand_buffer = FALSE;
* Work out what to complete when doing command line completion of mapping
* or abbreviation names.
*/
char_u * set_context_in_map_cmd(xp, cmd, arg, forceit, isabbrev, isunmap,
cmdidx)
expand_T *xp;
char_u *cmd;
char_u *arg;
int forceit; /* TRUE if '!' given */
int isabbrev; /* TRUE if abbreviation */
int isunmap; /* TRUE if unmap/unabbrev command */
cmdidx_T cmdidx;
char_u *
set_context_in_map_cmd (
expand_T *xp,
char_u *cmd,
char_u *arg,
int forceit, /* TRUE if '!' given */
int isabbrev, /* TRUE if abbreviation */
int isunmap, /* TRUE if unmap/unabbrev command */
cmdidx_T cmdidx
)
{
if (forceit && cmdidx != CMD_map && cmdidx != CMD_unmap)
xp->xp_context = EXPAND_NOTHING;
@ -3425,10 +3398,7 @@ cmdidx_T cmdidx;
* For command line expansion of ":[un]map" and ":[un]abbrev" in all modes.
* Return OK if matches found, FAIL otherwise.
*/
int ExpandMappings(regmatch, num_file, file)
regmatch_T *regmatch;
int *num_file;
char_u ***file;
int ExpandMappings(regmatch_T *regmatch, int *num_file, char_u ***file)
{
mapblock_T *mp;
int hash;
@ -3551,11 +3521,7 @@ char_u ***file;
*
* return TRUE if there is an abbreviation, FALSE if not
*/
int check_abbr(c, ptr, col, mincol)
int c;
char_u *ptr;
int col;
int mincol;
int check_abbr(int c, char_u *ptr, int col, int mincol)
{
int len;
int scol; /* starting column of the abbr. */
@ -3703,9 +3669,11 @@ int mincol;
* Evaluate the RHS of a mapping or abbreviations and take care of escaping
* special characters.
*/
static char_u * eval_map_expr(str, c)
char_u *str;
int c; /* NUL or typed character for abbreviation */
static char_u *
eval_map_expr (
char_u *str,
int c /* NUL or typed character for abbreviation */
)
{
char_u *res;
char_u *p;
@ -3760,8 +3728,7 @@ int c; /* NUL or typed character for abbreviation */
* can be put in the typeahead buffer.
* Returns NULL when out of memory.
*/
char_u * vim_strsave_escape_csi(p)
char_u *p;
char_u *vim_strsave_escape_csi(char_u *p)
{
char_u *res;
char_u *s, *d;
@ -3799,8 +3766,7 @@ char_u *p;
* Remove escaping from CSI and K_SPECIAL characters. Reverse of
* vim_strsave_escape_csi(). Works in-place.
*/
void vim_unescape_csi(p)
char_u *p;
void vim_unescape_csi(char_u *p)
{
char_u *s = p, *d = p;
@ -3822,9 +3788,11 @@ char_u *p;
* Write map commands for the current mappings to an .exrc file.
* Return FAIL on error, OK otherwise.
*/
int makemap(fd, buf)
FILE *fd;
buf_T *buf; /* buffer for local mappings or NULL */
int
makemap (
FILE *fd,
buf_T *buf /* buffer for local mappings or NULL */
)
{
mapblock_T *mp;
char_u c1, c2, c3;
@ -4019,10 +3987,7 @@ buf_T *buf; /* buffer for local mappings or NULL */
*
* return FAIL for failure, OK otherwise
*/
int put_escstr(fd, strstart, what)
FILE *fd;
char_u *strstart;
int what;
int put_escstr(FILE *fd, char_u *strstart, int what)
{
char_u *str = strstart;
int c;
@ -4118,7 +4083,7 @@ int what;
* Check all mappings for the presence of special key codes.
* Used after ":set term=xxx".
*/
void check_map_keycodes() {
void check_map_keycodes(void) {
mapblock_T *mp;
char_u *p;
int i;
@ -4187,14 +4152,16 @@ void check_map_keycodes() {
* Return pointer to rhs of mapping (mapblock->m_str).
* NULL when no mapping found.
*/
char_u * check_map(keys, mode, exact, ign_mod, abbr, mp_ptr, local_ptr)
char_u *keys;
int mode;
int exact; /* require exact match */
int ign_mod; /* ignore preceding modifier */
int abbr; /* do abbreviations */
mapblock_T **mp_ptr; /* return: pointer to mapblock or NULL */
int *local_ptr; /* return: buffer-local mapping or NULL */
char_u *
check_map (
char_u *keys,
int mode,
int exact, /* require exact match */
int ign_mod, /* ignore preceding modifier */
int abbr, /* do abbreviations */
mapblock_T **mp_ptr, /* return: pointer to mapblock or NULL */
int *local_ptr /* return: buffer-local mapping or NULL */
)
{
int hash;
int len, minlen;
@ -4255,9 +4222,7 @@ int *local_ptr; /* return: buffer-local mapping or NULL */
* Add a mapping "map" for mode "mode".
* Need to put string in allocated memory, because do_map() will modify it.
*/
void add_map(map, mode)
char_u *map;
int mode;
void add_map(char_u *map, int mode)
{
char_u *s;
char_u *cpo_save = p_cpo;

View File

@ -96,9 +96,7 @@ static short_u kind_table_for_3[] =
* 3 bulsik: (current initial sound, input english) -> compound initial sound.
*/
static int comfcon3(v, c)
int v;
int c;
static int comfcon3(int v, int c)
{
if (v == 2 && c == 2)
return 3;
@ -117,9 +115,7 @@ int c;
* 3 bulsik: (current vowel, input english) -> compound vowel.
*/
static int comvow3(v, c)
int v;
int c;
static int comvow3(int v, int c)
{
switch (v) {
case 13: /* ㅗ */
@ -156,9 +152,7 @@ int c;
* VIM: V = initial sound, I = medial vowel, M = final consonant.
*/
static int comcon3(k, c)
int k;
int c;
static int comcon3(int k, int c)
{
switch (k) {
case 2: /* ㄱ */
@ -212,8 +206,7 @@ int c;
/****** 2 벌식자판을 위한 루틴 (Routines for 2 bulsik keyboard) ******/
/**********************************************************************/
static int kind_table_for_2(c)
int c;
static int kind_table_for_2(int c)
{
static char_u table[] =
{
@ -235,8 +228,7 @@ int c;
* (2 bulsik: conversion english char. to initial sound of compound type)
* : 0 (If it is not initial sound, return 0).
*/
static int fcon(c)
int c;
static int fcon(int c)
{
static char_u table[] =
{
@ -259,8 +251,7 @@ int c;
* (2 bulsik: conversion english char. to medial vowel)
* : 0 (If it is not medial vowel, return 0).
*/
static int vow(c)
int c;
static int vow(int c)
{
static char_u table[] =
{
@ -282,8 +273,7 @@ int c;
* (2 bulsik: conversion english char. to prop)
* : 0 (If not prop, return 0)
*/
static int lcon(c)
int c;
static int lcon(int c)
{
static char_u table[] =
{
@ -304,9 +294,7 @@ int c;
* (2 bulsik: conversion (curr. prop, input english) to prop)
*/
static int comcon2(k, c)
int k;
int c;
static int comcon2(int k, int c)
{
switch (k) {
case 2: /* ㄱ */
@ -359,9 +347,7 @@ int c;
* vowel)
*/
static int comvow2(v, c)
int v;
int c;
static int comvow2(int v, int c)
{
switch (v) {
case 13: /* ㅗ */
@ -396,22 +382,21 @@ int c;
return 0;
}
int hangul_input_state_get() {
int hangul_input_state_get(void) {
return hangul_input_state;
}
void hangul_input_state_set(state)
int state;
void hangul_input_state_set(int state)
{
hangul_input_state = state;
hangul_input_clear();
}
int im_get_status() {
int im_get_status(void) {
return hangul_input_state_get();
}
void hangul_input_state_toggle() {
void hangul_input_state_toggle(void) {
if (hangul_input_state_get()) {
hangul_input_state_set(0);
if (composing_hangul) {
@ -428,9 +413,7 @@ void hangul_input_state_toggle() {
}
static int hangul_automata2(buf, c)
char_u *buf;
int_u *c;
static int hangul_automata2(char_u *buf, int_u *c)
{
int t,t2;
@ -570,9 +553,7 @@ int_u *c;
return AUTOMATA_ERROR; /* RrEeAaLlLlYy EeRrRrOoRr */
}
static int hangul_automata3(buf, c)
char_u *buf;
int_u *c;
static int hangul_automata3(char_u *buf, int_u *c)
{
int t, t2;
@ -665,7 +646,7 @@ int_u *c;
return AUTOMATA_SPECIAL;
}
void hangul_keyboard_set() {
void hangul_keyboard_set(void) {
int keyboard;
char *s;
@ -683,9 +664,7 @@ void hangul_keyboard_set() {
}
}
int hangul_input_process(s, len)
char_u *s;
int len;
int hangul_input_process(char_u *s, int len)
{
int n;
unsigned int c;
@ -746,7 +725,7 @@ int len;
return len;
}
void hangul_input_clear() {
void hangul_input_clear(void) {
sp = 0;
f = F_NULL;
m = M_NULL;
@ -1416,11 +1395,7 @@ static const char_u johab_lcon_to_wan[] =
0xbb, 0xbc, 0xbd, 0xbe /* ㅋ, ㅌ, ㅍ, ㅎ */
};
static void convert_ks_to_3(src, fp, mp, lp)
const char_u *src;
int *fp;
int *mp;
int *lp;
static void convert_ks_to_3(const char_u *src, int *fp, int *mp, int *lp)
{
int h = *src;
int low = *(src + 1);
@ -1447,11 +1422,7 @@ int *lp;
}
}
static int convert_3_to_ks(fv, mv, lv, des)
int fv;
int mv;
int lv;
char_u *des;
static int convert_3_to_ks(int fv, int mv, int lv, char_u *des)
{
char_u key[3];
register int hi, lo, mi = 0, result, found;

View File

@ -151,7 +151,7 @@ static void prt_get_attr __ARGS((int hl_id, prt_text_attr_T* pattr, int modec));
* Parse 'printoptions' and set the flags in "printer_opts".
* Returns an error message or NULL;
*/
char_u * parse_printoptions() {
char_u *parse_printoptions(void) {
return parse_list_options(p_popt, printer_opts, OPT_PRINT_NUM_OPTIONS);
}
@ -159,7 +159,7 @@ char_u * parse_printoptions() {
* Parse 'printoptions' and set the flags in "printer_opts".
* Returns an error message or NULL;
*/
char_u * parse_printmbfont() {
char_u *parse_printmbfont(void) {
return parse_list_options(p_pmfn, mbfont_opts, OPT_MBFONT_NUM_OPTIONS);
}
@ -172,10 +172,7 @@ char_u * parse_printmbfont() {
* Returns an error message for an illegal option, NULL otherwise.
* Only used for the printer at the moment...
*/
static char_u * parse_list_options(option_str, table, table_size)
char_u *option_str;
option_table_T *table;
int table_size;
static char_u *parse_list_options(char_u *option_str, option_table_T *table, int table_size)
{
char_u *stringp;
char_u *colonp;
@ -234,16 +231,14 @@ int table_size;
* If using a dark background, the colors will probably be too bright to show
* up well on white paper, so reduce their brightness.
*/
static long_u darken_rgb(rgb)
long_u rgb;
static long_u darken_rgb(long_u rgb)
{
return ((rgb >> 17) << 16)
+ (((rgb & 0xff00) >> 9) << 8)
+ ((rgb & 0xff) >> 1);
}
static long_u prt_get_term_color(colorindex)
int colorindex;
static long_u prt_get_term_color(int colorindex)
{
/* TODO: Should check for xterm with 88 or 256 colors. */
if (t_colors > 8)
@ -251,10 +246,7 @@ int colorindex;
return cterm_color_8[colorindex % 8];
}
static void prt_get_attr(hl_id, pattr, modec)
int hl_id;
prt_text_attr_T *pattr;
int modec;
static void prt_get_attr(int hl_id, prt_text_attr_T *pattr, int modec)
{
int colorindex;
long_u fg_color;
@ -290,8 +282,7 @@ int modec;
pattr->bg_color = bg_color;
}
static void prt_set_fg(fg)
long_u fg;
static void prt_set_fg(long_u fg)
{
if (fg != curr_fg) {
curr_fg = fg;
@ -299,8 +290,7 @@ long_u fg;
}
}
static void prt_set_bg(bg)
long_u bg;
static void prt_set_bg(long_u bg)
{
if (bg != curr_bg) {
curr_bg = bg;
@ -308,10 +298,7 @@ long_u bg;
}
}
static void prt_set_font(bold, italic, underline)
int bold;
int italic;
int underline;
static void prt_set_font(int bold, int italic, int underline)
{
if (curr_bold != bold
|| curr_italic != italic
@ -326,10 +313,7 @@ int underline;
/*
* Print the line number in the left margin.
*/
static void prt_line_number(psettings, page_line, lnum)
prt_settings_T *psettings;
int page_line;
linenr_T lnum;
static void prt_line_number(prt_settings_T *psettings, int page_line, linenr_T lnum)
{
int i;
char_u tbuf[20];
@ -360,7 +344,7 @@ linenr_T lnum;
/*
* Get the currently effective header height.
*/
int prt_header_height() {
int prt_header_height(void) {
if (printer_opts[OPT_PRINT_HEADERHEIGHT].present)
return printer_opts[OPT_PRINT_HEADERHEIGHT].number;
return 2;
@ -369,7 +353,7 @@ int prt_header_height() {
/*
* Return TRUE if using a line number for printing.
*/
int prt_use_number() {
int prt_use_number(void) {
return printer_opts[OPT_PRINT_NUMBER].present
&& TOLOWER_ASC(printer_opts[OPT_PRINT_NUMBER].string[0]) == 'y';
}
@ -378,8 +362,7 @@ int prt_use_number() {
* Return the unit used in a margin item in 'printoptions'.
* Returns PRT_UNIT_NONE if not recognized.
*/
int prt_get_unit(idx)
int idx;
int prt_get_unit(int idx)
{
int u = PRT_UNIT_NONE;
int i;
@ -397,10 +380,7 @@ int idx;
/*
* Print the page header.
*/
static void prt_header(psettings, pagenum, lnum)
prt_settings_T *psettings;
int pagenum;
linenr_T lnum UNUSED;
static void prt_header(prt_settings_T *psettings, int pagenum, linenr_T lnum)
{
int width = psettings->chars_per_line;
int page_line;
@ -481,16 +461,14 @@ linenr_T lnum UNUSED;
/*
* Display a print status message.
*/
static void prt_message(s)
char_u *s;
static void prt_message(char_u *s)
{
screen_fill((int)Rows - 1, (int)Rows, 0, (int)Columns, ' ', ' ', 0);
screen_puts(s, (int)Rows - 1, 0, hl_attr(HLF_R));
out_flush();
}
void ex_hardcopy(eap)
exarg_T *eap;
void ex_hardcopy(exarg_T *eap)
{
linenr_T lnum;
int collated_copies, uncollated_copies;
@ -726,10 +704,7 @@ print_fail_no_begin:
* Print one page line.
* Return the next column to print, or zero if the line is finished.
*/
static colnr_T hardcopy_line(psettings, page_line, ppos)
prt_settings_T *psettings;
int page_line;
prt_pos_T *ppos;
static colnr_T hardcopy_line(prt_settings_T *psettings, int page_line, prt_pos_T *ppos)
{
colnr_T col;
char_u *line;
@ -1337,9 +1312,7 @@ static int prt_half_width;
static char *prt_ascii_encoding;
static char_u prt_hexchar[] = "0123456789abcdef";
static void prt_write_file_raw_len(buffer, bytes)
char_u *buffer;
int bytes;
static void prt_write_file_raw_len(char_u *buffer, int bytes)
{
if (!prt_file_error
&& fwrite(buffer, sizeof(char_u), bytes, prt_ps_fd)
@ -1349,15 +1322,12 @@ int bytes;
}
}
static void prt_write_file(buffer)
char_u *buffer;
static void prt_write_file(char_u *buffer)
{
prt_write_file_len(buffer, (int)STRLEN(buffer));
}
static void prt_write_file_len(buffer, bytes)
char_u *buffer;
int bytes;
static void prt_write_file_len(char_u *buffer, int bytes)
{
prt_write_file_raw_len(buffer, bytes);
}
@ -1365,8 +1335,7 @@ int bytes;
/*
* Write a string.
*/
static void prt_write_string(s)
char *s;
static void prt_write_string(char *s)
{
vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer), "%s", s);
prt_write_file(prt_line_buffer);
@ -1375,8 +1344,7 @@ char *s;
/*
* Write an int and a space.
*/
static void prt_write_int(i)
int i;
static void prt_write_int(int i)
{
sprintf((char *)prt_line_buffer, "%d ", i);
prt_write_file(prt_line_buffer);
@ -1385,8 +1353,7 @@ int i;
/*
* Write a boolean and a space.
*/
static void prt_write_boolean(b)
int b;
static void prt_write_boolean(int b)
{
sprintf((char *)prt_line_buffer, "%s ", (b ? "T" : "F"));
prt_write_file(prt_line_buffer);
@ -1395,11 +1362,7 @@ int b;
/*
* Write PostScript to re-encode and define the font.
*/
static void prt_def_font(new_name, encoding, height, font)
char *new_name;
char *encoding;
int height;
char *font;
static void prt_def_font(char *new_name, char *encoding, int height, char *font)
{
vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer),
"/_%s /VIM-%s /%s ref\n", new_name, encoding, font);
@ -1416,10 +1379,7 @@ char *font;
/*
* Write a line to define the CID font.
*/
static void prt_def_cidfont(new_name, height, cidfont)
char *new_name;
int height;
char *cidfont;
static void prt_def_cidfont(char *new_name, int height, char *cidfont)
{
vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer),
"/_%s /%s[/%s] vim_composefont\n", new_name, prt_cmap, cidfont);
@ -1432,9 +1392,7 @@ char *cidfont;
/*
* Write a line to define a duplicate of a CID font
*/
static void prt_dup_cidfont(original_name, new_name)
char *original_name;
char *new_name;
static void prt_dup_cidfont(char *original_name, char *new_name)
{
vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer),
"/%s %s d\n", new_name, original_name);
@ -1446,11 +1404,7 @@ char *new_name;
* the fractional part being in the range [0,10^precision). The fractional part
* is also rounded based on the precision + 1'th fractional digit.
*/
static void prt_real_bits(real, precision, pinteger, pfraction)
double real;
int precision;
int *pinteger;
int *pfraction;
static void prt_real_bits(double real, int precision, int *pinteger, int *pfraction)
{
int i;
int integer;
@ -1472,9 +1426,7 @@ int *pfraction;
* We use prt_real_bits() as %f in sprintf uses the locale setting to decide
* what decimal point character to use, but PS always requires a '.'.
*/
static void prt_write_real(val, prec)
double val;
int prec;
static void prt_write_real(double val, int prec)
{
int integer;
int fraction;
@ -1501,10 +1453,7 @@ int prec;
/*
* Write a line to define a numeric variable.
*/
static void prt_def_var(name, value, prec)
char *name;
double value;
int prec;
static void prt_def_var(char *name, double value, int prec)
{
vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer),
"/%s ", name);
@ -1517,7 +1466,7 @@ int prec;
/* Convert size from font space to user space at current font scale */
#define PRT_PS_FONT_TO_USER(scale, size) ((size) * ((scale)/1000.0))
static void prt_flush_buffer() {
static void prt_flush_buffer(void) {
if (prt_ps_buffer.ga_len > 0) {
/* Any background color must be drawn first */
if (prt_do_bgcol && (prt_new_bgcol != PRCOLOR_WHITE)) {
@ -1585,9 +1534,7 @@ static void prt_flush_buffer() {
}
}
static void prt_resource_name(filename, cookie)
char_u *filename;
void *cookie;
static void prt_resource_name(char_u *filename, void *cookie)
{
char_u *resource_filename = cookie;
@ -1597,9 +1544,7 @@ void *cookie;
STRCPY(resource_filename, filename);
}
static int prt_find_resource(name, resource)
char *name;
struct prt_ps_resource_S *resource;
static int prt_find_resource(char *name, struct prt_ps_resource_S *resource)
{
char_u *buffer;
int retval;
@ -1638,7 +1583,7 @@ struct prt_resfile_buffer_S {
static struct prt_resfile_buffer_S prt_resfile;
static int prt_resfile_next_line() {
static int prt_resfile_next_line(void) {
int idx;
/* Move to start of next line and then find end of line */
@ -1660,10 +1605,7 @@ static int prt_resfile_next_line() {
return idx < prt_resfile.len;
}
static int prt_resfile_strncmp(offset, string, len)
int offset;
char *string;
int len;
static int prt_resfile_strncmp(int offset, char *string, int len)
{
/* Force not equal if string is longer than remainder of line */
if (len > (prt_resfile.line_end - (prt_resfile.line_start + offset)))
@ -1673,8 +1615,7 @@ int len;
string, len);
}
static int prt_resfile_skip_nonws(offset)
int offset;
static int prt_resfile_skip_nonws(int offset)
{
int idx;
@ -1687,8 +1628,7 @@ int offset;
return -1;
}
static int prt_resfile_skip_ws(offset)
int offset;
static int prt_resfile_skip_ws(int offset)
{
int idx;
@ -1703,8 +1643,7 @@ int offset;
/* prt_next_dsc() - returns detail on next DSC comment line found. Returns true
* if a DSC comment is found, else false */
static int prt_next_dsc(p_dsc_line)
struct prt_dsc_line_S *p_dsc_line;
static int prt_next_dsc(struct prt_dsc_line_S *p_dsc_line)
{
int comment;
int offset;
@ -1749,8 +1688,7 @@ struct prt_dsc_line_S *p_dsc_line;
/* Improved hand crafted parser to get the type, title, and version number of a
* PS resource file so the file details can be added to the DSC header comments.
*/
static int prt_open_resource(resource)
struct prt_ps_resource_S *resource;
static int prt_open_resource(struct prt_ps_resource_S *resource)
{
int offset;
int seen_all;
@ -1866,9 +1804,7 @@ struct prt_ps_resource_S *resource;
return TRUE;
}
static int prt_check_resource(resource, version)
struct prt_ps_resource_S *resource;
char_u *version;
static int prt_check_resource(struct prt_ps_resource_S *resource, char_u *version)
{
/* Version number m.n should match, the revision number does not matter */
if (STRNCMP(resource->version, version, STRLEN(version))) {
@ -1881,30 +1817,25 @@ char_u *version;
return TRUE;
}
static void prt_dsc_start() {
static void prt_dsc_start(void) {
prt_write_string("%!PS-Adobe-3.0\n");
}
static void prt_dsc_noarg(comment)
char *comment;
static void prt_dsc_noarg(char *comment)
{
vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer),
"%%%%%s\n", comment);
prt_write_file(prt_line_buffer);
}
static void prt_dsc_textline(comment, text)
char *comment;
char *text;
static void prt_dsc_textline(char *comment, char *text)
{
vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer),
"%%%%%s: %s\n", comment, text);
prt_write_file(prt_line_buffer);
}
static void prt_dsc_text(comment, text)
char *comment;
char *text;
static void prt_dsc_text(char *comment, char *text)
{
/* TODO - should scan 'text' for any chars needing escaping! */
vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer),
@ -1914,10 +1845,7 @@ char *text;
#define prt_dsc_atend(c) prt_dsc_text((c), "atend")
static void prt_dsc_ints(comment, count, ints)
char *comment;
int count;
int *ints;
static void prt_dsc_ints(char *comment, int count, int *ints)
{
int i;
@ -1933,10 +1861,12 @@ int *ints;
prt_write_string("\n");
}
static void prt_dsc_resources(comment, type, string)
char *comment; /* if NULL add to previous */
char *type;
char *string;
static void
prt_dsc_resources (
char *comment, /* if NULL add to previous */
char *type,
char *string
)
{
if (comment != NULL)
vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer),
@ -1951,9 +1881,7 @@ char *string;
prt_write_file(prt_line_buffer);
}
static void prt_dsc_font_resource(resource, ps_font)
char *resource;
struct prt_ps_font_S *ps_font;
static void prt_dsc_font_resource(char *resource, struct prt_ps_font_S *ps_font)
{
int i;
@ -1964,12 +1892,7 @@ struct prt_ps_font_S *ps_font;
prt_dsc_resources(NULL, "font", ps_font->ps_fontname[i]);
}
static void prt_dsc_requirements(duplex, tumble, collate, color, num_copies)
int duplex;
int tumble;
int collate;
int color;
int num_copies;
static void prt_dsc_requirements(int duplex, int tumble, int collate, int color, int num_copies)
{
/* Only output the comment if we need to.
* Note: tumble is ignored if we are not duplexing
@ -1999,13 +1922,7 @@ int num_copies;
prt_write_string("\n");
}
static void prt_dsc_docmedia(paper_name, width, height, weight, colour, type)
char *paper_name;
double width;
double height;
double weight;
char *colour;
char *type;
static void prt_dsc_docmedia(char *paper_name, double width, double height, double weight, char *colour, char *type)
{
vim_snprintf((char *)prt_line_buffer, sizeof(prt_line_buffer),
"%%%%DocumentMedia: %s ", paper_name);
@ -2025,7 +1942,7 @@ char *type;
prt_write_string("\n");
}
void mch_print_cleanup() {
void mch_print_cleanup(void) {
if (prt_out_mbyte) {
int i;
@ -2055,10 +1972,7 @@ void mch_print_cleanup() {
}
}
static float to_device_units(idx, physsize, def_number)
int idx;
double physsize;
int def_number;
static float to_device_units(int idx, double physsize, int def_number)
{
float ret;
int u;
@ -2093,13 +2007,7 @@ int def_number;
/*
* Calculate margins for given width and height from printoptions settings.
*/
static void prt_page_margins(width, height, left, right, top, bottom)
double width;
double height;
double *left;
double *right;
double *top;
double *bottom;
static void prt_page_margins(double width, double height, double *left, double *right, double *top, double *bottom)
{
*left = to_device_units(OPT_PRINT_LEFT, width, 10);
*right = width - to_device_units(OPT_PRINT_RIGHT, width, 5);
@ -2107,15 +2015,14 @@ double *bottom;
*bottom = to_device_units(OPT_PRINT_BOT, height, 5);
}
static void prt_font_metrics(font_scale)
int font_scale;
static void prt_font_metrics(int font_scale)
{
prt_line_height = (float)font_scale;
prt_char_width = (float)PRT_PS_FONT_TO_USER(font_scale, prt_ps_font->wx);
}
static int prt_get_cpl() {
static int prt_get_cpl(void) {
if (prt_use_number()) {
prt_number_width = PRINT_NUMBER_WIDTH * prt_char_width;
/* If we are outputting multi-byte characters then line numbers will be
@ -2130,10 +2037,7 @@ static int prt_get_cpl() {
return (int)((prt_right_margin - prt_left_margin) / prt_char_width);
}
static int prt_build_cid_fontname(font, name, name_len)
int font;
char_u *name;
int name_len;
static int prt_build_cid_fontname(int font, char_u *name, int name_len)
{
char *fontname;
@ -2149,7 +2053,7 @@ int name_len;
/*
* Get number of lines of text that fit on a page (excluding the header).
*/
static int prt_get_lpp() {
static int prt_get_lpp(void) {
int lpp;
/*
@ -2177,10 +2081,7 @@ static int prt_get_lpp() {
return lpp - prt_header_height();
}
static int prt_match_encoding(p_encoding, p_cmap, pp_mbenc)
char *p_encoding;
struct prt_ps_mbfont_S *p_cmap;
struct prt_ps_encoding_S **pp_mbenc;
static int prt_match_encoding(char *p_encoding, struct prt_ps_mbfont_S *p_cmap, struct prt_ps_encoding_S **pp_mbenc)
{
int mbenc;
int enc_len;
@ -2200,10 +2101,7 @@ struct prt_ps_encoding_S **pp_mbenc;
return FALSE;
}
static int prt_match_charset(p_charset, p_cmap, pp_mbchar)
char *p_charset;
struct prt_ps_mbfont_S *p_cmap;
struct prt_ps_charset_S **pp_mbchar;
static int prt_match_charset(char *p_charset, struct prt_ps_mbfont_S *p_cmap, struct prt_ps_charset_S **pp_mbchar)
{
int mbchar;
int char_len;
@ -2224,10 +2122,7 @@ struct prt_ps_charset_S **pp_mbchar;
return FALSE;
}
int mch_print_init(psettings, jobname, forceit)
prt_settings_T *psettings;
char_u *jobname;
int forceit UNUSED;
int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
{
int i;
char *paper_name;
@ -2510,8 +2405,7 @@ int forceit UNUSED;
return OK;
}
static int prt_add_resource(resource)
struct prt_ps_resource_S *resource;
static int prt_add_resource(struct prt_ps_resource_S *resource)
{
FILE* fd_resource;
char_u resource_buffer[512];
@ -2553,8 +2447,7 @@ struct prt_ps_resource_S *resource;
return TRUE;
}
int mch_print_begin(psettings)
prt_settings_T *psettings;
int mch_print_begin(prt_settings_T *psettings)
{
time_t now;
int bbox[4];
@ -2925,8 +2818,7 @@ theend:
return retval;
}
void mch_print_end(psettings)
prt_settings_T *psettings;
void mch_print_end(prt_settings_T *psettings)
{
prt_dsc_noarg("Trailer");
@ -2960,7 +2852,7 @@ prt_settings_T *psettings;
mch_print_cleanup();
}
int mch_print_end_page() {
int mch_print_end_page(void) {
prt_flush_buffer();
prt_write_string("re sp\n");
@ -2970,8 +2862,7 @@ int mch_print_end_page() {
return !prt_file_error;
}
int mch_print_begin_page(str)
char_u *str UNUSED;
int mch_print_begin_page(char_u *str)
{
int page_num[2];
@ -3008,16 +2899,14 @@ char_u *str UNUSED;
return !prt_file_error;
}
int mch_print_blank_page() {
int mch_print_blank_page(void) {
return mch_print_begin_page(NULL) ? (mch_print_end_page()) : FALSE;
}
static float prt_pos_x = 0;
static float prt_pos_y = 0;
void mch_print_start_line(margin, page_line)
int margin;
int page_line;
void mch_print_start_line(int margin, int page_line)
{
prt_pos_x = prt_left_margin;
if (margin)
@ -3031,9 +2920,7 @@ int page_line;
prt_half_width = FALSE;
}
int mch_print_text_out(p, len)
char_u *p;
int len UNUSED;
int mch_print_text_out(char_u *p, int len)
{
int need_break;
char_u ch;
@ -3214,10 +3101,7 @@ int len UNUSED;
return need_break;
}
void mch_print_set_font(iBold, iItalic, iUnderline)
int iBold;
int iItalic;
int iUnderline;
void mch_print_set_font(int iBold, int iItalic, int iUnderline)
{
int font = 0;
@ -3238,16 +3122,14 @@ int iUnderline;
}
}
void mch_print_set_bg(bgcol)
long_u bgcol;
void mch_print_set_bg(long_u bgcol)
{
prt_bgcol = (int)bgcol;
prt_attribute_change = TRUE;
prt_need_bgcol = TRUE;
}
void mch_print_set_fg(fgcol)
long_u fgcol;
void mch_print_set_fg(long_u fgcol)
{
if (fgcol != (long_u)prt_fgcol) {
prt_fgcol = (int)fgcol;

View File

@ -40,8 +40,7 @@ static int hash_may_resize __ARGS((hashtab_T *ht, int minitems));
/*
* Initialize an empty hash table.
*/
void hash_init(ht)
hashtab_T *ht;
void hash_init(hashtab_T *ht)
{
/* This zeroes all "ht_" entries and all the "hi_key" in "ht_smallarray". */
vim_memset(ht, 0, sizeof(hashtab_T));
@ -53,8 +52,7 @@ hashtab_T *ht;
* Free the array of a hash table. Does not free the items it contains!
* If "ht" is not freed then you should call hash_init() next!
*/
void hash_clear(ht)
hashtab_T *ht;
void hash_clear(hashtab_T *ht)
{
if (ht->ht_array != ht->ht_smallarray)
vim_free(ht->ht_array);
@ -65,9 +63,7 @@ hashtab_T *ht;
* have been allocated. "off" is the offset from the start of the allocate
* memory to the location of the key (it's always positive).
*/
void hash_clear_all(ht, off)
hashtab_T *ht;
int off;
void hash_clear_all(hashtab_T *ht, int off)
{
long todo;
hashitem_T *hi;
@ -90,9 +86,7 @@ int off;
* WARNING: The returned pointer becomes invalid when the hashtable is changed
* (adding, setting or removing an item)!
*/
hashitem_T * hash_find(ht, key)
hashtab_T *ht;
char_u *key;
hashitem_T *hash_find(hashtab_T *ht, char_u *key)
{
return hash_lookup(ht, key, hash_hash(key));
}
@ -100,10 +94,7 @@ char_u *key;
/*
* Like hash_find(), but caller computes "hash".
*/
hashitem_T * hash_lookup(ht, key, hash)
hashtab_T *ht;
char_u *key;
hash_T hash;
hashitem_T *hash_lookup(hashtab_T *ht, char_u *key, hash_T hash)
{
hash_T perturb;
hashitem_T *freeitem;
@ -163,7 +154,7 @@ hash_T hash;
* Useful when trying different hash algorithms.
* Called when exiting.
*/
void hash_debug_results() {
void hash_debug_results(void) {
#ifdef HT_DEBUG
fprintf(stderr, "\r\n\r\n\r\n\r\n");
fprintf(stderr, "Number of hashtable lookups: %ld\r\n", hash_count_lookup);
@ -177,9 +168,7 @@ void hash_debug_results() {
* Add item with key "key" to hashtable "ht".
* Returns FAIL when out of memory or the key is already present.
*/
int hash_add(ht, key)
hashtab_T *ht;
char_u *key;
int hash_add(hashtab_T *ht, char_u *key)
{
hash_T hash = hash_hash(key);
hashitem_T *hi;
@ -198,11 +187,7 @@ char_u *key;
* "hi" is invalid after this!
* Returns OK or FAIL (out of memory).
*/
int hash_add_item(ht, hi, key, hash)
hashtab_T *ht;
hashitem_T *hi;
char_u *key;
hash_T hash;
int hash_add_item(hashtab_T *ht, hashitem_T *hi, char_u *key, hash_T hash)
{
/* If resizing failed before and it fails again we can't add an item. */
if (ht->ht_error && hash_may_resize(ht, 0) == FAIL)
@ -224,9 +209,7 @@ hash_T hash;
* hash_lookup().
* The caller must take care of freeing the item itself.
*/
void hash_remove(ht, hi)
hashtab_T *ht;
hashitem_T *hi;
void hash_remove(hashtab_T *ht, hashitem_T *hi)
{
--ht->ht_used;
hi->hi_key = HI_KEY_REMOVED;
@ -238,8 +221,7 @@ hashitem_T *hi;
* Don't use this when items are to be added!
* Must call hash_unlock() later.
*/
void hash_lock(ht)
hashtab_T *ht;
void hash_lock(hashtab_T *ht)
{
++ht->ht_locked;
}
@ -250,8 +232,7 @@ hashtab_T *ht;
* Table will be resized (shrink) when necessary.
* This must balance a call to hash_lock().
*/
void hash_unlock(ht)
hashtab_T *ht;
void hash_unlock(hashtab_T *ht)
{
--ht->ht_locked;
(void)hash_may_resize(ht, 0);
@ -262,9 +243,11 @@ hashtab_T *ht;
* Grow a hashtable when there is not enough empty space.
* Returns OK or FAIL (out of memory).
*/
static int hash_may_resize(ht, minitems)
hashtab_T *ht;
int minitems; /* minimal number of items */
static int
hash_may_resize (
hashtab_T *ht,
int minitems /* minimal number of items */
)
{
hashitem_T temparray[HT_INIT_SIZE];
hashitem_T *oldarray, *newarray;
@ -395,8 +378,7 @@ int minitems; /* minimal number of items */
* when exiting. Try that with the current hash algorithm and yours. The
* lower the percentage the better.
*/
hash_T hash_hash(key)
char_u *key;
hash_T hash_hash(char_u *key)
{
hash_T hash;
char_u *p;

View File

@ -83,8 +83,7 @@ static cscmd_T cs_cmds[] =
{ NULL, NULL, NULL, NULL, 0 }
};
static void cs_usage_msg(x)
csid_e x;
static void cs_usage_msg(csid_e x)
{
(void)EMSG2(_("E560: Usage: cs[cope] %s"), cs_cmds[(int)x].usage);
}
@ -101,9 +100,7 @@ static enum {
* Function given to ExpandGeneric() to obtain the cscope command
* expansion.
*/
char_u * get_cscope_name(xp, idx)
expand_T *xp UNUSED;
int idx;
char_u *get_cscope_name(expand_T *xp, int idx)
{
int current_idx;
int i;
@ -160,10 +157,7 @@ int idx;
/*
* Handle command line completion for :cscope command.
*/
void set_context_in_cscope_cmd(xp, arg, cmdidx)
expand_T *xp;
char_u *arg;
cmdidx_T cmdidx;
void set_context_in_cscope_cmd(expand_T *xp, char_u *arg, cmdidx_T cmdidx)
{
char_u *p;
@ -199,9 +193,11 @@ cmdidx_T cmdidx;
* Find the command, print help if invalid, and then call the corresponding
* command function.
*/
static void do_cscope_general(eap, make_split)
exarg_T *eap;
int make_split; /* whether to split window */
static void
do_cscope_general (
exarg_T *eap,
int make_split /* whether to split window */
)
{
cscmd_T *cmdp;
@ -230,8 +226,7 @@ int make_split; /* whether to split window */
/*
* PUBLIC: do_cscope
*/
void do_cscope(eap)
exarg_T *eap;
void do_cscope(exarg_T *eap)
{
do_cscope_general(eap, FALSE);
}
@ -241,8 +236,7 @@ exarg_T *eap;
*
* same as do_cscope, but splits window, too.
*/
void do_scscope(eap)
exarg_T *eap;
void do_scscope(exarg_T *eap)
{
do_cscope_general(eap, TRUE);
}
@ -251,8 +245,7 @@ exarg_T *eap;
* PUBLIC: do_cstag
*
*/
void do_cstag(eap)
exarg_T *eap;
void do_cstag(exarg_T *eap)
{
int ret = FALSE;
@ -319,9 +312,7 @@ exarg_T *eap;
*
* returns TRUE if eof, FALSE otherwise
*/
int cs_fgets(buf, size)
char_u *buf;
int size;
int cs_fgets(char_u *buf, int size)
{
char *p;
@ -338,7 +329,7 @@ int size;
*
* called only from do_tag(), when popping the tag stack
*/
void cs_free_tags() {
void cs_free_tags(void) {
cs_manage_matches(NULL, NULL, -1, Free);
}
@ -347,7 +338,7 @@ void cs_free_tags() {
*
* called from do_tag()
*/
void cs_print_tags() {
void cs_print_tags(void) {
cs_manage_matches(NULL, NULL, -1, Print);
}
@ -378,10 +369,7 @@ void cs_print_tags() {
*
* Note: All string comparisons are case sensitive!
*/
int cs_connection(num, dbpath, ppath)
int num;
char_u *dbpath;
char_u *ppath;
int cs_connection(int num, char_u *dbpath, char_u *ppath)
{
int i;
@ -439,8 +427,7 @@ char_u *ppath;
*
* MAXPATHL 256
*/
static int cs_add(eap)
exarg_T *eap UNUSED;
static int cs_add(exarg_T *eap)
{
char *fname, *ppath, *flags = NULL;
@ -454,8 +441,7 @@ exarg_T *eap UNUSED;
return cs_add_common(fname, ppath, flags);
}
static void cs_stat_emsg(fname)
char *fname;
static void cs_stat_emsg(char *fname)
{
char *stat_emsg = _("E563: stat(%s) error: %d");
char *buf = (char *)alloc((unsigned)strlen(stat_emsg) + MAXPATHL + 10);
@ -476,10 +462,12 @@ char *fname;
* cs_add() and cs_reset(). i really don't like to do this, but this
* routine uses a number of goto statements.
*/
static int cs_add_common(arg1, arg2, flags)
char *arg1; /* filename - may contain environment variables */
char *arg2; /* prepend path - may contain environment variables */
char *flags;
static int
cs_add_common (
char *arg1, /* filename - may contain environment variables */
char *arg2, /* prepend path - may contain environment variables */
char *flags
)
{
struct stat statbuf;
int ret;
@ -595,11 +583,11 @@ add_err:
} /* cs_add_common */
static int cs_check_for_connections() {
static int cs_check_for_connections(void) {
return cs_cnt_connections() > 0;
} /* cs_check_for_connections */
static int cs_check_for_tags() {
static int cs_check_for_tags(void) {
return p_tags[0] != NUL && curbuf->b_p_tags != NULL;
} /* cs_check_for_tags */
@ -608,7 +596,7 @@ static int cs_check_for_tags() {
*
* count the number of cscope connections
*/
static int cs_cnt_connections() {
static int cs_cnt_connections(void) {
short i;
short cnt = 0;
@ -619,8 +607,10 @@ static int cs_cnt_connections() {
return cnt;
} /* cs_cnt_connections */
static void cs_reading_emsg(idx)
int idx; /* connection index */
static void
cs_reading_emsg (
int idx /* connection index */
)
{
EMSGN(_("E262: error reading cscope connection %ld"), idx);
}
@ -631,8 +621,7 @@ int idx; /* connection index */
*
* count the number of matches for a given cscope connection.
*/
static int cs_cnt_matches(idx)
int idx;
static int cs_cnt_matches(int idx)
{
char *stok;
char *buf;
@ -689,9 +678,7 @@ int idx;
*
* Creates the actual cscope command query from what the user entered.
*/
static char * cs_create_cmd(csoption, pattern)
char *csoption;
char *pattern;
static char *cs_create_cmd(char *csoption, char *pattern)
{
char *cmd;
short search;
@ -750,8 +737,7 @@ char *pattern;
* This piece of code was taken/adapted from nvi. do we need to add
* the BSD license notice?
*/
static int cs_create_connection(i)
int i;
static int cs_create_connection(int i)
{
#ifdef UNIX
int to_cs[2], from_cs[2];
@ -964,8 +950,7 @@ err_closing:
*
* returns TRUE if we jump to a tag or abort, FALSE if not.
*/
static int cs_find(eap)
exarg_T *eap;
static int cs_find(exarg_T *eap)
{
char *opt, *pat;
int i;
@ -1004,13 +989,7 @@ exarg_T *eap;
*
* common code for cscope find, shared by cs_find() and do_cstag()
*/
static int cs_find_common(opt, pat, forceit, verbose, use_ll, cmdline)
char *opt;
char *pat;
int forceit;
int verbose;
int use_ll;
char_u *cmdline;
static int cs_find_common(char *opt, char *pat, int forceit, int verbose, int use_ll, char_u *cmdline)
{
int i;
char *cmd;
@ -1191,8 +1170,7 @@ char_u *cmdline;
*
* print help
*/
static int cs_help(eap)
exarg_T *eap UNUSED;
static int cs_help(exarg_T *eap)
{
cscmd_T *cmdp = cs_cmds;
@ -1227,8 +1205,7 @@ exarg_T *eap UNUSED;
} /* cs_help */
static void clear_csinfo(i)
int i;
static void clear_csinfo(int i)
{
csinfo[i].fname = NULL;
csinfo[i].ppath = NULL;
@ -1249,7 +1226,7 @@ int i;
#ifndef UNIX
static char *GetWin32Error __ARGS((void));
static char * GetWin32Error() {
static char *GetWin32Error(void) {
char *msg = NULL;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
NULL, GetLastError(), 0, (LPSTR)&msg, 0, NULL);
@ -1269,11 +1246,7 @@ static char * GetWin32Error() {
*
* insert a new cscope database filename into the filelist
*/
static int cs_insert_filelist(fname, ppath, flags, sb)
char *fname;
char *ppath;
char *flags;
struct stat *sb UNUSED;
static int cs_insert_filelist(char *fname, char *ppath, char *flags, struct stat *sb)
{
short i, j;
#ifndef UNIX
@ -1425,8 +1398,7 @@ exarg_T *eap;
*
* nuke em
*/
static int cs_kill(eap)
exarg_T *eap UNUSED;
static int cs_kill(exarg_T *eap)
{
char *stok;
short i;
@ -1473,9 +1445,11 @@ exarg_T *eap UNUSED;
*
* Actually kills a specific cscope connection.
*/
static void cs_kill_execute(i, cname)
int i; /* cscope table index */
char *cname; /* cscope database name */
static void
cs_kill_execute (
int i, /* cscope table index */
char *cname /* cscope database name */
)
{
if (p_csverbose) {
msg_clr_eos();
@ -1506,11 +1480,7 @@ char *cname; /* cscope database name */
* would still have to be modified to escape all the special regular expression
* characters to comply with ctags formatting.
*/
static char * cs_make_vim_style_matches(fname, slno, search, tagstr)
char *fname;
char *slno;
char *search;
char *tagstr;
static char *cs_make_vim_style_matches(char *fname, char *slno, char *search, char *tagstr)
{
/* vim style is ctags:
*
@ -1563,11 +1533,7 @@ char *tagstr;
*
* Print: prints the tags
*/
static char * cs_manage_matches(matches, contexts, totmatches, cmd)
char **matches;
char **contexts;
int totmatches;
mcmd_e cmd;
static char *cs_manage_matches(char **matches, char **contexts, int totmatches, mcmd_e cmd)
{
static char **mp = NULL;
static char **cp = NULL;
@ -1626,14 +1592,7 @@ mcmd_e cmd;
*
* parse cscope output
*/
static char * cs_parse_results(cnumber, buf, bufsize, context, linenumber,
search)
int cnumber;
char *buf;
int bufsize;
char **context;
char **linenumber;
char **search;
static char *cs_parse_results(int cnumber, char *buf, int bufsize, char **context, char **linenumber, char **search)
{
int ch;
char *p;
@ -1686,9 +1645,7 @@ char **search;
*
* write cscope find results to file
*/
static void cs_file_results(f, nummatches_a)
FILE *f;
int *nummatches_a;
static void cs_file_results(FILE *f, int *nummatches_a)
{
int i, j;
char *buf;
@ -1741,15 +1698,7 @@ int *nummatches_a;
* into ctags format
* When there are no matches sets "*matches_p" to NULL.
*/
static void cs_fill_results(tagstr, totmatches, nummatches_a, matches_p,
cntxts_p,
matched)
char *tagstr;
int totmatches;
int *nummatches_a;
char ***matches_p;
char ***cntxts_p;
int *matched;
static void cs_fill_results(char *tagstr, int totmatches, int *nummatches_a, char ***matches_p, char ***cntxts_p, int *matched)
{
int i, j;
char *buf;
@ -1819,8 +1768,7 @@ parse_out:
/* get the requested path components */
static char * cs_pathcomponents(path)
char *path;
static char *cs_pathcomponents(char *path)
{
int i;
char *s;
@ -1844,10 +1792,7 @@ char *path;
*
* called from cs_manage_matches()
*/
static void cs_print_tags_priv(matches, cntxts, num_matches)
char **matches;
char **cntxts;
int num_matches;
static void cs_print_tags_priv(char **matches, char **cntxts, int num_matches)
{
char *buf = NULL;
int bufsize = 0; /* Track available bufsize */
@ -1973,8 +1918,7 @@ int num_matches;
*
* read a cscope prompt (basically, skip over the ">> ")
*/
static int cs_read_prompt(i)
int i;
static int cs_read_prompt(int i)
{
int ch;
char *buf = NULL; /* buffer for possible error message from cscope */
@ -2065,9 +2009,7 @@ sig_handler SIGDEFARG(sigarg) {
* Does the actual free'ing for the cs ptr with an optional flag of whether
* or not to free the filename. Called by cs_kill and cs_reset.
*/
static void cs_release_csp(i, freefnpp)
int i;
int freefnpp;
static void cs_release_csp(int i, int freefnpp)
{
/*
* Trying to exit normally (not sure whether it is fit to UNIX cscope
@ -2185,8 +2127,7 @@ int freefnpp;
*
* calls cs_kill on all cscope connections then reinits
*/
static int cs_reset(eap)
exarg_T *eap UNUSED;
static int cs_reset(exarg_T *eap)
{
char **dblist = NULL, **pplist = NULL, **fllist = NULL;
int i;
@ -2252,9 +2193,7 @@ exarg_T *eap UNUSED;
* ships with Solaris 2.6), the output never has the prefix prepended.
* Contrast this with my development system (Digital Unix), which does.
*/
static char * cs_resolve_file(i, name)
int i;
char *name;
static char *cs_resolve_file(int i, char *name)
{
char *fullname;
int len;
@ -2307,8 +2246,7 @@ char *name;
*
* show all cscope connections
*/
static int cs_show(eap)
exarg_T *eap UNUSED;
static int cs_show(exarg_T *eap)
{
short i;
if (cs_cnt_connections() == 0)
@ -2340,7 +2278,7 @@ exarg_T *eap UNUSED;
*
* Only called when VIM exits to quit any cscope sessions.
*/
void cs_end() {
void cs_end(void) {
int i;
for (i = 0; i < csinfo_size; i++)

View File

@ -116,10 +116,7 @@ static char *(main_errors[]) =
};
#ifndef NO_VIM_MAIN /* skip this for unittests */
int
main(argc, argv)
int argc;
char **argv;
int main(int argc, char **argv)
{
char_u *fname = NULL; /* file name from command line */
mparm_T params; /* various parameters passed between
@ -539,9 +536,11 @@ main(argc, argv)
* Also used to handle ":visual" command after ":global": execute Normal mode
* commands, return when entering Ex mode. "noexmode" is TRUE then.
*/
void main_loop(cmdwin, noexmode)
int cmdwin; /* TRUE when working in the command-line window */
int noexmode; /* TRUE when return on entering Ex mode */
void
main_loop (
int cmdwin, /* TRUE when working in the command-line window */
int noexmode /* TRUE when return on entering Ex mode */
)
{
oparg_T oa; /* operator arguments */
int previous_got_int = FALSE; /* "got_int" was TRUE */
@ -748,8 +747,7 @@ void main_loop(cmdwin, noexmode)
/* Exit properly */
void getout(exitval)
int exitval;
void getout(int exitval)
{
buf_T *buf;
win_T *wp;
@ -835,10 +833,12 @@ void getout(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 */
static int
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])) {
def = atoi((char *)&(p[*idx]));
@ -852,7 +852,7 @@ static int get_number_arg(p, idx, def)
/*
* Setup to use the current locale (for ctype() and many other things).
*/
static void init_locale() {
static void init_locale(void) {
setlocale(LC_ALL, "");
# if defined(FEAT_FLOAT) && defined(LC_NUMERIC)
@ -891,8 +891,7 @@ static void init_locale() {
* If the next characters are "ex" we start in Ex mode. If it's followed
* by "im" use improved Ex mode.
*/
static void parse_command_name(parmp)
mparm_T *parmp;
static void parse_command_name(mparm_T *parmp)
{
char_u *initstr;
@ -961,8 +960,7 @@ static bool parse_string(input, val, len)
/*
* Scan the command line arguments.
*/
static void command_line_scan(parmp)
mparm_T *parmp;
static void command_line_scan(mparm_T *parmp)
{
int argc = parmp->argc;
char **argv = parmp->argv;
@ -1459,10 +1457,7 @@ scripterror:
* Many variables are in "params" so that we can pass them to invoked
* functions without a lot of arguments. "argc" and "argv" are also
* copied, so that they can be changed. */
static void init_params(paramp, argc, argv)
mparm_T *paramp;
int argc;
char **argv;
static void init_params(mparm_T *paramp, int argc, char **argv)
{
vim_memset(paramp, 0, sizeof(*paramp));
paramp->argc = argc;
@ -1475,8 +1470,7 @@ static void init_params(paramp, argc, argv)
/*
* Initialize global startuptime file if "--startuptime" passed as an argument.
*/
static void init_startuptime(paramp)
mparm_T *paramp;
static void init_startuptime(mparm_T *paramp)
{
#ifdef STARTUPTIME
int i;
@ -1495,7 +1489,7 @@ static void init_startuptime(paramp)
* Allocate space for the generic buffers (needed for set_init_1() and
* EMSG2()).
*/
static void allocate_generic_buffers()
static void allocate_generic_buffers(void)
{
if ((IObuff = alloc(IOSIZE)) == NULL
|| (NameBuff = alloc(MAXPATHL)) == NULL)
@ -1509,8 +1503,7 @@ static void allocate_generic_buffers()
* (needed for :! to * work). mch_check_win() will also handle the -d or
* -dev argument.
*/
static void check_and_set_isatty(paramp)
mparm_T *paramp;
static void check_and_set_isatty(mparm_T *paramp)
{
paramp->stdout_isatty = (mch_check_win(paramp->argc, paramp->argv) != FAIL);
TIME_MSG("window checked");
@ -1519,8 +1512,7 @@ static void check_and_set_isatty(paramp)
/*
* Get filename from command line, given that there is one.
*/
static char_u* get_fname(parmp)
mparm_T *parmp;
static char_u *get_fname(mparm_T *parmp)
{
#if (!defined(UNIX) && !defined(__EMX__)) || defined(ARCHIE)
/*
@ -1541,8 +1533,7 @@ static char_u* get_fname(parmp)
/*
* Decide about window layout for diff mode after reading vimrc.
*/
static void set_window_layout(paramp)
mparm_T *paramp;
static void set_window_layout(mparm_T *paramp)
{
if (paramp->diff_mode && paramp->window_layout == 0) {
if (diffopt_horizontal())
@ -1556,7 +1547,7 @@ static void set_window_layout(paramp)
* Read all the plugin files.
* Only when compiled with +eval, since most plugins need it.
*/
static void load_plugins()
static void load_plugins(void)
{
if (p_lpl) {
source_runtime((char_u *)"plugin/**/*.vim", TRUE);
@ -1568,8 +1559,7 @@ static void load_plugins()
* "-q errorfile": Load the error file now.
* If the error file can't be read, exit before doing anything else.
*/
static void handle_quickfix(paramp)
mparm_T *paramp;
static void handle_quickfix(mparm_T *paramp)
{
if (paramp->edit_type == EDIT_QF) {
if (paramp->use_ef != NULL)
@ -1588,8 +1578,7 @@ static void handle_quickfix(paramp)
* Need to jump to the tag before executing the '-c command'.
* Makes "vim -c '/return' -t main" work.
*/
static void handle_tag(tagname)
char_u *tagname;
static void handle_tag(char_u *tagname)
{
if (tagname != NULL) {
#if defined(HAS_SWAP_EXISTS_ACTION)
@ -1612,8 +1601,7 @@ static void handle_tag(tagname)
* Print a warning if stdout is not a terminal.
* When starting in Ex mode and commands come from a file, set Silent mode.
*/
static void check_tty(parmp)
mparm_T *parmp;
static void check_tty(mparm_T *parmp)
{
int input_isatty; /* is active input a terminal? */
@ -1637,7 +1625,7 @@ static void check_tty(parmp)
/*
* Read text from stdin.
*/
static void read_stdin() {
static void read_stdin(void) {
int i;
#if defined(HAS_SWAP_EXISTS_ACTION)
@ -1667,8 +1655,7 @@ static void read_stdin() {
* Create the requested number of windows and edit buffers in them.
* Also does recovery if "recoverymode" set.
*/
static void create_windows(parmp)
mparm_T *parmp UNUSED;
static void create_windows(mparm_T *parmp)
{
int dorewind;
int done = 0;
@ -1783,8 +1770,7 @@ static void create_windows(parmp)
* If opened more than one window, start editing files in the other
* windows. make_windows() has already opened the windows.
*/
static void edit_buffers(parmp)
mparm_T *parmp;
static void edit_buffers(mparm_T *parmp)
{
int arg_idx; /* index in argument list */
int i;
@ -1886,8 +1872,7 @@ static void edit_buffers(parmp)
/*
* Execute the commands from --cmd arguments "cmds[cnt]".
*/
static void exe_pre_commands(parmp)
mparm_T *parmp;
static void exe_pre_commands(mparm_T *parmp)
{
char_u **cmds = parmp->pre_commands;
int cnt = parmp->n_pre_commands;
@ -1908,8 +1893,7 @@ static void exe_pre_commands(parmp)
/*
* Execute "+", "-c" and "-S" arguments.
*/
static void exe_commands(parmp)
mparm_T *parmp;
static void exe_commands(mparm_T *parmp)
{
int i;
@ -1945,8 +1929,7 @@ static void exe_commands(parmp)
/*
* Source startup scripts.
*/
static void source_startup_scripts(parmp)
mparm_T *parmp;
static void source_startup_scripts(mparm_T *parmp)
{
int i;
@ -2075,7 +2058,7 @@ static void source_startup_scripts(parmp)
/*
* Setup to start using the GUI. Exit with an error when not available.
*/
static void main_start_gui() {
static void main_start_gui(void) {
mch_errmsg(_(e_nogvim));
mch_errmsg("\n");
mch_exit(2);
@ -2087,9 +2070,11 @@ static void main_start_gui() {
* Get an environment variable, and execute it as Ex commands.
* 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 */
int
process_env (
char_u *env,
int is_viminit /* when TRUE, called for VIMINIT */
)
{
char_u *initstr;
char_u *save_sourcing_name;
@ -2120,8 +2105,7 @@ int process_env(env, is_viminit)
* Used for ".vimrc" and ".exrc".
* Use both stat() and lstat() for extra security.
*/
static int file_owned(fname)
char *fname;
static int file_owned(char *fname)
{
struct stat s;
# ifdef UNIX
@ -2141,9 +2125,11 @@ static int 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 */
static void
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 */
@ -2162,8 +2148,7 @@ static void mainerr(n, str)
mch_exit(1);
}
void mainerr_arg_missing(str)
char_u *str;
void mainerr_arg_missing(char_u *str)
{
mainerr(ME_ARG_MISSING, str);
}
@ -2172,8 +2157,7 @@ void mainerr_arg_missing(str)
/*
* print a message with three spaces prepended and '\n' appended.
*/
static void main_msg(s)
char *s;
static void main_msg(char *s)
{
mch_msg(" ");
mch_msg(s);
@ -2183,7 +2167,7 @@ static void main_msg(s)
/*
* Print messages for "vim -h" or "vim --help" and exit.
*/
static void usage() {
static void usage(void) {
int i;
static char *(use[]) =
{
@ -2272,7 +2256,7 @@ static void usage() {
* When "Quit" selected, exit Vim.
* When "Recover" selected, recover the file.
*/
static void check_swap_exists_action() {
static void check_swap_exists_action(void) {
if (swap_exists_action == SEA_QUIT)
getout(1);
handle_swap_exists(NULL);
@ -2292,8 +2276,7 @@ static struct timeval prev_timeval;
* Save the previous time before doing something that could nest.
* set "*tv_rel" to the time elapsed so far.
*/
void time_push(tv_rel, tv_start)
void *tv_rel, *tv_start;
void time_push(void *tv_rel, void *tv_start)
{
*((struct timeval *)tv_rel) = prev_timeval;
gettimeofday(&prev_timeval, NULL);
@ -2314,8 +2297,10 @@ void time_push(tv_rel, tv_start)
* Note: The arguments are (void *) to avoid trouble with systems that don't
* have struct timeval.
*/
void time_pop(tp)
void *tp; /* actually (struct timeval *) */
void
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;
@ -2325,9 +2310,7 @@ void time_pop(tp)
}
}
static void time_diff(then, now)
struct timeval *then;
struct timeval *now;
static void time_diff(struct timeval *then, struct timeval *now)
{
long usec;
long msec;
@ -2338,10 +2321,12 @@ static void time_diff(then, now)
fprintf(time_fd, "%03ld.%03ld", msec, usec >= 0 ? usec : usec + 1000L);
}
void time_msg(mesg, tv_start)
char *mesg;
void *tv_start; /* only for do_source: start time; actually
void
time_msg (
char *mesg,
void *tv_start /* only for do_source: start time; actually
(struct timeval *) */
)
{
static struct timeval start;
struct timeval now;

View File

@ -38,8 +38,7 @@ static void write_one_filemark __ARGS((FILE *fp, xfmark_T *fm, int c1, int c2));
* Set named mark "c" at current cursor position.
* Returns OK on success, FAIL if bad name given.
*/
int setmark(c)
int c;
int setmark(int c)
{
return setmark_pos(c, &curwin->w_cursor, curbuf->b_fnum);
}
@ -49,10 +48,7 @@ int c;
* When "c" is upper case use file "fnum".
* Returns OK on success, FAIL if bad name given.
*/
int setmark_pos(c, pos, fnum)
int c;
pos_T *pos;
int fnum;
int setmark_pos(int c, pos_T *pos, int fnum)
{
int i;
@ -120,7 +116,7 @@ int fnum;
* Set the previous context mark to the current position and add it to the
* jump list.
*/
void setpcmark() {
void setpcmark(void) {
int i;
xfmark_T *fm;
#ifdef JUMPLIST_ROTATE
@ -172,7 +168,7 @@ void setpcmark() {
* context will only be changed if the cursor moved to a different line.
* If pcmark was deleted (with "dG") the previous mark is restored.
*/
void checkpcmark() {
void checkpcmark(void) {
if (curwin->w_prev_pcmark.lnum != 0
&& (equalpos(curwin->w_pcmark, curwin->w_cursor)
|| curwin->w_pcmark.lnum == 0)) {
@ -184,8 +180,7 @@ void checkpcmark() {
/*
* move "count" positions in the jump list (count may be negative)
*/
pos_T * movemark(count)
int count;
pos_T *movemark(int count)
{
pos_T *pos;
xfmark_T *jmp;
@ -238,8 +233,7 @@ int count;
/*
* Move "count" positions in the changelist (count may be negative).
*/
pos_T * movechangelist(count)
int count;
pos_T *movechangelist(int count)
{
int n;
@ -272,26 +266,17 @@ int count;
* - NULL if there is no mark called 'c'.
* - -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;
pos_T *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;
pos_T *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;
pos_T *getmark_buf_fnum(buf_T *buf, int c, int changefile, int *fnum)
{
pos_T *posp;
pos_T *startp, *endp;
@ -404,10 +389,12 @@ int *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;
pos_T *
getnextmark (
pos_T *startpos, /* where to start */
int dir, /* direction for search */
int begin_line
)
{
int i;
pos_T *result = NULL;
@ -446,8 +433,7 @@ int begin_line;
* This is used for marks obtained from the .viminfo file. It's postponed
* until the mark is used to avoid a long startup delay.
*/
static void fname2fnum(fm)
xfmark_T *fm;
static void fname2fnum(xfmark_T *fm)
{
char_u *p;
@ -483,8 +469,7 @@ xfmark_T *fm;
* May replace the name with an fnum.
* Used for marks that come from the .viminfo file.
*/
void fmarks_check_names(buf)
buf_T *buf;
void fmarks_check_names(buf_T *buf)
{
char_u *name;
int i;
@ -509,10 +494,7 @@ buf_T *buf;
vim_free(name);
}
static void fmarks_check_one(fm, name, buf)
xfmark_T *fm;
char_u *name;
buf_T *buf;
static void fmarks_check_one(xfmark_T *fm, char_u *name, buf_T *buf)
{
if (fm->fmark.fnum == 0
&& fm->fname != NULL
@ -527,8 +509,7 @@ buf_T *buf;
* Check a if a position from a mark is valid.
* Give and error message and return FAIL if not.
*/
int check_mark(pos)
pos_T *pos;
int check_mark(pos_T *pos)
{
if (pos == NULL) {
EMSG(_(e_umark));
@ -553,8 +534,7 @@ pos_T *pos;
*
* Used mainly when trashing the entire buffer during ":e" type commands
*/
void clrallmarks(buf)
buf_T *buf;
void clrallmarks(buf_T *buf)
{
static int i = -1;
@ -581,9 +561,7 @@ buf_T *buf;
* When it's in the current buffer, return the text at the mark.
* Returns an allocated string.
*/
char_u * fm_getname(fmark, lead_len)
fmark_T *fmark;
int lead_len;
char_u *fm_getname(fmark_T *fmark, int lead_len)
{
if (fmark->fnum == curbuf->b_fnum) /* current buffer */
return mark_line(&(fmark->mark), lead_len);
@ -594,9 +572,7 @@ int lead_len;
* Return the line at mark "mp". Truncate to fit in window.
* The returned string has been allocated.
*/
static char_u * mark_line(mp, lead_len)
pos_T *mp;
int lead_len;
static char_u *mark_line(pos_T *mp, int lead_len)
{
char_u *s, *p;
int len;
@ -620,8 +596,7 @@ int lead_len;
/*
* print the marks
*/
void do_marks(eap)
exarg_T *eap;
void do_marks(exarg_T *eap)
{
char_u *arg = eap->arg;
int i;
@ -656,12 +631,14 @@ exarg_T *eap;
show_one_mark(-1, arg, NULL, NULL, FALSE);
}
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 */
static void
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;
@ -706,8 +683,7 @@ int current; /* in current file */
/*
* ":delmarks[!] [marks]"
*/
void ex_delmarks(eap)
exarg_T *eap;
void ex_delmarks(exarg_T *eap)
{
char_u *p;
int from, to;
@ -778,8 +754,7 @@ exarg_T *eap;
/*
* print the jumplist
*/
void ex_jumps(eap)
exarg_T *eap UNUSED;
void ex_jumps(exarg_T *eap)
{
int i;
char_u *name;
@ -822,8 +797,7 @@ exarg_T *eap UNUSED;
/*
* print the changelist
*/
void ex_changes(eap)
exarg_T *eap UNUSED;
void ex_changes(exarg_T *eap)
{
int i;
char_u *name;
@ -896,11 +870,7 @@ exarg_T *eap UNUSED;
* Example: Insert two lines below 55: mark_adjust(56, MAXLNUM, 2, 0);
* 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;
void mark_adjust(linenr_T line1, linenr_T line2, long amount, long amount_after)
{
int i;
int fnum = curbuf->b_fnum;
@ -1043,11 +1013,7 @@ long amount_after;
* "lnum_amount" to the line number and add "col_amount" to the column
* position.
*/
void mark_col_adjust(lnum, mincol, lnum_amount, col_amount)
linenr_T lnum;
colnr_T mincol;
long lnum_amount;
long col_amount;
void mark_col_adjust(linenr_T lnum, colnr_T mincol, long lnum_amount, long col_amount)
{
int i;
int fnum = curbuf->b_fnum;
@ -1118,7 +1084,7 @@ long col_amount;
* When deleting lines, this may create duplicate marks in the
* jumplist. They will be removed here for the current window.
*/
static void cleanup_jumplist() {
static void cleanup_jumplist(void) {
int i;
int from, to;
@ -1146,9 +1112,7 @@ static void cleanup_jumplist() {
/*
* Copy the jumplist from window "from" to window "to".
*/
void copy_jumplist(from, to)
win_T *from;
win_T *to;
void copy_jumplist(win_T *from, win_T *to)
{
int i;
@ -1164,8 +1128,7 @@ win_T *to;
/*
* Free items in the jumplist of window "wp".
*/
void free_jumplist(wp)
win_T *wp;
void free_jumplist(win_T *wp)
{
int i;
@ -1173,15 +1136,14 @@ win_T *wp;
vim_free(wp->w_jumplist[i].fname);
}
void set_last_cursor(win)
win_T *win;
void set_last_cursor(win_T *win)
{
if (win->w_buffer != NULL)
win->w_buffer->b_last_cursor = win->w_cursor;
}
#if defined(EXITFREE) || defined(PROTO)
void free_all_marks() {
void free_all_marks(void) {
int i;
for (i = 0; i < NMARKS + EXTRA_MARKS; i++)
@ -1191,9 +1153,7 @@ void free_all_marks() {
#endif
int read_viminfo_filemark(virp, force)
vir_T *virp;
int force;
int read_viminfo_filemark(vir_T *virp, int force)
{
char_u *str;
xfmark_T *fm;
@ -1239,8 +1199,7 @@ int force;
return vim_fgets(virp->vir_line, LSIZE, virp->vir_fd);
}
void write_viminfo_filemarks(fp)
FILE *fp;
void write_viminfo_filemarks(FILE *fp)
{
int i;
char_u *name;
@ -1295,11 +1254,7 @@ FILE *fp;
}
}
static void write_one_filemark(fp, fm, c1, c2)
FILE *fp;
xfmark_T *fm;
int c1;
int c2;
static void write_one_filemark(FILE *fp, xfmark_T *fm, int c1, int c2)
{
char_u *name;
@ -1323,8 +1278,7 @@ int c2;
/*
* Return TRUE if "name" is on removable media (depending on 'viminfo').
*/
int removable(name)
char_u *name;
int removable(char_u *name)
{
char_u *p;
char_u part[51];
@ -1354,8 +1308,7 @@ static void write_one_mark __ARGS((FILE *fp_out, int c, pos_T *pos));
* Write all the named marks for all buffers.
* Return the number of buffers for which marks have been written.
*/
int write_viminfo_marks(fp_out)
FILE *fp_out;
int write_viminfo_marks(FILE *fp_out)
{
int count;
buf_T *buf;
@ -1409,10 +1362,7 @@ FILE *fp_out;
return count;
}
static void write_one_mark(fp_out, c, pos)
FILE *fp_out;
int c;
pos_T *pos;
static void 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);
@ -1424,12 +1374,7 @@ pos_T *pos;
* fp_out == NULL && (flags & VIF_WANT_MARKS): read marks for curbuf only
* 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;
void copy_viminfo_marks(vir_T *virp, FILE *fp_out, int count, int eof, int flags)
{
char_u *line = virp->vir_line;
buf_T *buf;

File diff suppressed because it is too large Load Diff

View File

@ -109,9 +109,7 @@ static int mf_hash_grow __ARGS((mf_hashtab_T *));
*
* return value: identifier for this memory block file.
*/
memfile_T * mf_open(fname, flags)
char_u *fname;
int flags;
memfile_T *mf_open(char_u *fname, int flags)
{
memfile_T *mfp;
off_t size;
@ -203,9 +201,7 @@ int flags;
*
* return value: FAIL if file could not be opened, OK otherwise
*/
int mf_open_file(mfp, fname)
memfile_T *mfp;
char_u *fname;
int 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 */
@ -219,9 +215,7 @@ char_u *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;
void mf_close(memfile_T *mfp, int del_file)
{
bhdr_T *hp, *nextp;
@ -251,9 +245,11 @@ int 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? */
void
mf_close_file (
buf_T *buf,
int getlines /* get all lines into memory? */
)
{
memfile_T *mfp;
linenr_T lnum;
@ -288,9 +284,7 @@ int getlines; /* get all lines into memory? */
* Set new size for a memfile. Used when block 0 of a swapfile has been read
* and the size it indicates differs from what was guessed.
*/
void mf_new_page_size(mfp, new_size)
memfile_T *mfp;
unsigned new_size;
void 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. */
@ -303,10 +297,7 @@ unsigned 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;
bhdr_T *mf_new(memfile_T *mfp, int negative, int page_count)
{
bhdr_T *hp; /* new bhdr_T */
bhdr_T *freep; /* first block in free list */
@ -384,10 +375,7 @@ int 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;
bhdr_T *mf_get(memfile_T *mfp, blocknr_T nr, int page_count)
{
bhdr_T *hp;
/* doesn't exist */
@ -440,11 +428,7 @@ int 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;
void mf_put(memfile_T *mfp, bhdr_T *hp, int dirty, int infile)
{
int flags;
@ -465,9 +449,7 @@ int 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;
void 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 */
@ -502,9 +484,7 @@ static unsigned long fdtofh(int filedescriptor) {
*
* Return FAIL for failure, OK otherwise
*/
int mf_sync(mfp, flags)
memfile_T *mfp;
int flags;
int mf_sync(memfile_T *mfp, int flags)
{
int status;
bhdr_T *hp;
@ -603,8 +583,7 @@ int flags;
* the dirty flag. These are blocks that need to be written to a newly
* created swapfile.
*/
void mf_set_dirty(mfp)
memfile_T *mfp;
void mf_set_dirty(memfile_T *mfp)
{
bhdr_T *hp;
@ -617,9 +596,7 @@ memfile_T *mfp;
/*
* insert block *hp in front of hashlist of memfile *mfp
*/
static void mf_ins_hash(mfp, hp)
memfile_T *mfp;
bhdr_T *hp;
static void mf_ins_hash(memfile_T *mfp, bhdr_T *hp)
{
mf_hash_add_item(&mfp->mf_hash, (mf_hashitem_T *)hp);
}
@ -627,9 +604,7 @@ bhdr_T *hp;
/*
* remove block *hp from hashlist of memfile list *mfp
*/
static void mf_rem_hash(mfp, hp)
memfile_T *mfp;
bhdr_T *hp;
static void mf_rem_hash(memfile_T *mfp, bhdr_T *hp)
{
mf_hash_rem_item(&mfp->mf_hash, (mf_hashitem_T *)hp);
}
@ -637,9 +612,7 @@ bhdr_T *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;
static bhdr_T *mf_find_hash(memfile_T *mfp, blocknr_T nr)
{
return (bhdr_T *)mf_hash_find(&mfp->mf_hash, nr);
}
@ -647,9 +620,7 @@ blocknr_T 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;
static void mf_ins_used(memfile_T *mfp, bhdr_T *hp)
{
hp->bh_next = mfp->mf_used_first;
mfp->mf_used_first = hp;
@ -665,9 +636,7 @@ bhdr_T *hp;
/*
* remove block *hp from used list of memfile *mfp
*/
static void mf_rem_used(mfp, hp)
memfile_T *mfp;
bhdr_T *hp;
static void 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;
@ -688,9 +657,7 @@ bhdr_T *hp;
* Return the block header to the caller, including the memory block, so
* it can be re-used. Make sure the page_count is right.
*/
static bhdr_T * mf_release(mfp, page_count)
memfile_T *mfp;
int page_count;
static bhdr_T *mf_release(memfile_T *mfp, int page_count)
{
bhdr_T *hp;
int need_release;
@ -768,7 +735,7 @@ int page_count;
*
* return TRUE if any memory was released
*/
int mf_release_all() {
int mf_release_all(void) {
buf_T *buf;
memfile_T *mfp;
bhdr_T *hp;
@ -804,9 +771,7 @@ int 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;
static bhdr_T *mf_alloc_bhdr(memfile_T *mfp, int page_count)
{
bhdr_T *hp;
@ -824,8 +789,7 @@ int page_count;
/*
* Free a block header and the block of memory for it
*/
static void mf_free_bhdr(hp)
bhdr_T *hp;
static void mf_free_bhdr(bhdr_T *hp)
{
vim_free(hp->bh_data);
vim_free(hp);
@ -834,9 +798,7 @@ bhdr_T *hp;
/*
* insert entry *hp in the free list
*/
static void mf_ins_free(mfp, hp)
memfile_T *mfp;
bhdr_T *hp;
static void mf_ins_free(memfile_T *mfp, bhdr_T *hp)
{
hp->bh_next = mfp->mf_free_first;
mfp->mf_free_first = hp;
@ -846,8 +808,7 @@ bhdr_T *hp;
* remove the first entry from the free list and return a pointer to it
* Note: caller must check that mfp->mf_free_first is not NULL!
*/
static bhdr_T * mf_rem_free(mfp)
memfile_T *mfp;
static bhdr_T *mf_rem_free(memfile_T *mfp)
{
bhdr_T *hp;
@ -861,9 +822,7 @@ memfile_T *mfp;
*
* Return FAIL for failure, OK otherwise
*/
static int mf_read(mfp, hp)
memfile_T *mfp;
bhdr_T *hp;
static int mf_read(memfile_T *mfp, bhdr_T *hp)
{
off_t offset;
unsigned page_size;
@ -896,9 +855,7 @@ bhdr_T *hp;
*
* Return FAIL for failure, OK otherwise
*/
static int mf_write(mfp, hp)
memfile_T *mfp;
bhdr_T *hp;
static int mf_write(memfile_T *mfp, bhdr_T *hp)
{
off_t offset; /* offset in the file */
blocknr_T nr; /* block nr which is being written */
@ -969,11 +926,7 @@ bhdr_T *hp;
* Takes care of encryption.
* 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;
static int mf_write_block(memfile_T *mfp, bhdr_T *hp, off_t offset, unsigned size)
{
char_u *data = hp->bh_data;
int result = OK;
@ -999,9 +952,7 @@ unsigned size;
*
* Return FAIL for failure, OK otherwise
*/
static int mf_trans_add(mfp, hp)
memfile_T *mfp;
bhdr_T *hp;
static int mf_trans_add(memfile_T *mfp, bhdr_T *hp)
{
bhdr_T *freep;
blocknr_T new_bnum;
@ -1057,9 +1008,7 @@ bhdr_T *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;
blocknr_T mf_trans_del(memfile_T *mfp, blocknr_T old_nr)
{
NR_TRANS *np;
blocknr_T new_bnum;
@ -1085,8 +1034,7 @@ blocknr_T old_nr;
* Only called when creating or renaming the swapfile. Either way it's a new
* name so we must work out the full path name.
*/
void mf_set_ffname(mfp)
memfile_T *mfp;
void mf_set_ffname(memfile_T *mfp)
{
mfp->mf_ffname = FullName_save(mfp->mf_fname, FALSE);
}
@ -1095,8 +1043,7 @@ memfile_T *mfp;
* Make the name of the file used for the memfile a full path.
* Used before doing a :cd
*/
void mf_fullname(mfp)
memfile_T *mfp;
void mf_fullname(memfile_T *mfp)
{
if (mfp != NULL && mfp->mf_fname != NULL && mfp->mf_ffname != NULL) {
vim_free(mfp->mf_fname);
@ -1108,8 +1055,7 @@ memfile_T *mfp;
/*
* return TRUE if there are any translations pending for 'mfp'
*/
int mf_need_trans(mfp)
memfile_T *mfp;
int mf_need_trans(memfile_T *mfp)
{
return mfp->mf_fname != NULL && mfp->mf_neg_count > 0;
}
@ -1119,10 +1065,12 @@ memfile_T *mfp;
* The "fname" must be in allocated memory, and is consumed (also when an
* error occurs).
*/
static void mf_do_open(mfp, fname, flags)
memfile_T *mfp;
char_u *fname;
int flags; /* flags for open() */
static void
mf_do_open (
memfile_T *mfp,
char_u *fname,
int flags /* flags for open() */
)
{
#ifdef HAVE_LSTAT
struct stat sb;
@ -1191,8 +1139,7 @@ int flags; /* flags for open() */
/*
* Initialize an empty hash table.
*/
static void mf_hash_init(mht)
mf_hashtab_T *mht;
static void mf_hash_init(mf_hashtab_T *mht)
{
vim_memset(mht, 0, sizeof(mf_hashtab_T));
mht->mht_buckets = mht->mht_small_buckets;
@ -1203,8 +1150,7 @@ mf_hashtab_T *mht;
* Free the array of a hash table. Does not free the items it contains!
* The hash table must not be used again without another mf_hash_init() call.
*/
static void mf_hash_free(mht)
mf_hashtab_T *mht;
static void mf_hash_free(mf_hashtab_T *mht)
{
if (mht->mht_buckets != mht->mht_small_buckets)
vim_free(mht->mht_buckets);
@ -1213,8 +1159,7 @@ mf_hashtab_T *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;
static void mf_hash_free_all(mf_hashtab_T *mht)
{
long_u idx;
mf_hashitem_T *mhi;
@ -1233,9 +1178,7 @@ mf_hashtab_T *mht;
* Find "key" in hashtable "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;
static mf_hashitem_T *mf_hash_find(mf_hashtab_T *mht, blocknr_T key)
{
mf_hashitem_T *mhi;
@ -1250,9 +1193,7 @@ blocknr_T key;
* Add item "mhi" to hashtable "mht".
* "mhi" must not be NULL.
*/
static void mf_hash_add_item(mht, mhi)
mf_hashtab_T *mht;
mf_hashitem_T *mhi;
static void mf_hash_add_item(mf_hashtab_T *mht, mf_hashitem_T *mhi)
{
long_u idx;
@ -1282,9 +1223,7 @@ mf_hashitem_T *mhi;
* Remove item "mhi" from hashtable "mht".
* "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;
static void 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;
@ -1305,8 +1244,7 @@ mf_hashitem_T *mhi;
* rehash items.
* Returns FAIL when out of memory.
*/
static int mf_hash_grow(mht)
mf_hashtab_T *mht;
static int mf_hash_grow(mf_hashtab_T *mht)
{
long_u i, j;
int shift;

View File

@ -255,8 +255,7 @@ static void ml_updatechunk __ARGS((buf_T *buf, long line, long len, int updtype)
*
* Return FAIL for failure, OK otherwise.
*/
int ml_open(buf)
buf_T *buf;
int ml_open(buf_T *buf)
{
memfile_T *mfp;
bhdr_T *hp = NULL;
@ -389,9 +388,7 @@ error:
/*
* Prepare encryption for "buf" with block 0 "b0p".
*/
static void ml_set_b0_crypt(buf, b0p)
buf_T *buf;
ZERO_BL *b0p;
static void ml_set_b0_crypt(buf_T *buf, ZERO_BL *b0p)
{
if (*buf->b_p_key == NUL)
b0p->b0_id[1] = BLOCK0_ID1;
@ -415,10 +412,7 @@ ZERO_BL *b0p;
* "old_cm" is the previous 'cryptmethod'. It is equal to the current
* 'cryptmethod' when 'key' is changed.
*/
void ml_set_crypt_key(buf, old_key, old_cm)
buf_T *buf;
char_u *old_key;
int old_cm;
void ml_set_crypt_key(buf_T *buf, char_u *old_key, int old_cm)
{
memfile_T *mfp = buf->b_ml.ml_mfp;
bhdr_T *hp;
@ -533,8 +527,7 @@ int old_cm;
* ml_setname() is called when the file name of "buf" has been changed.
* It may rename the swap file.
*/
void ml_setname(buf)
buf_T *buf;
void ml_setname(buf_T *buf)
{
int success = FALSE;
memfile_T *mfp;
@ -615,7 +608,7 @@ buf_T *buf;
* been modified.
* Used when 'updatecount' changes from zero to non-zero.
*/
void ml_open_files() {
void ml_open_files(void) {
buf_T *buf;
for (buf = firstbuf; buf != NULL; buf = buf->b_next)
@ -628,8 +621,7 @@ void ml_open_files() {
* If we are unable to find a file name, mf_fname will be NULL
* and the memfile will be in memory only (no recovery possible).
*/
void ml_open_file(buf)
buf_T *buf;
void ml_open_file(buf_T *buf)
{
memfile_T *mfp;
char_u *fname;
@ -696,8 +688,10 @@ buf_T *buf;
* If still need to create a swap file, and starting to edit a not-readonly
* file, or reading into an existing buffer, create a swap file now.
*/
void check_need_swap(newfile)
int newfile; /* reading file into new buffer */
void
check_need_swap (
int newfile /* reading file into new buffer */
)
{
if (curbuf->b_may_swap && (!curbuf->b_p_ro || !newfile))
ml_open_file(curbuf);
@ -707,9 +701,7 @@ int newfile; /* reading file into new buffer */
* Close memline for buffer 'buf'.
* If 'del_file' is TRUE, delete the swap file
*/
void ml_close(buf, del_file)
buf_T *buf;
int del_file;
void ml_close(buf_T *buf, int del_file)
{
if (buf->b_ml.ml_mfp == NULL) /* not open */
return;
@ -732,8 +724,7 @@ int del_file;
* When 'del_file' is TRUE, delete the memfiles.
* But don't delete files that were ":preserve"d when we are POSIX compatible.
*/
void ml_close_all(del_file)
int del_file;
void ml_close_all(int del_file)
{
buf_T *buf;
@ -750,7 +741,7 @@ int del_file;
* Close all memfiles for not modified buffers.
* Only use just before exiting!
*/
void ml_close_notmod() {
void ml_close_notmod(void) {
buf_T *buf;
for (buf = firstbuf; buf != NULL; buf = buf->b_next)
@ -762,8 +753,7 @@ void ml_close_notmod() {
* Update the timestamp in the .swp file.
* Used when the file has been written.
*/
void ml_timestamp(buf)
buf_T *buf;
void ml_timestamp(buf_T *buf)
{
ml_upd_block0(buf, UB_FNAME);
}
@ -771,8 +761,7 @@ buf_T *buf;
/*
* Return FAIL when the ID of "b0p" is wrong.
*/
static int ml_check_b0_id(b0p)
ZERO_BL *b0p;
static int ml_check_b0_id(ZERO_BL *b0p)
{
if (b0p->b0_id[0] != BLOCK0_ID0
|| (b0p->b0_id[1] != BLOCK0_ID1
@ -786,9 +775,7 @@ ZERO_BL *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;
static void ml_upd_block0(buf_T *buf, upd_block0_T what)
{
memfile_T *mfp;
bhdr_T *hp;
@ -816,9 +803,7 @@ upd_block0_T what;
* Also set buf->b_mtime.
* Don't use NameBuff[]!!!
*/
static void set_b0_fname(b0p, buf)
ZERO_BL *b0p;
buf_T *buf;
static void set_b0_fname(ZERO_BL *b0p, buf_T *buf)
{
struct stat st;
@ -878,9 +863,7 @@ buf_T *buf;
* This is fail safe: if we are not sure the directories are equal the flag is
* not set.
*/
static void set_b0_dir_flag(b0p, buf)
ZERO_BL *b0p;
buf_T *buf;
static void 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;
@ -891,9 +874,7 @@ buf_T *buf;
/*
* When there is room, add the 'fileencoding' to block zero.
*/
static void add_b0_fenc(b0p, buf)
ZERO_BL *b0p;
buf_T *buf;
static void add_b0_fenc(ZERO_BL *b0p, buf_T *buf)
{
int n;
int size = B0_FNAME_SIZE_NOCRYPT;
@ -919,7 +900,7 @@ buf_T *buf;
/*
* Try to recover curbuf from the .swp file.
*/
void ml_recover() {
void ml_recover(void) {
buf_T *buf = NULL;
memfile_T *mfp = NULL;
char_u *fname;
@ -1490,11 +1471,13 @@ theend:
* - list the swap files when recovering
* - 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 */
int
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]);
@ -1694,9 +1677,7 @@ char_u **fname_out; /* result when "nr" > 0 */
* Append the full path to name with path separators made into percent
* signs, to dir. An unnamed buffer is handled as "" (<currentdir>/"")
*/
static char_u * make_percent_swname(dir, name)
char_u *dir;
char_u *name;
static char_u *make_percent_swname(char_u *dir, char_u *name)
{
char_u *d, *s, *f;
@ -1727,8 +1708,7 @@ static int process_still_running;
* Give information about an existing swap file.
* Returns timestamp (0 when unknown).
*/
static time_t swapfile_info(fname)
char_u *fname;
static time_t swapfile_info(char_u *fname)
{
struct stat st;
int fd;
@ -1817,10 +1797,7 @@ char_u *fname;
return x;
}
static int recov_file_names(names, path, prepend_dot)
char_u **names;
char_u *path;
int prepend_dot;
static int recov_file_names(char_u **names, char_u *path, int prepend_dot)
{
int num_names;
@ -1909,9 +1886,7 @@ end:
* If 'check_char' is TRUE, stop syncing when character becomes available, but
* always sync at least one block.
*/
void ml_sync_all(check_file, check_char)
int check_file;
int check_char;
void ml_sync_all(int check_file, int check_char)
{
buf_T *buf;
struct stat st;
@ -1956,9 +1931,7 @@ int check_char;
*
* when message is TRUE the success of preserving is reported
*/
void ml_preserve(buf, message)
buf_T *buf;
int message;
void ml_preserve(buf_T *buf, int message)
{
bhdr_T *hp;
linenr_T lnum;
@ -2036,8 +2009,7 @@ theend:
* On failure an error message is given and IObuff is returned (to avoid
* having to check for error everywhere).
*/
char_u * ml_get(lnum)
linenr_T lnum;
char_u *ml_get(linenr_T lnum)
{
return ml_get_buf(curbuf, lnum, FALSE);
}
@ -2045,8 +2017,7 @@ linenr_T lnum;
/*
* Return pointer to position "pos".
*/
char_u * ml_get_pos(pos)
pos_T *pos;
char_u *ml_get_pos(pos_T *pos)
{
return ml_get_buf(curbuf, pos->lnum, FALSE) + pos->col;
}
@ -2054,14 +2025,14 @@ pos_T *pos;
/*
* Return pointer to cursor line.
*/
char_u * ml_get_curline() {
char_u *ml_get_curline(void) {
return ml_get_buf(curbuf, curwin->w_cursor.lnum, FALSE);
}
/*
* Return pointer to cursor position.
*/
char_u * ml_get_cursor() {
char_u *ml_get_cursor(void) {
return ml_get_buf(curbuf, curwin->w_cursor.lnum, FALSE) +
curwin->w_cursor.col;
}
@ -2072,10 +2043,12 @@ char_u * ml_get_cursor() {
* "will_change": if TRUE mark the buffer dirty (chars in the line will be
* changed)
*/
char_u * ml_get_buf(buf, lnum, will_change)
buf_T *buf;
linenr_T lnum;
int will_change; /* line will be changed */
char_u *
ml_get_buf (
buf_T *buf,
linenr_T lnum,
int will_change /* line will be changed */
)
{
bhdr_T *hp;
DATA_BL *dp;
@ -2143,7 +2116,7 @@ errorret:
* Check if a line that was just obtained by a call to ml_get
* is in allocated memory.
*/
int ml_line_alloced() {
int ml_line_alloced(void) {
return curbuf->b_ml.ml_flags & ML_LINE_DIRTY;
}
@ -2159,11 +2132,13 @@ int 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 */
int
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)
@ -2178,12 +2153,14 @@ int newfile; /* flag, see above */
* Like ml_append() but for an arbitrary buffer. The buffer must already have
* 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 */
int
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;
@ -2193,13 +2170,15 @@ int newfile; /* flag, see above */
return ml_append_int(buf, lnum, line, len, newfile, FALSE);
}
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 */
static int
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 */
@ -2656,10 +2635,7 @@ int mark; /* mark the new line */
*
* return FAIL for failure, OK otherwise
*/
int ml_replace(lnum, line, copy)
linenr_T lnum;
char_u *line;
int copy;
int ml_replace(linenr_T lnum, char_u *line, int copy)
{
if (line == NULL) /* just checking... */
return FAIL;
@ -2689,18 +2665,13 @@ int copy;
*
* return FAIL for failure, OK otherwise
*/
int ml_delete(lnum, message)
linenr_T lnum;
int message;
int 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;
static int ml_delete_int(buf_T *buf, linenr_T lnum, int message)
{
bhdr_T *hp;
memfile_T *mfp;
@ -2842,8 +2813,7 @@ int message;
/*
* set the B_MARKED flag for line 'lnum'
*/
void ml_setmarked(lnum)
linenr_T lnum;
void ml_setmarked(linenr_T lnum)
{
bhdr_T *hp;
DATA_BL *dp;
@ -2871,7 +2841,7 @@ linenr_T lnum;
/*
* find the first line with its B_MARKED flag set
*/
linenr_T ml_firstmarked() {
linenr_T ml_firstmarked(void) {
bhdr_T *hp;
DATA_BL *dp;
linenr_T lnum;
@ -2911,7 +2881,7 @@ linenr_T ml_firstmarked() {
/*
* clear all DB_MARKED flags
*/
void ml_clearmarked() {
void ml_clearmarked(void) {
bhdr_T *hp;
DATA_BL *dp;
linenr_T lnum;
@ -2949,8 +2919,7 @@ void ml_clearmarked() {
/*
* flush ml_line if necessary
*/
static void ml_flush_line(buf)
buf_T *buf;
static void ml_flush_line(buf_T *buf)
{
bhdr_T *hp;
DATA_BL *dp;
@ -3046,10 +3015,7 @@ buf_T *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;
static bhdr_T *ml_new_data(memfile_T *mfp, int negative, int page_count)
{
bhdr_T *hp;
DATA_BL *dp;
@ -3069,8 +3035,7 @@ int page_count;
/*
* create a new, empty, pointer block
*/
static bhdr_T * ml_new_ptr(mfp)
memfile_T *mfp;
static bhdr_T *ml_new_ptr(memfile_T *mfp)
{
bhdr_T *hp;
PTR_BL *pp;
@ -3102,10 +3067,7 @@ memfile_T *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;
static bhdr_T *ml_find_line(buf_T *buf, linenr_T lnum, int action)
{
DATA_BL *dp;
PTR_BL *pp;
@ -3286,8 +3248,7 @@ error_noblock:
*
* return -1 for failure, number of the new entry otherwise
*/
static int ml_add_stack(buf)
buf_T *buf;
static int ml_add_stack(buf_T *buf)
{
int top;
infoptr_T *newstack;
@ -3323,9 +3284,7 @@ buf_T *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;
static void ml_lineadd(buf_T *buf, int count)
{
int idx;
infoptr_T *ip;
@ -3357,9 +3316,7 @@ int count;
* If it worked returns OK and the resolved link in "buf[MAXPATHL]".
* Otherwise returns FAIL.
*/
int resolve_symlink(fname, buf)
char_u *fname;
char_u *buf;
int resolve_symlink(char_u *fname, char_u *buf)
{
char_u tmp[MAXPATHL];
int ret;
@ -3427,11 +3384,7 @@ char_u *buf;
* Make swap file name out of the file name and a directory name.
* 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;
char_u *makeswapname(char_u *fname, char_u *ffname, buf_T *buf, char_u *dir_name)
{
char_u *r, *s;
char_u *fname_res = fname;
@ -3494,9 +3447,11 @@ char_u *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 */
char_u *
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;
@ -3534,9 +3489,11 @@ static void attention_message __ARGS((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 */
static void
attention_message (
buf_T *buf, /* buffer being edited */
char_u *fname /* swap file name */
)
{
struct stat st;
time_t x, sx;
@ -3591,9 +3548,7 @@ static int do_swapexists __ARGS((buf_T *buf, char_u *fname));
* 5: quit
* 6: abort
*/
static int do_swapexists(buf, fname)
buf_T *buf;
char_u *fname;
static int do_swapexists(buf_T *buf, char_u *fname)
{
set_vim_var_string(VV_SWAPNAME, fname, -1);
set_vim_var_string(VV_SWAPCHOICE, NULL, -1);
@ -3629,10 +3584,12 @@ char_u *fname;
* not being able to open the swap or undo file
* 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 */
static char_u *
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;
@ -4030,8 +3987,7 @@ char_u *old_fname; /* don't give warning for this file name */
return fname;
}
static int b0_magic_wrong(b0p)
ZERO_BL *b0p;
static int b0_magic_wrong(ZERO_BL *b0p)
{
return b0p->b0_magic_long != (long)B0_MAGIC_LONG
|| b0p->b0_magic_int != (int)B0_MAGIC_INT
@ -4089,10 +4045,12 @@ ZERO_BL *b0p;
* versions.
*/
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;
static int
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 */
@ -4141,9 +4099,7 @@ long ino_block0;
* Move a long integer into a four byte character array.
* Used for machine independency in block zero.
*/
static void long_to_char(n, s)
long n;
char_u *s;
static void long_to_char(long n, char_u *s)
{
s[0] = (char_u)(n & 0xff);
n = (unsigned)n >> 8;
@ -4154,8 +4110,7 @@ char_u *s;
s[3] = (char_u)(n & 0xff);
}
static long char_to_long(s)
char_u *s;
static long char_to_long(char_u *s)
{
long retval;
@ -4176,8 +4131,7 @@ char_u *s;
* - 'fileformat'
* - 'fileencoding'
*/
void ml_setflags(buf)
buf_T *buf;
void ml_setflags(buf_T *buf)
{
bhdr_T *hp;
ZERO_BL *b0p;
@ -4203,11 +4157,7 @@ buf_T *buf;
* in allocated memory. Return NULL when out of memory.
* Otherwise return "data".
*/
char_u * ml_encrypt_data(mfp, data, offset, size)
memfile_T *mfp;
char_u *data;
off_t offset;
unsigned size;
char_u *ml_encrypt_data(memfile_T *mfp, char_u *data, off_t offset, unsigned size)
{
DATA_BL *dp = (DATA_BL *)data;
char_u *head_end;
@ -4244,11 +4194,7 @@ unsigned size;
/*
* Decrypt the text in "data" if it points to a data block.
*/
void ml_decrypt_data(mfp, data, offset, size)
memfile_T *mfp;
char_u *data;
off_t offset;
unsigned size;
void ml_decrypt_data(memfile_T *mfp, char_u *data, off_t offset, unsigned size)
{
DATA_BL *dp = (DATA_BL *)data;
char_u *head_end;
@ -4275,10 +4221,7 @@ unsigned size;
/*
* Prepare for encryption/decryption, using the key, seed and offset.
*/
static void ml_crypt_prepare(mfp, offset, reading)
memfile_T *mfp;
off_t offset;
int reading;
static void ml_crypt_prepare(memfile_T *mfp, off_t offset, int reading)
{
buf_T *buf = mfp->mf_buffer;
char_u salt[50];
@ -4323,11 +4266,7 @@ int reading;
* ML_CHNK_DELLINE: Subtract len from parent chunk, possibly deleting it
* 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;
static void 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;
@ -4533,10 +4472,7 @@ int updtype;
* Find offset of line if "lnum" > 0
* return -1 if information is not available
*/
long ml_find_line_or_offset(buf, lnum, offp)
buf_T *buf;
linenr_T lnum;
long *offp;
long ml_find_line_or_offset(buf_T *buf, linenr_T lnum, long *offp)
{
linenr_T curline;
int curix;
@ -4652,8 +4588,7 @@ long *offp;
/*
* Goto byte in buffer with offset 'cnt'.
*/
void goto_byte(cnt)
long cnt;
void goto_byte(long cnt)
{
long boff = cnt;
linenr_T lnum;

View File

@ -53,8 +53,10 @@ static char_u e_nomenu[] = N_("E329: No menu \"%s\"");
/*
* Do the :menu command and relatives.
*/
void ex_menu(eap)
exarg_T *eap; /* Ex command arguments */
void
ex_menu (
exarg_T *eap /* Ex command arguments */
)
{
char_u *menu_path;
int modes;
@ -262,12 +264,14 @@ theend:
/*
* Add the menu with the given name to the menu hierarchy
*/
static int add_menu_path(menu_path, menuarg, pri_tab, call_data)
char_u *menu_path;
vimmenu_T *menuarg; /* passes modes, iconfile, iconidx,
static int
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
)
{
char_u *path_name;
int modes = menuarg->modes;
@ -506,11 +510,7 @@ erret:
* Set the (sub)menu with the given name to enabled or disabled.
* Called recursively.
*/
static int menu_nable_recurse(menu, name, modes, enable)
vimmenu_T *menu;
char_u *name;
int modes;
int enable;
static int menu_nable_recurse(vimmenu_T *menu, char_u *name, int modes, int enable)
{
char_u *p;
@ -559,11 +559,13 @@ int enable;
* Remove the (sub)menu with the given name from the menu hierarchy
* 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 */
static int
remove_menu (
vimmenu_T **menup,
char_u *name,
int modes,
int silent /* don't give error messages */
)
{
vimmenu_T *menu;
vimmenu_T *child;
@ -666,8 +668,7 @@ int silent; /* don't give error messages */
/*
* Free the given menu structure and remove it from the linked list.
*/
static void free_menu(menup)
vimmenu_T **menup;
static void free_menu(vimmenu_T **menup)
{
int i;
vimmenu_T *menu;
@ -692,9 +693,7 @@ vimmenu_T **menup;
/*
* Free the menu->string with the given index.
*/
static void free_menu_string(menu, idx)
vimmenu_T *menu;
int idx;
static void free_menu_string(vimmenu_T *menu, int idx)
{
int count = 0;
int i;
@ -710,9 +709,7 @@ int 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;
static int show_menus(char_u *path_name, int modes)
{
char_u *p;
char_u *name;
@ -765,10 +762,7 @@ int 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;
static void show_menus_recursive(vimmenu_T *menu, int modes, int depth)
{
int i;
int bit;
@ -844,11 +838,7 @@ 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;
char_u *set_context_in_menu_cmd(expand_T *xp, char_u *cmd, char_u *arg, int forceit)
{
char_u *after_dot;
char_u *p;
@ -952,9 +942,7 @@ int forceit;
* Function given to ExpandGeneric() to obtain the list of (sub)menus (not
* entries).
*/
char_u * get_menu_name(xp, idx)
expand_T *xp UNUSED;
int idx;
char_u *get_menu_name(expand_T *xp, int idx)
{
static vimmenu_T *menu = NULL;
char_u *str;
@ -999,9 +987,7 @@ int idx;
* Function given to ExpandGeneric() to obtain the list of menus and menu
* entries.
*/
char_u * get_menu_names(xp, idx)
expand_T *xp UNUSED;
int idx;
char_u *get_menu_names(expand_T *xp, int idx)
{
static vimmenu_T *menu = NULL;
#define TBUFFER_LEN 256
@ -1065,8 +1051,7 @@ int idx;
* element. Any \ and ^Vs are removed from the current element.
* "name" may be modified.
*/
char_u * menu_name_skip(name)
char_u *name;
char_u *menu_name_skip(char_u *name)
{
char_u *p;
@ -1086,9 +1071,7 @@ char_u *name;
* Return TRUE when "name" matches with menu "menu". The name is compared in
* 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;
static int menu_name_equal(char_u *name, vimmenu_T *menu)
{
if (menu->en_name != NULL
&& (menu_namecmp(name, menu->en_name)
@ -1097,9 +1080,7 @@ vimmenu_T *menu;
return menu_namecmp(name, menu->name) || menu_namecmp(name, menu->dname);
}
static int menu_namecmp(name, mname)
char_u *name;
char_u *mname;
static int menu_namecmp(char_u *name, char_u *mname)
{
int i;
@ -1118,11 +1099,13 @@ char_u *mname;
* If "unmenu" is not NULL, then the flag it points to is set according to
* 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;
static int
get_menu_cmd_modes (
char_u *cmd,
int forceit, /* Was there a "!" after the command? */
int *noremap,
int *unmenu
)
{
int modes;
@ -1179,9 +1162,7 @@ int *unmenu;
* Modify a menu name starting with "PopUp" to include the mode character.
* Returns the name in allocated memory (NULL for failure).
*/
static char_u * popup_mode_name(name, idx)
char_u *name;
int idx;
static char_u *popup_mode_name(char_u *name, int idx)
{
char_u *p;
int len = (int)STRLEN(name);
@ -1202,10 +1183,7 @@ int idx;
* If mnemonic != NULL, *mnemonic is set to the character after the first '&'.
* 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;
static char_u *menu_text(char_u *str, int *mnemonic, char_u **actext)
{
char_u *p;
char_u *text;
@ -1251,8 +1229,7 @@ char_u **actext;
/*
* Return TRUE if "name" can be a menu in the MenuBar.
*/
int menu_is_menubar(name)
char_u *name;
int menu_is_menubar(char_u *name)
{
return !menu_is_popup(name)
&& !menu_is_toolbar(name)
@ -1262,8 +1239,7 @@ char_u *name;
/*
* Return TRUE if "name" is a popup menu name.
*/
int menu_is_popup(name)
char_u *name;
int menu_is_popup(char_u *name)
{
return STRNCMP(name, "PopUp", 5) == 0;
}
@ -1272,8 +1248,7 @@ char_u *name;
/*
* Return TRUE if "name" is a toolbar menu name.
*/
int menu_is_toolbar(name)
char_u *name;
int menu_is_toolbar(char_u *name)
{
return STRNCMP(name, "ToolBar", 7) == 0;
}
@ -1282,8 +1257,7 @@ char_u *name;
* Return TRUE if the name is a menu separator identifier: Starts and ends
* with '-'
*/
int menu_is_separator(name)
char_u *name;
int menu_is_separator(char_u *name)
{
return name[0] == '-' && name[STRLEN(name) - 1] == '-';
}
@ -1291,8 +1265,7 @@ char_u *name;
/*
* Return TRUE if the menu is hidden: Starts with ']'
*/
static int menu_is_hidden(name)
char_u *name;
static int menu_is_hidden(char_u *name)
{
return (name[0] == ']') || (menu_is_popup(name) && name[5] != NUL);
}
@ -1302,8 +1275,7 @@ char_u *name;
/*
* Return TRUE if the menu is the tearoff menu.
*/
static int menu_is_tearoff(name)
char_u *name UNUSED;
static int menu_is_tearoff(char_u *name)
{
return FALSE;
}
@ -1315,8 +1287,7 @@ char_u *name UNUSED;
* Given a menu descriptor, e.g. "File.New", find it in the menu hierarchy and
* execute it.
*/
void ex_emenu(eap)
exarg_T *eap;
void ex_emenu(exarg_T *eap)
{
vimmenu_T *menu;
char_u *name;
@ -1430,8 +1401,7 @@ exarg_T *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;
vimmenu_T *gui_find_menu(char_u *path_name)
{
vimmenu_T *menu = NULL;
char_u *name;
@ -1499,8 +1469,7 @@ static garray_T menutrans_ga = {0, 0, 0, 0, NULL};
* This function is also defined without the +multi_lang feature, in which
* case the commands are ignored.
*/
void ex_menutranslate(eap)
exarg_T *eap UNUSED;
void ex_menutranslate(exarg_T *eap)
{
char_u *arg = eap->arg;
menutrans_T *tp;
@ -1562,8 +1531,7 @@ exarg_T *eap UNUSED;
/*
* Find the character just after one part of a menu name.
*/
static char_u * menu_skip_part(p)
char_u *p;
static char_u *menu_skip_part(char_u *p)
{
while (*p != NUL && *p != '.' && !vim_iswhite(*p)) {
if ((*p == '\\' || *p == Ctrl_V) && p[1] != NUL)
@ -1577,9 +1545,7 @@ char_u *p;
* Lookup part of a menu name in the translations.
* Return a pointer to the translation or NULL if not found.
*/
static char_u * menutrans_lookup(name, len)
char_u *name;
int len;
static char_u *menutrans_lookup(char_u *name, int len)
{
menutrans_T *tp = (menutrans_T *)menutrans_ga.ga_data;
int i;
@ -1609,8 +1575,7 @@ int len;
/*
* Unescape the name in the translate dictionary table.
*/
static void menu_unescape_name(name)
char_u *name;
static void menu_unescape_name(char_u *name)
{
char_u *p;
@ -1623,8 +1588,7 @@ char_u *name;
* Isolate the menu 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;
static char_u *menu_translate_tab_and_shift(char_u *arg_start)
{
char_u *arg = arg_start;

View File

@ -100,8 +100,7 @@ static int verbose_did_open = FALSE;
* When terminal not initialized (yet) mch_errmsg(..) is used.
* return TRUE if wait_return not called
*/
int msg(s)
char_u *s;
int msg(char_u *s)
{
return msg_attr_keep(s, 0, FALSE);
}
@ -111,8 +110,7 @@ char_u *s;
/*
* Like msg() but keep it silent when 'verbosefile' is set.
*/
int verb_msg(s)
char_u *s;
int verb_msg(char_u *s)
{
int n;
@ -124,17 +122,17 @@ char_u *s;
}
#endif
int msg_attr(s, attr)
char_u *s;
int attr;
int 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 */
int
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;
@ -189,9 +187,11 @@ int keep; /* TRUE: set keep_msg if it doesn't scroll */
* Truncate a string such that it can be printed without causing a scroll.
* Returns an allocated string or NULL when no truncating is done.
*/
char_u * msg_strtrunc(s, force)
char_u *s;
int force; /* always truncate */
char_u *
msg_strtrunc (
char_u *s,
int force /* always truncate */
)
{
char_u *buf = NULL;
int len;
@ -229,11 +229,7 @@ int force; /* always truncate */
* Truncate a string "s" to "buf" with cell width "room".
* "s" and "buf" may be equal.
*/
void trunc_string(s, buf, room, buflen)
char_u *s;
char_u *buf;
int room;
int buflen;
void trunc_string(char_u *s, char_u *buf, int room, int buflen)
{
int half;
int len;
@ -331,18 +327,13 @@ int vim_snprintf __ARGS((char *, size_t, char *, long, long, long,
*/
/* VARARGS */
int smsg(s, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
char_u *s;
long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
int smsg(char_u *s, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9, long a10)
{
return smsg_attr(0, s, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
}
/* VARARGS */
int smsg_attr(attr, s, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
int attr;
char_u *s;
long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
int smsg_attr(int attr, char_u *s, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9, long a10)
{
vim_snprintf((char *)IObuff, IOSIZE, (char *)s,
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
@ -384,7 +375,7 @@ static char_u *last_sourcing_name = NULL;
* Reset the last used sourcing name/lnum. Makes sure it is displayed again
* for the next error message;
*/
void reset_last_sourcing() {
void reset_last_sourcing(void) {
vim_free(last_sourcing_name);
last_sourcing_name = NULL;
last_sourcing_lnum = 0;
@ -393,7 +384,7 @@ void reset_last_sourcing() {
/*
* Return TRUE if "sourcing_name" differs from "last_sourcing_name".
*/
static int other_sourcing_name() {
static int other_sourcing_name(void) {
if (sourcing_name != NULL) {
if (last_sourcing_name != NULL)
return STRCMP(sourcing_name, last_sourcing_name) != 0;
@ -407,7 +398,7 @@ static int other_sourcing_name() {
* Returns an allocated string with room for one more character.
* Returns NULL when no message is to be given.
*/
static char_u * get_emsg_source() {
static char_u *get_emsg_source(void) {
char_u *Buf, *p;
if (sourcing_name != NULL && other_sourcing_name()) {
@ -425,7 +416,7 @@ static char_u * get_emsg_source() {
* Returns an allocated string with room for one more character.
* Returns NULL when no message is to be given.
*/
static char_u * get_emsg_lnum() {
static char_u *get_emsg_lnum(void) {
char_u *Buf, *p;
/* lnum is 0 when executing a command from the command line
@ -447,8 +438,7 @@ static char_u * get_emsg_lnum() {
* Remember the file name and line number, so that for the next error the info
* is only displayed if it changed.
*/
void msg_source(attr)
int attr;
void msg_source(int attr)
{
char_u *p;
@ -482,7 +472,7 @@ int attr;
* If "msg" is in 'debug': do error message but without side effects.
* If "emsg_skip" is set: never do error messages.
*/
int emsg_not_now() {
int emsg_not_now(void) {
if ((emsg_off > 0 && vim_strchr(p_debug, 'm') == NULL
&& vim_strchr(p_debug, 't') == NULL)
|| emsg_skip > 0
@ -499,8 +489,7 @@ int emsg_not_now() {
*
* return TRUE if wait_return not called
*/
int emsg(s)
char_u *s;
int emsg(char_u *s)
{
int attr;
char_u *p;
@ -598,16 +587,14 @@ char_u *s;
/*
* Print an error message with one "%s" and one string argument.
*/
int emsg2(s, a1)
char_u *s, *a1;
int emsg2(char_u *s, char_u *a1)
{
return emsg3(s, a1, NULL);
}
/* emsg3() and emsgn() are in misc2.c to avoid warnings for the prototypes. */
void emsg_invreg(name)
int name;
void emsg_invreg(int name)
{
EMSG2(_("E354: Invalid register name: '%s'"), transchar(name));
}
@ -618,10 +605,7 @@ int name;
* Careful: The string may be changed by msg_may_trunc()!
* 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;
char_u *msg_trunc_attr(char_u *s, int force, int attr)
{
int n;
@ -644,9 +628,7 @@ int attr;
* Return a pointer to where the truncated message starts.
* Note: May change the message by replacing a character with '<'.
*/
char_u * msg_may_trunc(force, s)
int force;
char_u *s;
char_u *msg_may_trunc(int force, char_u *s)
{
int n;
int room;
@ -673,10 +655,12 @@ char_u *s;
return s;
}
static void add_msg_hist(s, len, attr)
char_u *s;
int len; /* -1 for undetermined length */
int attr;
static void
add_msg_hist (
char_u *s,
int len, /* -1 for undetermined length */
int attr
)
{
struct msg_hist *p;
@ -715,7 +699,7 @@ int attr;
* Delete the first (oldest) message from the history.
* Returns FAIL if there are no messages.
*/
int delete_first_msg() {
int delete_first_msg(void) {
struct msg_hist *p;
if (msg_hist_len <= 0)
@ -733,8 +717,7 @@ int delete_first_msg() {
/*
* ":messages" command.
*/
void ex_messages(eap)
exarg_T *eap UNUSED;
void ex_messages(exarg_T *eap)
{
struct msg_hist *p;
char_u *s;
@ -758,7 +741,7 @@ exarg_T *eap UNUSED;
* Call this after prompting the user. This will avoid a hit-return message
* and a delay.
*/
void msg_end_prompt() {
void msg_end_prompt(void) {
need_wait_return = FALSE;
emsg_on_display = FALSE;
cmdline_row = msg_row;
@ -773,8 +756,7 @@ void msg_end_prompt() {
* if 'redraw' is FALSE, just redraw the screen
* if 'redraw' is -1, don't redraw at all
*/
void wait_return(redraw)
int redraw;
void wait_return(int redraw)
{
int c;
int oldState;
@ -977,7 +959,7 @@ int redraw;
/*
* Write the hit-return prompt.
*/
static void hit_return_msg() {
static void hit_return_msg(void) {
int save_p_more = p_more;
p_more = FALSE; /* don't want see this message when scrolling back */
@ -995,9 +977,7 @@ static void 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;
void set_keep_msg(char_u *s, int attr)
{
vim_free(keep_msg);
if (s != NULL && msg_silent == 0)
@ -1012,7 +992,7 @@ int attr;
* If there currently is a message being displayed, set "keep_msg" to it, so
* that it will be displayed again after redraw.
*/
void set_keep_msg_from_hist() {
void set_keep_msg_from_hist(void) {
if (keep_msg == NULL && last_msg_hist != NULL && msg_scrolled == 0
&& (State & NORMAL))
set_keep_msg(last_msg_hist->msg, last_msg_hist->attr);
@ -1021,7 +1001,7 @@ void set_keep_msg_from_hist() {
/*
* Prepare for outputting characters in the command line.
*/
void msg_start() {
void msg_start(void) {
int did_return = FALSE;
if (!msg_silent) {
@ -1062,20 +1042,17 @@ void msg_start() {
/*
* Note that the current msg position is where messages start.
*/
void msg_starthere() {
void msg_starthere(void) {
lines_left = cmdline_row;
msg_didany = FALSE;
}
void msg_putchar(c)
int c;
void msg_putchar(int c)
{
msg_putchar_attr(c, 0);
}
void msg_putchar_attr(c, attr)
int c;
int attr;
void msg_putchar_attr(int c, int attr)
{
char_u buf[MB_MAXBYTES + 1];
@ -1090,8 +1067,7 @@ int attr;
msg_puts_attr(buf, attr);
}
void msg_outnum(n)
long n;
void msg_outnum(long n)
{
char_u buf[20];
@ -1099,21 +1075,17 @@ long n;
msg_puts(buf);
}
void msg_home_replace(fname)
char_u *fname;
void msg_home_replace(char_u *fname)
{
msg_home_replace_attr(fname, 0);
}
void msg_home_replace_hl(fname)
char_u *fname;
void msg_home_replace_hl(char_u *fname)
{
msg_home_replace_attr(fname, hl_attr(HLF_D));
}
static void msg_home_replace_attr(fname, attr)
char_u *fname;
int attr;
static void msg_home_replace_attr(char_u *fname, int attr)
{
char_u *name;
@ -1129,22 +1101,17 @@ int attr;
* Use attributes 'attr'.
* Return the number of characters it takes on the screen.
*/
int msg_outtrans(str)
char_u *str;
int msg_outtrans(char_u *str)
{
return msg_outtrans_attr(str, 0);
}
int msg_outtrans_attr(str, attr)
char_u *str;
int attr;
int 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;
int msg_outtrans_len(char_u *str, int len)
{
return msg_outtrans_len_attr(str, len, 0);
}
@ -1153,9 +1120,7 @@ int len;
* Output one character at "p". Return pointer to the next character.
* Handles multi-byte characters.
*/
char_u * msg_outtrans_one(p, attr)
char_u *p;
int attr;
char_u *msg_outtrans_one(char_u *p, int attr)
{
int l;
@ -1167,10 +1132,7 @@ int attr;
return p + 1;
}
int msg_outtrans_len_attr(msgstr, len, attr)
char_u *msgstr;
int len;
int attr;
int msg_outtrans_len_attr(char_u *msgstr, int len, int attr)
{
int retval = 0;
char_u *str = msgstr;
@ -1243,8 +1205,7 @@ int attr;
return retval;
}
void msg_make(arg)
char_u *arg;
void msg_make(char_u *arg)
{
int i;
static char_u *str = (char_u *)"eeffoc", *rs = (char_u *)"Plon#dqg#vxjduB";
@ -1274,9 +1235,11 @@ char_u *arg;
* This function is used to show mappings, where we want to see how to type
* the character/string -- webb
*/
int msg_outtrans_special(strstart, from)
char_u *strstart;
int from; /* TRUE for lhs of a mapping */
int
msg_outtrans_special (
char_u *strstart,
int from /* TRUE for lhs of a mapping */
)
{
char_u *str = strstart;
int retval = 0;
@ -1306,9 +1269,11 @@ int from; /* TRUE for lhs of a mapping */
* Return the lhs or rhs of a mapping, with the key codes turned into printable
* strings, in an allocated string.
*/
char_u * str2special_save(str, is_lhs)
char_u *str;
int is_lhs; /* TRUE for lhs, FALSE for rhs */
char_u *
str2special_save (
char_u *str,
int is_lhs /* TRUE for lhs, FALSE for rhs */
)
{
garray_T ga;
char_u *p = str;
@ -1325,9 +1290,11 @@ int is_lhs; /* TRUE for lhs, FALSE for rhs */
* Used for translating the lhs or rhs of a mapping to printable chars.
* Advances "sp" to the next code.
*/
char_u * str2special(sp, from)
char_u **sp;
int from; /* TRUE for lhs of mapping */
char_u *
str2special (
char_u **sp,
int from /* TRUE for lhs of mapping */
)
{
int c;
static char_u buf[7];
@ -1390,10 +1357,7 @@ int from; /* TRUE for lhs of mapping */
/*
* Translate a key sequence into special key names.
*/
void str2specialbuf(sp, buf, len)
char_u *sp;
char_u *buf;
int len;
void str2specialbuf(char_u *sp, char_u *buf, int len)
{
char_u *s;
@ -1408,9 +1372,7 @@ int len;
/*
* print line for :print or :list command
*/
void msg_prt_line(s, list)
char_u *s;
int list;
void msg_prt_line(char_u *s, int list)
{
int c;
int col = 0;
@ -1508,10 +1470,7 @@ int list;
* Use screen_puts() to output one multi-byte character.
* 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;
static char_u *screen_puts_mbyte(char_u *s, int l, int attr)
{
int cw;
@ -1546,14 +1505,12 @@ int attr;
* Output a string to the screen at position msg_row, msg_col.
* Update msg_row and msg_col for the next message.
*/
void msg_puts(s)
char_u *s;
void msg_puts(char_u *s)
{
msg_puts_attr(s, 0);
}
void msg_puts_title(s)
char_u *s;
void msg_puts_title(char_u *s)
{
msg_puts_attr(s, hl_attr(HLF_T));
}
@ -1563,17 +1520,12 @@ char_u *s;
* part in the middle and replace it with "..." when necessary.
* Does not handle multi-byte characters!
*/
void msg_puts_long_attr(longstr, attr)
char_u *longstr;
int attr;
void 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;
void msg_puts_long_len_attr(char_u *longstr, int len, int attr)
{
int slen = len;
int room;
@ -1590,9 +1542,7 @@ int attr;
/*
* Basic function for writing a message with highlight attributes.
*/
void msg_puts_attr(s, attr)
char_u *s;
int attr;
void msg_puts_attr(char_u *s, int attr)
{
msg_puts_attr_len(s, -1, attr);
}
@ -1602,10 +1552,7 @@ int attr;
* When "maxlen" is -1 there is no maximum length.
* 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;
static void msg_puts_attr_len(char_u *str, int maxlen, int attr)
{
/*
* If redirection is on, also write to the redirection file.
@ -1651,11 +1598,7 @@ int attr;
* The display part of msg_puts_attr_len().
* 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;
static void 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 */
@ -1841,7 +1784,7 @@ int recurse;
/*
* Scroll the screen up one line for displaying the next message line.
*/
static void msg_scroll_up() {
static void msg_scroll_up(void) {
/* scrolling up always works */
screen_del_lines(0, 0, 1, (int)Rows, TRUE, NULL);
@ -1862,7 +1805,7 @@ static void msg_scroll_up() {
/*
* Increment "msg_scrolled".
*/
static void inc_msg_scrolled() {
static void inc_msg_scrolled(void) {
if (*get_vim_var_str(VV_SCROLLSTART) == NUL) {
char_u *p = sourcing_name;
char_u *tofree = NULL;
@ -1911,12 +1854,14 @@ 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 */
static void
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;
@ -1953,7 +1898,7 @@ int finish; /* line ends */
/*
* Finished showing messages, clear the scroll-back text on the next message.
*/
void may_clear_sb_text() {
void may_clear_sb_text(void) {
do_clear_sb_text = TRUE;
}
@ -1961,7 +1906,7 @@ void may_clear_sb_text() {
* Clear any text remembered for scrolling back.
* Called when redrawing the screen.
*/
void clear_sb_text() {
void clear_sb_text(void) {
msgchunk_T *mp;
while (last_msgchunk != NULL) {
@ -1974,7 +1919,7 @@ void clear_sb_text() {
/*
* "g<" command.
*/
void show_sb_text() {
void show_sb_text(void) {
msgchunk_T *mp;
/* Only show something if there is more than one line, otherwise it looks
@ -1991,8 +1936,7 @@ void show_sb_text() {
/*
* Move to the start of screen line in already displayed text.
*/
static msgchunk_T * msg_sb_start(mps)
msgchunk_T *mps;
static msgchunk_T *msg_sb_start(msgchunk_T *mps)
{
msgchunk_T *mp = mps;
@ -2004,7 +1948,7 @@ msgchunk_T *mps;
/*
* Mark the last message chunk as finishing the line.
*/
void msg_sb_eol() {
void msg_sb_eol(void) {
if (last_msgchunk != NULL)
last_msgchunk->sb_eol = TRUE;
}
@ -2013,9 +1957,7 @@ void msg_sb_eol() {
* Display a screen line from previously displayed text at row "row".
* 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;
static msgchunk_T *disp_sb_line(int row, msgchunk_T *smp)
{
msgchunk_T *mp = smp;
char_u *p;
@ -2037,11 +1979,7 @@ msgchunk_T *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;
static void 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 */
@ -2066,7 +2004,7 @@ int attr;
* different, e.g. for Win32 console) or we just don't know where the
* cursor is.
*/
int msg_use_printf() {
int msg_use_printf(void) {
return !msg_check_screen()
|| (swapping_screen() && !termcap_active)
;
@ -2075,9 +2013,7 @@ int msg_use_printf() {
/*
* Print a message when there is no valid screen.
*/
static void msg_puts_printf(str, maxlen)
char_u *str;
int maxlen;
static void msg_puts_printf(char_u *str, int maxlen)
{
char_u *s = str;
char_u buf[4];
@ -2126,8 +2062,7 @@ int maxlen;
* otherwise it's NUL.
* Returns TRUE when jumping ahead to "confirm_msg_tail".
*/
static int do_more_prompt(typed_char)
int typed_char;
static int do_more_prompt(int typed_char)
{
int used_typed_char = typed_char;
int oldState = State;
@ -2332,8 +2267,7 @@ int typed_char;
* yet. When stderr can't be used, collect error messages until the GUI has
* started and they can be displayed in a message box.
*/
void mch_errmsg(str)
char *str;
void mch_errmsg(char *str)
{
int len;
@ -2386,8 +2320,7 @@ char *str;
* When there is no tty, collect messages until the GUI has started and they
* can be displayed in a message box.
*/
void mch_msg(str)
char *str;
void 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
@ -2411,9 +2344,7 @@ char *str;
* Put a character on the screen at the current message position and advance
* to the next position. Only for printable ASCII!
*/
static void msg_screen_putchar(c, attr)
int c;
int attr;
static void msg_screen_putchar(int c, int attr)
{
msg_didout = TRUE; /* remember that line is not empty */
screen_putchar(c, msg_row, msg_col, attr);
@ -2430,8 +2361,7 @@ int attr;
}
}
void msg_moremsg(full)
int full;
void msg_moremsg(int full)
{
int attr;
char_u *s = (char_u *)_("-- More --");
@ -2448,7 +2378,7 @@ int full;
* Repeat the message for the current mode: ASKMORE, EXTERNCMD, CONFIRM or
* exmode_active.
*/
void repeat_message() {
void repeat_message(void) {
if (State == ASKMORE) {
msg_moremsg(TRUE); /* display --more-- message again */
msg_row = Rows - 1;
@ -2477,7 +2407,7 @@ void repeat_message() {
* While starting the GUI the terminal codes will be set for the GUI, but the
* output goes to the terminal. Don't use the terminal codes then.
*/
static int msg_check_screen() {
static int msg_check_screen(void) {
if (!full_screen || !screen_valid(FALSE))
return FALSE;
@ -2492,7 +2422,7 @@ static int msg_check_screen() {
* Clear from current message position to end of screen.
* Skip this when ":silent" was used, no need to clear for redirection.
*/
void msg_clr_eos() {
void msg_clr_eos(void) {
if (msg_silent == 0)
msg_clr_eos_force();
}
@ -2502,7 +2432,7 @@ void msg_clr_eos() {
* Note: msg_col is not updated, so we remember the end of the message
* for msg_check().
*/
void msg_clr_eos_force() {
void msg_clr_eos_force(void) {
if (msg_use_printf()) {
if (full_screen) { /* only when termcap codes are valid */
if (*T_CD)
@ -2525,7 +2455,7 @@ void msg_clr_eos_force() {
/*
* Clear the command line.
*/
void msg_clr_cmdline() {
void msg_clr_cmdline(void) {
msg_row = cmdline_row;
msg_col = 0;
msg_clr_eos_force();
@ -2536,7 +2466,7 @@ void msg_clr_cmdline() {
* call wait_return if the message does not fit in the available space
* return TRUE if wait_return not called.
*/
int msg_end() {
int msg_end(void) {
/*
* If the string is larger than the window,
* or the ruler option is set and we run into it,
@ -2555,7 +2485,7 @@ int msg_end() {
* If the written message runs into the shown command or ruler, we have to
* wait for hit-return and redraw the window later.
*/
void msg_check() {
void msg_check(void) {
if (msg_row == Rows - 1 && msg_col >= sc_col) {
need_wait_return = TRUE;
redraw_cmdline = TRUE;
@ -2566,9 +2496,7 @@ void msg_check() {
* May write a string to the redirection file.
* When "maxlen" is -1 write the whole string, otherwise up to "maxlen" bytes.
*/
static void redir_write(str, maxlen)
char_u *str;
int maxlen;
static void redir_write(char_u *str, int maxlen)
{
char_u *s = str;
static int cur_col = 0;
@ -2623,7 +2551,7 @@ int maxlen;
}
}
int redirecting() {
int redirecting(void) {
return redir_fd != NULL || *p_vfile != NUL
|| redir_reg || redir_vname
;
@ -2633,7 +2561,7 @@ int redirecting() {
* Before giving verbose message.
* Must always be called paired with verbose_leave()!
*/
void verbose_enter() {
void verbose_enter(void) {
if (*p_vfile != NUL)
++msg_silent;
}
@ -2642,7 +2570,7 @@ void verbose_enter() {
* After giving verbose message.
* Must always be called paired with verbose_enter()!
*/
void verbose_leave() {
void verbose_leave(void) {
if (*p_vfile != NUL)
if (--msg_silent < 0)
msg_silent = 0;
@ -2651,7 +2579,7 @@ void verbose_leave() {
/*
* Like verbose_enter() and set msg_scroll when displaying the message.
*/
void verbose_enter_scroll() {
void verbose_enter_scroll(void) {
if (*p_vfile != NUL)
++msg_silent;
else
@ -2662,7 +2590,7 @@ void verbose_enter_scroll() {
/*
* Like verbose_leave() and set cmdline_row when displaying the message.
*/
void verbose_leave_scroll() {
void verbose_leave_scroll(void) {
if (*p_vfile != NUL) {
if (--msg_silent < 0)
msg_silent = 0;
@ -2673,7 +2601,7 @@ void verbose_leave_scroll() {
/*
* Called when 'verbosefile' is set: stop writing to the file.
*/
void verbose_stop() {
void verbose_stop(void) {
if (verbose_fd != NULL) {
fclose(verbose_fd);
verbose_fd = NULL;
@ -2685,7 +2613,7 @@ void verbose_stop() {
* Open the file 'verbosefile'.
* Return FAIL or OK.
*/
int verbose_open() {
int verbose_open(void) {
if (verbose_fd == NULL && !verbose_did_open) {
/* Only give the error message once. */
verbose_did_open = TRUE;
@ -2703,9 +2631,7 @@ int verbose_open() {
* Give a warning message (for searching).
* Use 'w' highlighting and may repeat the message after redrawing
*/
void give_warning(message, hl)
char_u *message;
int hl;
void give_warning(char_u *message, int hl)
{
/* Don't do this for ":silent". */
if (msg_silent != 0)
@ -2733,8 +2659,7 @@ int hl;
/*
* Advance msg cursor to column "col".
*/
void msg_advance(col)
int col;
void msg_advance(int col)
{
if (msg_silent != 0) { /* nothing to advance to */
msg_col = col; /* for redirection, may fill it up later */
@ -2768,16 +2693,18 @@ int col;
* A '&' in a button name becomes a shortcut, so each '&' should be before a
* 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
int
do_dialog (
int type,
char_u *title,
char_u *message,
char_u *buttons,
int dfltbutton,
char_u *textfield, /* 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;
int retval = 0;
@ -2862,10 +2789,12 @@ static int copy_char __ARGS((char_u *from, char_u *to, int lowercase));
* Copy one character from "*from" to "*to", taking care of multi-byte
* 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 */
static int
copy_char (
char_u *from,
char_u *to,
int lowercase /* make character lower case */
)
{
int len;
int c;
@ -2897,10 +2826,7 @@ int lowercase; /* make character lower case */
*
* 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;
static char_u *msg_show_console_dialog(char_u *message, char_u *buttons, int dfltbutton)
{
int len = 0;
# define HOTK_LEN (has_mbyte ? MB_MAXBYTES : 1)
@ -3032,7 +2958,7 @@ int dfltbutton;
/*
* Display the ":confirm" message. Also called when screen resized.
*/
void display_confirm_msg() {
void display_confirm_msg(void) {
/* avoid that 'q' at the more prompt truncates the message here */
++confirm_msg_used;
if (confirm_msg != NULL)
@ -3040,11 +2966,7 @@ void display_confirm_msg() {
--confirm_msg_used;
}
int vim_dialog_yesno(type, title, message, dflt)
int type;
char_u *title;
char_u *message;
int dflt;
int vim_dialog_yesno(int type, char_u *title, char_u *message, int dflt)
{
if (do_dialog(type,
title == NULL ? (char_u *)_("Question") : title,
@ -3054,11 +2976,7 @@ int dflt;
return VIM_NO;
}
int vim_dialog_yesnocancel(type, title, message, dflt)
int type;
char_u *title;
char_u *message;
int dflt;
int vim_dialog_yesnocancel(int type, char_u *title, char_u *message, int dflt)
{
switch (do_dialog(type,
title == NULL ? (char_u *)_("Question") : title,
@ -3070,11 +2988,7 @@ int dflt;
return VIM_CANCEL;
}
int vim_dialog_yesnoallcancel(type, title, message, dflt)
int type;
char_u *title;
char_u *message;
int dflt;
int vim_dialog_yesnoallcancel(int type, char_u *title, char_u *message, int dflt)
{
switch (do_dialog(type,
title == NULL ? (char_u *)"Question" : title,
@ -3101,9 +3015,7 @@ static double tv_float __ARGS((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;
static long tv_nr(typval_T *tvs, int *idxp)
{
int idx = *idxp - 1;
long n = 0;
@ -3124,9 +3036,7 @@ int *idxp;
* Get string argument from "idxp" entry in "tvs". First entry is 1.
* Returns NULL for an error.
*/
static char * tv_str(tvs, idxp)
typval_T *tvs;
int *idxp;
static char *tv_str(typval_T *tvs, int *idxp)
{
int idx = *idxp - 1;
char *s = NULL;
@ -3143,9 +3053,7 @@ int *idxp;
/*
* Get float argument from "idxp" entry in "tvs". First entry is 1.
*/
static double tv_float(tvs, idxp)
typval_T *tvs;
int *idxp;
static double tv_float(typval_T *tvs, int *idxp)
{
int idx = *idxp - 1;
double f = 0;
@ -3230,11 +3138,7 @@ int vim_snprintf_add(char *str, size_t str_m, char *fmt, ...) {
# else
/* Like vim_vsnprintf() but append to the string. */
int vim_snprintf_add(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
char *str;
size_t str_m;
char *fmt;
long a1, a2, a3, a4, a5, a6, a7, a8, a9, a10;
int vim_snprintf_add(char *str, size_t str_m, char *fmt, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, long a9, long a10)
{
size_t len = STRLEN(str);
size_t space;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -42,8 +42,7 @@ static void max_topfill __ARGS((void));
* Compute wp->w_botline for the current wp->w_topline. Can be called after
* wp->w_topline changed.
*/
static void comp_botline(wp)
win_T *wp;
static void comp_botline(win_T *wp)
{
int n;
linenr_T lnum;
@ -99,7 +98,7 @@ win_T *wp;
* Update curwin->w_topline and redraw if necessary.
* Used to update the screen before printing a message.
*/
void update_topline_redraw() {
void update_topline_redraw(void) {
update_topline();
if (must_redraw)
update_screen(0);
@ -108,7 +107,7 @@ void update_topline_redraw() {
/*
* Update curwin->w_topline to move the cursor onto the screen.
*/
void update_topline() {
void update_topline(void) {
long line_count;
int halfheight;
int n;
@ -296,7 +295,7 @@ void update_topline() {
* When 'scrolljump' is positive use it as-is.
* When 'scrolljump' is negative use it as a percentage of the window height.
*/
static int scrolljump_value() {
static int scrolljump_value(void) {
if (p_sj >= 0)
return (int)p_sj;
return (curwin->w_height * -p_sj) / 100;
@ -306,7 +305,7 @@ static int scrolljump_value() {
* Return TRUE when there are not 'scrolloff' lines above the cursor for the
* current window.
*/
static int check_top_offset() {
static int check_top_offset(void) {
lineoff_T loff;
int n;
@ -332,7 +331,7 @@ static int check_top_offset() {
return FALSE;
}
void update_curswant() {
void update_curswant(void) {
if (curwin->w_set_curswant) {
validate_virtcol();
curwin->w_curswant = curwin->w_virtcol;
@ -343,8 +342,7 @@ void update_curswant() {
/*
* Check if the cursor has moved. Set the w_valid flag accordingly.
*/
void check_cursor_moved(wp)
win_T *wp;
void check_cursor_moved(win_T *wp)
{
if (wp->w_cursor.lnum != wp->w_valid_cursor.lnum) {
wp->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL
@ -367,12 +365,11 @@ win_T *wp;
* the cursor position, botline and topline to be recomputed and the window to
* be redrawn. E.g, when changing the 'wrap' option or folding.
*/
void changed_window_setting() {
void changed_window_setting(void) {
changed_window_setting_win(curwin);
}
void changed_window_setting_win(wp)
win_T *wp;
void changed_window_setting_win(win_T *wp)
{
wp->w_lines_valid = 0;
changed_line_abv_curs_win(wp);
@ -383,9 +380,7 @@ win_T *wp;
/*
* Set wp->w_topline to a certain number.
*/
void set_topline(wp, lnum)
win_T *wp;
linenr_T lnum;
void set_topline(win_T *wp, linenr_T lnum)
{
/* go to first of folded lines */
(void)hasFoldingWin(wp, lnum, &lnum, NULL, TRUE, NULL);
@ -404,13 +399,12 @@ linenr_T lnum;
* characters) has changed, and the change is before the cursor.
* Need to take care of w_botline separately!
*/
void changed_cline_bef_curs() {
void changed_cline_bef_curs(void) {
curwin->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL
|VALID_CHEIGHT|VALID_TOPLINE);
}
void changed_cline_bef_curs_win(wp)
win_T *wp;
void changed_cline_bef_curs_win(win_T *wp)
{
wp->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL
|VALID_CHEIGHT|VALID_TOPLINE);
@ -421,13 +415,12 @@ win_T *wp;
* the cursor have changed.
* Need to take care of w_botline separately!
*/
void changed_line_abv_curs() {
void changed_line_abv_curs(void) {
curwin->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL|VALID_CROW
|VALID_CHEIGHT|VALID_TOPLINE);
}
void changed_line_abv_curs_win(wp)
win_T *wp;
void changed_line_abv_curs_win(win_T *wp)
{
wp->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL|VALID_CROW
|VALID_CHEIGHT|VALID_TOPLINE);
@ -436,7 +429,7 @@ win_T *wp;
/*
* Make sure the value of curwin->w_botline is valid.
*/
void validate_botline() {
void validate_botline(void) {
if (!(curwin->w_valid & VALID_BOTLINE))
comp_botline(curwin);
}
@ -444,8 +437,7 @@ void validate_botline() {
/*
* Make sure the value of wp->w_botline is valid.
*/
static void validate_botline_win(wp)
win_T *wp;
static void validate_botline_win(win_T *wp)
{
if (!(wp->w_valid & VALID_BOTLINE))
comp_botline(wp);
@ -454,18 +446,16 @@ win_T *wp;
/*
* Mark curwin->w_botline as invalid (because of some change in the buffer).
*/
void invalidate_botline() {
void invalidate_botline(void) {
curwin->w_valid &= ~(VALID_BOTLINE|VALID_BOTLINE_AP);
}
void invalidate_botline_win(wp)
win_T *wp;
void invalidate_botline_win(win_T *wp)
{
wp->w_valid &= ~(VALID_BOTLINE|VALID_BOTLINE_AP);
}
void approximate_botline_win(wp)
win_T *wp;
void approximate_botline_win(win_T *wp)
{
wp->w_valid &= ~VALID_BOTLINE;
}
@ -473,7 +463,7 @@ win_T *wp;
/*
* Return TRUE if curwin->w_wrow and curwin->w_wcol are valid.
*/
int cursor_valid() {
int cursor_valid(void) {
check_cursor_moved(curwin);
return (curwin->w_valid & (VALID_WROW|VALID_WCOL)) ==
(VALID_WROW|VALID_WCOL);
@ -483,7 +473,7 @@ int cursor_valid() {
* Validate cursor position. Makes sure w_wrow and w_wcol are valid.
* w_topline must be valid, you may need to call update_topline() first!
*/
void validate_cursor() {
void validate_cursor(void) {
check_cursor_moved(curwin);
if ((curwin->w_valid & (VALID_WCOL|VALID_WROW)) != (VALID_WCOL|VALID_WROW))
curs_columns(TRUE);
@ -495,9 +485,11 @@ void validate_cursor() {
*
* Returns OK when cursor is in the window, FAIL when it isn't.
*/
static void curs_rows(wp, do_botline)
win_T *wp;
int do_botline; /* also compute w_botline */
static void
curs_rows (
win_T *wp,
int do_botline /* also compute w_botline */
)
{
linenr_T lnum;
int i;
@ -585,15 +577,14 @@ int do_botline; /* also compute w_botline */
/*
* Validate curwin->w_virtcol only.
*/
void validate_virtcol() {
void validate_virtcol(void) {
validate_virtcol_win(curwin);
}
/*
* Validate wp->w_virtcol only.
*/
void validate_virtcol_win(wp)
win_T *wp;
void validate_virtcol_win(win_T *wp)
{
check_cursor_moved(wp);
if (!(wp->w_valid & VALID_VIRTCOL)) {
@ -609,7 +600,7 @@ win_T *wp;
/*
* Validate curwin->w_cline_height only.
*/
static void validate_cheight() {
static void validate_cheight(void) {
check_cursor_moved(curwin);
if (!(curwin->w_valid & VALID_CHEIGHT)) {
if (curwin->w_cursor.lnum == curwin->w_topline)
@ -625,7 +616,7 @@ static void validate_cheight() {
/*
* Validate w_wcol and w_virtcol only.
*/
void validate_cursor_col() {
void validate_cursor_col(void) {
colnr_T off;
colnr_T col;
int width;
@ -657,8 +648,7 @@ void validate_cursor_col() {
* Compute offset of a window, occupied by absolute or relative line number,
* fold column and sign column (these don't move when scrolling horizontally).
*/
int win_col_off(wp)
win_T *wp;
int win_col_off(win_T *wp)
{
return ((wp->w_p_nu || wp->w_p_rnu) ? number_width(wp) + 1 : 0)
+ (cmdwin_type == 0 || wp != curwin ? 0 : 1)
@ -666,7 +656,7 @@ win_T *wp;
;
}
int curwin_col_off() {
int curwin_col_off(void) {
return win_col_off(curwin);
}
@ -675,15 +665,14 @@ int curwin_col_off() {
* wrapped line. It's 8 if 'number' or 'relativenumber' is on and 'n' is in
* 'cpoptions'.
*/
int win_col_off2(wp)
win_T *wp;
int win_col_off2(win_T *wp)
{
if ((wp->w_p_nu || wp->w_p_rnu) && vim_strchr(p_cpo, CPO_NUMCOL) != NULL)
return number_width(wp) + 1;
return 0;
}
int curwin_col_off2() {
int curwin_col_off2(void) {
return win_col_off2(curwin);
}
@ -692,8 +681,10 @@ int curwin_col_off2() {
* Also updates curwin->w_wrow and curwin->w_cline_row.
* Also updates curwin->w_leftcol.
*/
void curs_columns(may_scroll)
int may_scroll; /* when TRUE, may scroll horizontally */
void
curs_columns (
int may_scroll /* when TRUE, may scroll horizontally */
)
{
int diff;
int extra; /* offset for first screen line */
@ -920,9 +911,11 @@ int may_scroll; /* when TRUE, may scroll horizontally */
/*
* Scroll the current window down by "line_count" logical lines. "CTRL-Y"
*/
void scrolldown(line_count, byfold)
long line_count;
int byfold UNUSED; /* TRUE: count a closed fold as one line */
void
scrolldown (
long line_count,
int byfold /* TRUE: count a closed fold as one line */
)
{
long done = 0; /* total # of physical lines done */
int wrow;
@ -999,9 +992,11 @@ int byfold UNUSED; /* TRUE: count a closed fold as one line */
/*
* Scroll the current window up by "line_count" logical lines. "CTRL-E"
*/
void scrollup(line_count, byfold)
long line_count;
int byfold UNUSED; /* TRUE: count a closed fold as one line */
void
scrollup (
long line_count,
int byfold /* TRUE: count a closed fold as one line */
)
{
linenr_T lnum;
@ -1055,9 +1050,11 @@ int byfold UNUSED; /* TRUE: count a closed fold as one line */
/*
* Don't end up with too many filler lines in the window.
*/
void check_topfill(wp, down)
win_T *wp;
int down; /* when TRUE scroll down when not enough space */
void
check_topfill (
win_T *wp,
int down /* when TRUE scroll down when not enough space */
)
{
int n;
@ -1080,7 +1077,7 @@ int down; /* when TRUE scroll down when not enough space */
* Use as many filler lines as possible for w_topline. Make sure w_topline
* is still visible.
*/
static void max_topfill() {
static void max_topfill(void) {
int n;
n = plines_nofill(curwin->w_topline);
@ -1097,7 +1094,7 @@ static void max_topfill() {
* Scroll the screen one line down, but don't do it if it would move the
* cursor off the screen.
*/
void scrolldown_clamp() {
void scrolldown_clamp(void) {
int end_row;
int can_fill = (curwin->w_topfill
< diff_check_fill(curwin, curwin->w_topline));
@ -1145,7 +1142,7 @@ void scrolldown_clamp() {
* Scroll the screen one line up, but don't do it if it would move the cursor
* off the screen.
*/
void scrollup_clamp() {
void scrollup_clamp(void) {
int start_row;
if (curwin->w_topline == curbuf->b_ml.ml_line_count
@ -1186,8 +1183,7 @@ void scrollup_clamp() {
* Returns the height of the added line in "lp->height".
* Lines above the first one are incredibly high: MAXCOL.
*/
static void topline_back(lp)
lineoff_T *lp;
static void topline_back(lineoff_T *lp)
{
if (lp->fill < diff_check_fill(curwin, lp->lnum)) {
/* Add a filler line. */
@ -1213,8 +1209,7 @@ lineoff_T *lp;
* Returns the height of the added line in "lp->height".
* Lines below the last one are incredibly high.
*/
static void botline_forw(lp)
lineoff_T *lp;
static void botline_forw(lineoff_T *lp)
{
if (lp->fill < diff_check_fill(curwin, lp->lnum + 1)) {
/* Add a filler line. */
@ -1239,8 +1234,7 @@ lineoff_T *lp;
* lines above loff.lnum + 1. This keeps pointing to the same line.
* When there are no filler lines nothing changes.
*/
static void botline_topline(lp)
lineoff_T *lp;
static void botline_topline(lineoff_T *lp)
{
if (lp->fill > 0) {
++lp->lnum;
@ -1253,8 +1247,7 @@ lineoff_T *lp;
* lines below loff.lnum - 1. This keeps pointing to the same line.
* When there are no filler lines nothing changes.
*/
static void topline_botline(lp)
lineoff_T *lp;
static void topline_botline(lineoff_T *lp)
{
if (lp->fill > 0) {
lp->fill = diff_check_fill(curwin, lp->lnum) - lp->fill + 1;
@ -1267,9 +1260,7 @@ lineoff_T *lp;
* Scroll at least "min_scroll" lines.
* If "always" is TRUE, always set topline (for "zt").
*/
void scroll_cursor_top(min_scroll, always)
int min_scroll;
int always;
void scroll_cursor_top(int min_scroll, int always)
{
int scrolled = 0;
int extra = 0;
@ -1383,9 +1374,7 @@ int always;
* Set w_empty_rows and w_filler_rows for window "wp", having used up "used"
* screen lines for text lines.
*/
void set_empty_rows(wp, used)
win_T *wp;
int used;
void set_empty_rows(win_T *wp, int used)
{
wp->w_filler_rows = 0;
if (used == 0)
@ -1410,9 +1399,7 @@ int used;
* If "set_topbot" is TRUE, set topline and botline first (for "zb").
* This is messy stuff!!!
*/
void scroll_cursor_bot(min_scroll, set_topbot)
int min_scroll;
int set_topbot;
void scroll_cursor_bot(int min_scroll, int set_topbot)
{
int used;
int scrolled = 0;
@ -1586,8 +1573,7 @@ int set_topbot;
* Recompute topline to put the cursor halfway the window
* If "atend" is TRUE, also put it halfway at the end of the file.
*/
void scroll_cursor_halfway(atend)
int atend;
void scroll_cursor_halfway(int atend)
{
int above = 0;
linenr_T topline;
@ -1645,7 +1631,7 @@ int atend;
* If not possible, put it at the same position as scroll_cursor_halfway().
* When called topline must be valid!
*/
void cursor_correct() {
void cursor_correct(void) {
int above = 0; /* screen lines above topline */
linenr_T topline;
int below = 0; /* screen lines below botline */
@ -1748,9 +1734,7 @@ static void get_scroll_overlap __ARGS((lineoff_T *lp, int dir));
*
* return FAIL for failure, OK otherwise
*/
int onepage(dir, count)
int dir;
long count;
int onepage(int dir, long count)
{
long n;
int retval = OK;
@ -1936,9 +1920,7 @@ long count;
* ------------- l3 second text line
* l3 etc.
*/
static void get_scroll_overlap(lp, dir)
lineoff_T *lp;
int dir;
static void get_scroll_overlap(lineoff_T *lp, int dir)
{
int h1, h2, h3, h4;
int min_height = curwin->w_height - 2;
@ -1991,9 +1973,7 @@ int dir;
/*
* Scroll 'scroll' lines up or down.
*/
void halfpage(flag, Prenum)
int flag;
linenr_T Prenum;
void halfpage(int flag, linenr_T Prenum)
{
long scrolled = 0;
int i;
@ -2153,7 +2133,7 @@ linenr_T Prenum;
redraw_later(VALID);
}
void do_check_cursorbind() {
void do_check_cursorbind(void) {
linenr_T line = curwin->w_cursor.lnum;
colnr_T col = curwin->w_cursor.col;
colnr_T coladd = curwin->w_cursor.coladd;

File diff suppressed because it is too large Load Diff

359
src/ops.c
View File

@ -130,9 +130,7 @@ static char opchars[][3] =
* Translate a command name into an operator type.
* Must only be called with a valid operator name!
*/
int get_op_type(char1, char2)
int char1;
int char2;
int get_op_type(int char1, int char2)
{
int i;
@ -149,8 +147,7 @@ int char2;
/*
* Return TRUE if operator "op" always works on whole lines.
*/
int op_on_lines(op)
int op;
int op_on_lines(int op)
{
return opchars[op][2];
}
@ -159,8 +156,7 @@ int op;
* Get first operator command character.
* Returns 'g' or 'z' if there is another command character.
*/
int get_op_char(optype)
int optype;
int get_op_char(int optype)
{
return opchars[optype][0];
}
@ -168,8 +164,7 @@ int optype;
/*
* Get second operator command character.
*/
int get_extra_op_char(optype)
int optype;
int get_extra_op_char(int optype)
{
return opchars[optype][1];
}
@ -177,10 +172,7 @@ int optype;
/*
* op_shift - handle a shift operation
*/
void op_shift(oap, curs_top, amount)
oparg_T *oap;
int curs_top;
int amount;
void op_shift(oparg_T *oap, int curs_top, int amount)
{
long i;
int first_char;
@ -257,11 +249,13 @@ int amount;
* shift the current line one shiftwidth left (if left != 0) or right
* leaves cursor on first blank in the line
*/
void shift_line(left, round, amount, call_changed_bytes)
int left;
int round;
int amount;
int call_changed_bytes; /* call changed_bytes() */
void
shift_line (
int left,
int round,
int amount,
int call_changed_bytes /* call changed_bytes() */
)
{
int count;
int i, j;
@ -301,9 +295,7 @@ int call_changed_bytes; /* call changed_bytes() */
* Shift one line of the current block one shiftwidth right or left.
* Leaves cursor on first character in block.
*/
static void shift_block(oap, amount)
oparg_T *oap;
int amount;
static void shift_block(oparg_T *oap, int amount)
{
int left = (oap->op_type == OP_LSHIFT);
int oldstate = State;
@ -466,11 +458,7 @@ int amount;
* Insert string "s" (b_insert ? before : after) block :AKelly
* Caller must prepare for undo.
*/
static void block_insert(oap, s, b_insert, bdp)
oparg_T *oap;
char_u *s;
int b_insert;
struct block_def *bdp;
static void block_insert(oparg_T *oap, char_u *s, int b_insert, struct block_def *bdp)
{
int p_ts;
int count = 0; /* extra spaces to replace a cut TAB */
@ -643,7 +631,7 @@ static char_u *expr_line = NULL;
* Get an expression for the "\"=expr1" or "CTRL-R =expr1"
* Returns '=' when OK, NUL otherwise.
*/
int get_expr_register() {
int get_expr_register(void) {
char_u *new_line;
new_line = getcmdline('=', 0L, 0);
@ -660,8 +648,7 @@ int get_expr_register() {
* Set the expression for the '=' register.
* Argument must be an allocated string.
*/
void set_expr_line(new_line)
char_u *new_line;
void set_expr_line(char_u *new_line)
{
vim_free(expr_line);
expr_line = new_line;
@ -671,7 +658,7 @@ char_u *new_line;
* Get the result of the '=' register expression.
* Returns a pointer to allocated memory, or NULL for failure.
*/
char_u * get_expr_line() {
char_u *get_expr_line(void) {
char_u *expr_copy;
char_u *rv;
static int nested = 0;
@ -700,7 +687,7 @@ char_u * get_expr_line() {
/*
* Get the '=' register expression itself, without evaluating it.
*/
char_u * get_expr_line_src() {
char_u *get_expr_line_src(void) {
if (expr_line == NULL)
return NULL;
return vim_strsave(expr_line);
@ -710,9 +697,11 @@ char_u * get_expr_line_src() {
* Check if 'regname' is a valid name of a yank register.
* Note: There is no check for 0 (default register), caller should do this
*/
int valid_yank_reg(regname, writing)
int regname;
int writing; /* if TRUE check for writable registers */
int
valid_yank_reg (
int regname,
int writing /* if TRUE check for writable registers */
)
{
if ( (regname > 0 && ASCII_ISALNUM(regname))
|| (!writing && vim_strchr((char_u *)
@ -734,9 +723,7 @@ int writing; /* if TRUE check for writable registers */
* If regname is 0 and writing, use register 0
* If regname is 0 and reading, use previous register
*/
void get_yank_register(regname, writing)
int regname;
int writing;
void get_yank_register(int regname, int writing)
{
int i;
@ -767,9 +754,11 @@ int writing;
* Obtain the contents of a "normal" register. The register is made empty.
* The returned pointer has allocated memory, use put_register() later.
*/
void * get_register(name, copy)
int name;
int copy; /* make a copy, if FALSE make register empty. */
void *
get_register (
int name,
int copy /* make a copy, if FALSE make register empty. */
)
{
struct yankreg *reg;
int i;
@ -799,9 +788,7 @@ int copy; /* make a copy, if FALSE make register empty. */
/*
* Put "reg" into register "name". Free any previous contents and "reg".
*/
void put_register(name, reg)
int name;
void *reg;
void put_register(int name, void *reg)
{
get_yank_register(name, 0);
free_yank_all();
@ -810,8 +797,7 @@ void *reg;
}
void free_register(reg)
void *reg;
void free_register(void *reg)
{
struct yankreg tmp;
@ -825,8 +811,7 @@ void *reg;
/*
* return TRUE if the current yank register has type MLINE
*/
int yank_register_mline(regname)
int regname;
int yank_register_mline(int regname)
{
if (regname != 0 && !valid_yank_reg(regname, FALSE))
return FALSE;
@ -841,8 +826,7 @@ int regname;
*
* Return FAIL for failure, OK otherwise.
*/
int do_record(c)
int c;
int do_record(int c)
{
char_u *p;
static int regname;
@ -896,9 +880,7 @@ int c;
*
* return FAIL for failure, OK otherwise
*/
static int stuff_yank(regname, p)
int regname;
char_u *p;
static int stuff_yank(int regname, char_u *p)
{
char_u *lp;
char_u **pp;
@ -946,11 +928,13 @@ static int execreg_lastc = NUL;
*
* return FAIL for failure, OK otherwise
*/
int do_execreg(regname, colon, addcr, silent)
int regname;
int colon; /* insert ':' before each line */
int addcr; /* always add '\n' to end of line */
int silent; /* set "silent" flag in typeahead buffer */
int
do_execreg (
int regname,
int colon, /* insert ':' before each line */
int addcr, /* always add '\n' to end of line */
int silent /* set "silent" flag in typeahead buffer */
)
{
long i;
char_u *p;
@ -1052,8 +1036,7 @@ int silent; /* set "silent" flag in typeahead buffer */
* If "restart_edit" is not zero, put it in the typeahead buffer, so that it's
* used only after other typeahead has been processed.
*/
static void put_reedit_in_typebuf(silent)
int silent;
static void put_reedit_in_typebuf(int silent)
{
char_u buf[3];
@ -1077,11 +1060,13 @@ int silent;
* When "esc" is TRUE it is to be taken literally: Escape CSI characters and
* no remapping.
*/
static int put_in_typebuf(s, esc, colon, silent)
char_u *s;
int esc;
int colon; /* add ':' before the line */
int silent;
static int
put_in_typebuf (
char_u *s,
int esc,
int colon, /* add ':' before the line */
int silent
)
{
int retval = OK;
@ -1114,9 +1099,11 @@ int silent;
*
* return FAIL for failure, OK otherwise
*/
int insert_reg(regname, literally)
int regname;
int literally; /* insert literally, not as if typed */
int
insert_reg (
int regname,
int literally /* insert literally, not as if typed */
)
{
long i;
int retval = OK;
@ -1169,9 +1156,7 @@ int literally; /* insert literally, not as if typed */
* Stuff a string into the typeahead buffer, such that edit() will insert it
* literally ("literally" TRUE) or interpret is as typed characters.
*/
static void stuffescaped(arg, literally)
char_u *arg;
int literally;
static void stuffescaped(char_u *arg, int literally)
{
int c;
char_u *start;
@ -1206,11 +1191,13 @@ int literally;
* If "regname" is a special register, return TRUE and store a pointer to its
* value in "argp".
*/
int get_spec_reg(regname, argp, allocated, errmsg)
int regname;
char_u **argp;
int *allocated; /* return: TRUE when value was allocated */
int errmsg; /* give error message when failing */
int
get_spec_reg (
int regname,
char_u **argp,
int *allocated, /* return: TRUE when value was allocated */
int errmsg /* give error message when failing */
)
{
int cnt;
@ -1287,10 +1274,12 @@ int errmsg; /* give error message when failing */
*
* return FAIL for failure, OK otherwise
*/
int cmdline_paste_reg(regname, literally, remcr)
int regname;
int literally; /* Insert text literally instead of "as typed" */
int remcr; /* don't add trailing CR */
int
cmdline_paste_reg (
int regname,
int literally, /* Insert text literally instead of "as typed" */
int remcr /* don't add trailing CR */
)
{
long i;
@ -1325,8 +1314,7 @@ int remcr; /* don't add trailing CR */
*
* Return FAIL if undo failed, OK otherwise.
*/
int op_delete(oap)
oparg_T *oap;
int op_delete(oparg_T *oap)
{
int n;
linenr_T lnum;
@ -1667,8 +1655,7 @@ setmarks:
* Adjust end of operating area for ending on a multi-byte character.
* Used for deletion.
*/
static void mb_adjust_opend(oap)
oparg_T *oap;
static void mb_adjust_opend(oparg_T *oap)
{
char_u *p;
@ -1681,9 +1668,7 @@ oparg_T *oap;
/*
* Replace a whole area with one character.
*/
int op_replace(oap, c)
oparg_T *oap;
int c;
int op_replace(oparg_T *oap, int c)
{
int n, numc;
int num_chars;
@ -1885,8 +1870,7 @@ static int swapchars __ARGS((int op_type, pos_T *pos, int length));
/*
* Handle the (non-standard vi) tilde operator. Also for "gu", "gU" and "g?".
*/
void op_tilde(oap)
oparg_T *oap;
void op_tilde(oparg_T *oap)
{
pos_T pos;
struct block_def bd;
@ -1961,10 +1945,7 @@ oparg_T *oap;
* Also works correctly when the number of bytes changes.
* Returns TRUE if some character was changed.
*/
static int swapchars(op_type, pos, length)
int op_type;
pos_T *pos;
int length;
static int swapchars(int op_type, pos_T *pos, int length)
{
int todo;
int did_change = 0;
@ -1991,9 +1972,7 @@ int length;
* else swap case of character at 'pos'
* returns TRUE when something actually changed.
*/
int swapchar(op_type, pos)
int op_type;
pos_T *pos;
int swapchar(int op_type, pos_T *pos)
{
int c;
int nc;
@ -2050,9 +2029,7 @@ pos_T *pos;
/*
* op_insert - Insert and append operators for Visual mode.
*/
void op_insert(oap, count1)
oparg_T *oap;
long count1;
void op_insert(oparg_T *oap, long count1)
{
long ins_len, pre_textlen = 0;
char_u *firstline, *ins_text;
@ -2198,8 +2175,7 @@ long count1;
*
* return TRUE if edit() returns because of a CTRL-O command
*/
int op_change(oap)
oparg_T *oap;
int op_change(oparg_T *oap)
{
colnr_T l;
int retval;
@ -2318,7 +2294,7 @@ oparg_T *oap;
/*
* set all the yank registers to empty (called from main())
*/
void init_yank() {
void init_yank(void) {
int i;
for (i = 0; i < NUM_REGISTERS; ++i)
@ -2326,7 +2302,7 @@ void init_yank() {
}
#if defined(EXITFREE) || defined(PROTO)
void clear_registers() {
void clear_registers(void) {
int i;
for (i = 0; i < NUM_REGISTERS; ++i) {
@ -2342,8 +2318,7 @@ void clear_registers() {
* Free "n" lines from the current yank register.
* Called for normal freeing and in case of error.
*/
static void free_yank(n)
long n;
static void free_yank(long n)
{
if (y_current->y_array != NULL) {
long i;
@ -2356,7 +2331,7 @@ long n;
}
}
static void free_yank_all() {
static void free_yank_all(void) {
free_yank(y_current->y_size);
}
@ -2368,10 +2343,7 @@ static void free_yank_all() {
*
* Return FAIL for failure, OK otherwise.
*/
int op_yank(oap, deleting, mess)
oparg_T *oap;
int deleting;
int mess;
int op_yank(oparg_T *oap, int deleting, int mess)
{
long y_idx; /* index in y_array[] */
struct yankreg *curr; /* copy of y_current */
@ -2604,9 +2576,7 @@ fail: /* free the allocated lines */
return FAIL;
}
static int yank_copy_line(bd, y_idx)
struct block_def *bd;
long y_idx;
static int yank_copy_line(struct block_def *bd, long y_idx)
{
char_u *pnew;
@ -2632,11 +2602,13 @@ long y_idx;
* PUT_CURSEND leave cursor after end of new text
* PUT_LINE force linewise put (":put")
*/
void do_put(regname, dir, count, flags)
int regname;
int dir; /* BACKWARD for 'P', FORWARD for 'p' */
long count;
int flags;
void
do_put (
int regname,
int dir, /* BACKWARD for 'P', FORWARD for 'p' */
long count,
int flags
)
{
char_u *ptr;
char_u *newp, *oldp;
@ -3197,7 +3169,7 @@ end:
* When the cursor is on the NUL past the end of the line and it should not be
* there move it left.
*/
void adjust_cursor_eol() {
void adjust_cursor_eol(void) {
if (curwin->w_cursor.col > 0
&& gchar_cursor() == NUL
&& (ve_flags & VE_ONEMORE) == 0
@ -3218,7 +3190,7 @@ void adjust_cursor_eol() {
/*
* Return TRUE if lines starting with '#' should be left aligned.
*/
int preprocs_left() {
int preprocs_left(void) {
return
(curbuf->b_p_si && !curbuf->b_p_cin) ||
(curbuf->b_p_cin && in_cinkeys('#', ' ', TRUE)
@ -3227,8 +3199,7 @@ int preprocs_left() {
}
/* Return the character name of the register with the given number */
int get_register_name(num)
int num;
int get_register_name(int num)
{
if (num == -1)
return '"';
@ -3244,8 +3215,7 @@ int num;
/*
* ":dis" and ":registers": Display the contents of the yank registers.
*/
void ex_display(eap)
exarg_T *eap;
void ex_display(exarg_T *eap)
{
int i, n;
long j;
@ -3374,9 +3344,11 @@ exarg_T *eap;
* display a string for do_dis()
* truncate at end of screen line
*/
static void dis_msg(p, skip_esc)
char_u *p;
int skip_esc; /* if TRUE, ignore trailing ESC */
static void
dis_msg (
char_u *p,
int skip_esc /* if TRUE, ignore trailing ESC */
)
{
int n;
int l;
@ -3406,11 +3378,7 @@ int skip_esc; /* if TRUE, ignore trailing ESC */
* is_comment - will indicate whether the current line ends with an unclosed
* comment.
*/
static char_u * skip_comment(line, process, include_space, is_comment)
char_u *line;
int process;
int include_space;
int *is_comment;
static char_u *skip_comment(char_u *line, int process, int include_space, int *is_comment)
{
char_u *comment_flags = NULL;
int lead_len;
@ -3470,11 +3438,7 @@ int *is_comment;
*
* return FAIL for failure, OK otherwise
*/
int do_join(count, insert_space, save_undo, use_formatoptions)
long count;
int insert_space;
int save_undo;
int use_formatoptions UNUSED;
int do_join(long count, int insert_space, int save_undo, int use_formatoptions)
{
char_u *curr = NULL;
char_u *curr_start = NULL;
@ -3652,13 +3616,7 @@ theend:
* the first line. White-space is ignored. Note that the whole of
* 'leader1' must match 'leader2_len' characters from 'leader2' -- webb
*/
static int same_leader(lnum, leader1_len, leader1_flags, leader2_len,
leader2_flags)
linenr_T lnum;
int leader1_len;
char_u *leader1_flags;
int leader2_len;
char_u *leader2_flags;
static int same_leader(linenr_T lnum, int leader1_len, char_u *leader1_flags, int leader2_len, char_u *leader2_flags)
{
int idx1 = 0, idx2 = 0;
char_u *p;
@ -3719,9 +3677,11 @@ char_u *leader2_flags;
/*
* Implementation of the format operator 'gq'.
*/
void op_format(oap, keep_cursor)
oparg_T *oap;
int keep_cursor; /* keep cursor on same text char */
void
op_format (
oparg_T *oap,
int keep_cursor /* keep cursor on same text char */
)
{
long old_line_count = curbuf->b_ml.ml_line_count;
@ -3787,8 +3747,7 @@ int keep_cursor; /* keep cursor on same text char */
/*
* Implementation of the format operator 'gq' for when using 'formatexpr'.
*/
void op_formatexpr(oap)
oparg_T *oap;
void op_formatexpr(oparg_T *oap)
{
if (oap->is_VIsual)
/* When there is no change: need to remove the Visual selection */
@ -3800,10 +3759,12 @@ oparg_T *oap;
op_format(oap, FALSE);
}
int fex_format(lnum, count, c)
linenr_T lnum;
long count;
int c; /* character to be inserted */
int
fex_format (
linenr_T lnum,
long count,
int c /* character to be inserted */
)
{
int use_sandbox = was_set_insecurely((char_u *)"formatexpr",
OPT_LOCAL);
@ -3837,9 +3798,11 @@ int c; /* character to be inserted */
* Lines after the cursor line are saved for undo, caller must have saved the
* first line.
*/
void format_lines(line_count, avoid_fex)
linenr_T line_count;
int avoid_fex; /* don't use 'formatexpr' */
void
format_lines (
linenr_T line_count,
int avoid_fex /* don't use 'formatexpr' */
)
{
int max_len;
int is_not_par; /* current line not part of parag. */
@ -4056,8 +4019,7 @@ int avoid_fex; /* don't use 'formatexpr' */
/*
* Return TRUE if line "lnum" ends in a white character.
*/
static int ends_in_white(lnum)
linenr_T lnum;
static int ends_in_white(linenr_T lnum)
{
char_u *s = ml_get(lnum);
size_t l;
@ -4078,11 +4040,7 @@ linenr_T lnum;
* previous line. A new paragraph starts after a blank line, or when the
* comment leader changes -- webb.
*/
static int fmt_check_par(lnum, leader_len, leader_flags, do_comments)
linenr_T lnum;
int *leader_len;
char_u **leader_flags;
int do_comments;
static int fmt_check_par(linenr_T lnum, int *leader_len, char_u **leader_flags, int do_comments)
{
char_u *flags = NULL; /* init for GCC */
char_u *ptr;
@ -4111,8 +4069,7 @@ int do_comments;
* Return TRUE when a paragraph starts in line "lnum". Return FALSE when the
* previous line is in the same paragraph. Used for auto-formatting.
*/
int paragraph_start(lnum)
linenr_T lnum;
int paragraph_start(linenr_T lnum)
{
char_u *p;
int leader_len = 0; /* leader len of current line */
@ -4165,11 +4122,7 @@ linenr_T lnum;
* - start/endspaces is the number of columns of the first/last yanked char
* that are to be yanked.
*/
static void block_prep(oap, bdp, lnum, is_del)
oparg_T *oap;
struct block_def *bdp;
linenr_T lnum;
int is_del;
static void block_prep(oparg_T *oap, struct block_def *bdp, linenr_T lnum, int is_del)
{
int incr = 0;
char_u *pend;
@ -4281,8 +4234,7 @@ int is_del;
static void reverse_line __ARGS((char_u *s));
static void reverse_line(s)
char_u *s;
static void reverse_line(char_u *s)
{
int i, j;
char_u c;
@ -4304,9 +4256,7 @@ char_u *s;
*
* return FAIL for failure, OK otherwise
*/
int do_addsub(command, Prenum1)
int command;
linenr_T Prenum1;
int do_addsub(int command, linenr_T Prenum1)
{
int col;
char_u *buf1;
@ -4530,9 +4480,7 @@ linenr_T Prenum1;
return OK;
}
int read_viminfo_register(virp, force)
vir_T *virp;
int force;
int read_viminfo_register(vir_T *virp, int force)
{
int eof;
int do_it = TRUE;
@ -4622,8 +4570,7 @@ int force;
return eof;
}
void write_viminfo_registers(fp)
FILE *fp;
void write_viminfo_registers(FILE *fp)
{
int i, j;
char_u *type;
@ -4710,9 +4657,7 @@ FILE *fp;
* Used for getregtype()
* Returns MAUTO for error.
*/
char_u get_reg_type(regname, reglen)
int regname;
long *reglen;
char_u get_reg_type(int regname, long *reglen)
{
switch (regname) {
case '%': /* file name */
@ -4748,10 +4693,12 @@ long *reglen;
* Used for "@r" in expressions and for getreg().
* Returns NULL for error.
*/
char_u * get_reg_contents(regname, allowexpr, expr_src)
int regname;
int allowexpr; /* allow "=" register */
int expr_src; /* get expression for "=" register */
char_u *
get_reg_contents (
int regname,
int allowexpr, /* allow "=" register */
int expr_src /* get expression for "=" register */
)
{
long i;
char_u *retval;
@ -4835,22 +4782,12 @@ int expr_src; /* get expression for "=" register */
* Careful: 'str' is modified, you may have to use a copy!
* If "str" ends in '\n' or '\r', use linewise, otherwise use characterwise.
*/
void write_reg_contents(name, str, maxlen, must_append)
int name;
char_u *str;
int maxlen;
int must_append;
void write_reg_contents(int name, char_u *str, int maxlen, int must_append)
{
write_reg_contents_ex(name, str, maxlen, must_append, MAUTO, 0L);
}
void write_reg_contents_ex(name, str, maxlen, must_append, yank_type, block_len)
int name;
char_u *str;
int maxlen;
int must_append;
int yank_type;
long block_len;
void write_reg_contents_ex(int name, char_u *str, int maxlen, int must_append, int yank_type, long block_len)
{
struct yankreg *old_y_previous, *old_y_current;
long len;
@ -4910,12 +4847,14 @@ long block_len;
* Put a string into a register. When the register is not empty, the string
* is appended.
*/
static void str_to_reg(y_ptr, yank_type, str, len, blocklen)
struct yankreg *y_ptr; /* pointer to yank register */
int yank_type; /* MCHAR, MLINE, MBLOCK, MAUTO */
char_u *str; /* string to put in register */
long len; /* length of string */
long blocklen; /* width of Visual block */
static void
str_to_reg (
struct yankreg *y_ptr, /* pointer to yank register */
int yank_type, /* MCHAR, MLINE, MBLOCK, MAUTO */
char_u *str, /* string to put in register */
long len, /* length of string */
long blocklen /* width of Visual block */
)
{
int type; /* MCHAR, MLINE or MBLOCK */
int lnum;
@ -5010,8 +4949,7 @@ long blocklen; /* width of Visual block */
y_ptr->y_width = 0;
}
void clear_oparg(oap)
oparg_T *oap;
void clear_oparg(oparg_T *oap)
{
vim_memset(oap, 0, sizeof(oparg_T));
}
@ -5034,12 +4972,7 @@ static long line_count_info __ARGS((char_u *line, long *wc, long *cc,
* case, eol_size will be added to the character count to account for
* the size of the EOL character.
*/
static long line_count_info(line, wc, cc, limit, eol_size)
char_u *line;
long *wc;
long *cc;
long limit;
int eol_size;
static long line_count_info(char_u *line, long *wc, long *cc, long limit, int eol_size)
{
long i;
long words = 0;
@ -5076,7 +5009,7 @@ int eol_size;
* In Visual mode, give some info about the selected region. (In this case,
* the *_count_cursor variables store running totals for the selection.)
*/
void cursor_pos_info() {
void cursor_pos_info(void) {
char_u *p;
char_u buf1[50];
char_u buf2[40];

File diff suppressed because it is too large Load Diff

View File

@ -221,8 +221,7 @@ static struct signalinfo {
{-1, "Unknown!", FALSE}
};
int mch_chdir(path)
char *path;
int mch_chdir(char *path)
{
if (p_verbose >= 5) {
verbose_enter();
@ -235,9 +234,7 @@ char *path;
/*
* Write s[len] to the screen.
*/
void mch_write(s, len)
char_u *s;
int len;
void mch_write(char_u *s, int len)
{
ignored = (int)write(1, (char *)s, len);
if (p_wd) /* Unix is too fast, slow down a bit more */
@ -252,74 +249,75 @@ int len;
* If wtime == n wait a short time for characters.
* If wtime == -1 wait forever for characters.
*/
int mch_inchar(buf, maxlen, wtime, tb_change_cnt)
char_u *buf;
int maxlen;
long wtime; /* don't use "time", MIPS cannot handle it */
int tb_change_cnt;
int mch_inchar(
char_u *buf,
int maxlen,
long wtime, /* don't use "time", MIPS cannot handle it */
int tb_change_cnt
)
{
int len;
int len;
/* Check if window changed size while we were busy, perhaps the ":set
* columns=99" command was used. */
while (do_resize)
handle_resize();
if (wtime >= 0) {
while (WaitForChar(wtime) == 0) { /* no character available */
if (!do_resize) /* return if not interrupted by resize */
return 0;
handle_resize();
}
} else { /* wtime == -1 */
/*
* If there is no character available within 'updatetime' seconds
* flush all the swap files to disk.
* Also done when interrupted by SIGWINCH.
*/
if (WaitForChar(p_ut) == 0) {
if (trigger_cursorhold() && maxlen >= 3
&& !typebuf_changed(tb_change_cnt)) {
buf[0] = K_SPECIAL;
buf[1] = KS_EXTRA;
buf[2] = (int)KE_CURSORHOLD;
return 3;
}
before_blocking();
}
}
for (;; ) { /* repeat until we got a character */
while (do_resize) /* window changed size */
handle_resize();
/*
* We want to be interrupted by the winch signal
* or by an event on the monitored file descriptors.
*/
if (WaitForChar(-1L) == 0) {
if (do_resize) /* interrupted by SIGWINCH signal */
/* Check if window changed size while we were busy, perhaps the ":set
* columns=99" command was used. */
while (do_resize)
handle_resize();
return 0;
if (wtime >= 0) {
while (WaitForChar(wtime) == 0) { /* no character available */
if (!do_resize) /* return if not interrupted by resize */
return 0;
handle_resize();
}
} else { /* wtime == -1 */
/*
* If there is no character available within 'updatetime' seconds
* flush all the swap files to disk.
* Also done when interrupted by SIGWINCH.
*/
if (WaitForChar(p_ut) == 0) {
if (trigger_cursorhold() && maxlen >= 3
&& !typebuf_changed(tb_change_cnt)) {
buf[0] = K_SPECIAL;
buf[1] = KS_EXTRA;
buf[2] = (int)KE_CURSORHOLD;
return 3;
}
before_blocking();
}
}
/* If input was put directly in typeahead buffer bail out here. */
if (typebuf_changed(tb_change_cnt))
return 0;
for (;; ) { /* repeat until we got a character */
while (do_resize) /* window changed size */
handle_resize();
/*
* For some terminals we only get one character at a time.
* We want the get all available characters, so we could keep on
* trying until none is available
* For some other terminals this is quite slow, that's why we don't do
* it.
*/
len = read_from_input_buf(buf, (long)maxlen);
if (len > 0) {
return len;
/*
* We want to be interrupted by the winch signal
* or by an event on the monitored file descriptors.
*/
if (WaitForChar(-1L) == 0) {
if (do_resize) /* interrupted by SIGWINCH signal */
handle_resize();
return 0;
}
/* If input was put directly in typeahead buffer bail out here. */
if (typebuf_changed(tb_change_cnt))
return 0;
/*
* For some terminals we only get one character at a time.
* We want the get all available characters, so we could keep on
* trying until none is available
* For some other terminals this is quite slow, that's why we don't do
* it.
*/
len = read_from_input_buf(buf, (long)maxlen);
if (len > 0) {
return len;
}
}
}
}
static void handle_resize() {
@ -349,8 +347,7 @@ int mch_char_avail() {
* Return total amount of memory available in Kbyte.
* Doesn't change when memory has been allocated.
*/
long_u mch_total_mem(special)
int special UNUSED;
long_u mch_total_mem(int special)
{
long_u mem = 0;
long_u shiftright = 10; /* how much to shift "mem" right for Kbyte */
@ -430,9 +427,7 @@ int special UNUSED;
}
#endif
void mch_delay(msec, ignoreinput)
long msec;
int ignoreinput;
void mch_delay(long msec, int ignoreinput)
{
int old_tmode;
@ -508,8 +503,7 @@ static int stack_grows_downwards;
* Find out if the stack grows upwards or downwards.
* "p" points to a variable on the stack of the caller.
*/
static void check_stack_growth(p)
char *p;
static void check_stack_growth(char *p)
{
int i;
@ -577,8 +571,7 @@ static void get_stack_limit() {
* Return FAIL when running out of stack space.
* "p" must point to any variable local to the caller that's on the stack.
*/
int mch_stackcheck(p)
char *p;
int mch_stackcheck(char *p)
{
if (stack_limit != NULL) {
if (stack_grows_downwards) {
@ -1005,9 +998,10 @@ void reset_signals() {
#endif
}
static void catch_signals(func_deadly, func_other)
RETSIGTYPE (*func_deadly)();
RETSIGTYPE (*func_other)();
static void catch_signals(
RETSIGTYPE (*func_deadly)(),
RETSIGTYPE (*func_other)()
)
{
int i;
@ -1056,8 +1050,7 @@ RETSIGTYPE (*func_other)();
* signal
* Returns TRUE when Vim should exit.
*/
int vim_handle_signal(sig)
int sig;
int vim_handle_signal(int sig)
{
static int got_signal = 0;
static int blocked = TRUE;
@ -1088,9 +1081,7 @@ int sig;
/*
* Check_win checks whether we have an interactive stdout.
*/
int mch_check_win(argc, argv)
int argc UNUSED;
char **argv UNUSED;
int mch_check_win(int argc, char **argv)
{
if (isatty(1))
return OK;
@ -1106,14 +1097,12 @@ int mch_input_isatty() {
return FALSE;
}
static int get_x11_title(test_only)
int test_only UNUSED;
static int get_x11_title(int test_only)
{
return FALSE;
}
static int get_x11_icon(test_only)
int test_only;
static int get_x11_icon(int test_only)
{
if (!test_only) {
if (STRNCMP(T_NAME, "builtin_", 8) == 0)
@ -1136,9 +1125,7 @@ int mch_can_restore_icon() {
/*
* Set the window title and icon.
*/
void mch_settitle(title, icon)
char_u *title;
char_u *icon;
void mch_settitle(char_u *title, char_u *icon)
{
int type = 0;
static int recursive = 0;
@ -1195,8 +1182,7 @@ char_u *icon;
* 2 only restore icon
* 3 restore title and icon
*/
void mch_restore_title(which)
int which;
void mch_restore_title(int which)
{
/* only restore the title or icon when it has been set */
mch_settitle(((which & 1) && did_set_title) ?
@ -1209,8 +1195,7 @@ int which;
* Return TRUE if "name" looks like some xterm name.
* Seiichi Sato mentioned that "mlterm" works like xterm.
*/
int vim_is_xterm(name)
char_u *name;
int vim_is_xterm(char_u *name)
{
if (name == NULL)
return FALSE;
@ -1227,8 +1212,7 @@ char_u *name;
* known to support the xterm-style mouse protocol.
* Relies on term_is_xterm having been set to its correct value.
*/
int use_xterm_like_mouse(name)
char_u *name;
int use_xterm_like_mouse(char_u *name)
{
return name != NULL
&& (term_is_xterm || STRNICMP(name, "screen", 6) == 0);
@ -1253,8 +1237,7 @@ int use_xterm_mouse() {
return 0;
}
int vim_is_iris(name)
char_u *name;
int vim_is_iris(char_u *name)
{
if (name == NULL)
return FALSE;
@ -1262,8 +1245,7 @@ char_u *name;
|| STRCMP(name, "builtin_iris-ansi") == 0;
}
int vim_is_vt300(name)
char_u *name;
int vim_is_vt300(char_u *name)
{
if (name == NULL)
return FALSE; /* actually all ANSI comp. terminals should be here */
@ -1277,8 +1259,7 @@ char_u *name;
* Return TRUE if "name" is a terminal for which 'ttyfast' should be set.
* This should include all windowed terminal emulators.
*/
int vim_is_fastterm(name)
char_u *name;
int vim_is_fastterm(char_u *name)
{
if (name == NULL)
return FALSE;
@ -1294,9 +1275,7 @@ char_u *name;
* Insert user name in s[len].
* Return OK if a name found.
*/
int mch_get_user_name(s, len)
char_u *s;
int len;
int mch_get_user_name(char_u *s, int len)
{
return mch_get_uname(getuid(), s, len);
}
@ -1305,10 +1284,7 @@ int len;
* Insert user name for "uid" in s[len].
* Return OK if a name found.
*/
int mch_get_uname(uid, s, len)
uid_t uid;
char_u *s;
int len;
int mch_get_uname(uid_t uid, char_u *s, int len)
{
#if defined(HAVE_PWD_H) && defined(HAVE_GETPWUID)
struct passwd *pw;
@ -1328,9 +1304,7 @@ int len;
*/
#ifdef HAVE_SYS_UTSNAME_H
void mch_get_host_name(s, len)
char_u *s;
int len;
void mch_get_host_name(char_u *s, int len)
{
struct utsname vutsname;
@ -1345,9 +1319,7 @@ int len;
# define gethostname(nam, len) sysinfo(SI_HOSTNAME, nam, len)
# endif
void mch_get_host_name(s, len)
char_u *s;
int len;
void mch_get_host_name(char_u *s, int len)
{
gethostname((char *)s, len);
s[len - 1] = NUL; /* make sure it's terminated */
@ -1364,8 +1336,7 @@ long mch_get_pid() {
#if !defined(HAVE_STRERROR) && defined(USE_GETCWD)
static char *strerror __ARGS((int));
static char * strerror(err)
int err;
static char * strerror(int err)
{
extern int sys_nerr;
extern char *sys_errlist[];
@ -1382,9 +1353,7 @@ int err;
* Get name of current directory into buffer 'buf' of length 'len' bytes.
* Return OK for success, FAIL for failure.
*/
int mch_dirname(buf, len)
char_u *buf;
int len;
int mch_dirname(char_u *buf, int len)
{
#if defined(USE_GETCWD)
if (getcwd((char *)buf, len) == NULL) {
@ -1403,10 +1372,12 @@ int len;
*
* return FAIL for failure, OK for success
*/
int mch_FullName(fname, buf, len, force)
char_u *fname, *buf;
int len;
int force; /* also expand when already absolute path */
int mch_FullName(
char_u *fname,
char_u *buf,
int len,
int force /* also expand when already absolute path */
)
{
int l;
#ifdef HAVE_FCHDIR
@ -1512,8 +1483,7 @@ int force; /* also expand when already absolute path */
/*
* Return TRUE if "fname" does not depend on the current directory.
*/
int mch_isFullName(fname)
char_u *fname;
int mch_isFullName(char_u *fname)
{
return *fname == '/' || *fname == '~';
}
@ -1524,9 +1494,10 @@ char_u *fname;
* file name to remain exactly the same.
* Only required for file systems where case is ignored and preserved.
*/
void fname_case(name, len)
char_u *name;
int len UNUSED; /* buffer size, only used when name gets longer */
void fname_case(
char_u *name,
int len; /* buffer size, only used when name gets longer */
)
{
struct stat st;
char_u *slash, *tail;
@ -1578,8 +1549,7 @@ int len UNUSED; /* buffer size, only used when name gets longer */
* Get file permissions for 'name'.
* Returns -1 when it doesn't exist.
*/
long mch_getperm(name)
char_u *name;
long mch_getperm(char_u *name)
{
struct stat statb;
@ -1600,9 +1570,7 @@ char_u *name;
*
* return FAIL for failure, OK otherwise
*/
int mch_setperm(name, perm)
char_u *name;
long perm;
int mch_setperm(char_u *name, long perm)
{
return chmod((char *)
name,
@ -1622,9 +1590,7 @@ long perm;
/*
* Copy security info from "from_file" to "to_file".
*/
void mch_copy_sec(from_file, to_file)
char_u *from_file;
char_u *to_file;
void mch_copy_sec(char_u *from_file, char_u *to_file)
{
if (from_file == NULL)
return;
@ -1672,8 +1638,7 @@ char_u *to_file;
* Return a pointer to the ACL of file "fname" in allocated memory.
* Return NULL if the ACL is not available for whatever reason.
*/
vim_acl_T mch_get_acl(fname)
char_u *fname UNUSED;
vim_acl_T mch_get_acl(char_u *fname)
{
vim_acl_T ret = NULL;
return ret;
@ -1682,16 +1647,13 @@ char_u *fname UNUSED;
/*
* Set the ACL of file "fname" to "acl" (unless it's NULL).
*/
void mch_set_acl(fname, aclent)
char_u *fname UNUSED;
vim_acl_T aclent;
void mch_set_acl(char_u *fname, vim_acl_T aclent)
{
if (aclent == NULL)
return;
}
void mch_free_acl(aclent)
vim_acl_T aclent;
void mch_free_acl(vim_acl_T aclent)
{
if (aclent == NULL)
return;
@ -1701,8 +1663,7 @@ vim_acl_T aclent;
/*
* Set hidden flag for "name".
*/
void mch_hide(name)
char_u *name UNUSED;
void mch_hide(char_u *name)
{
/* can't hide a file */
}
@ -1712,8 +1673,7 @@ char_u *name UNUSED;
* return FALSE if "name" is not a directory
* return FALSE for error
*/
int mch_isdir(name)
char_u *name;
int mch_isdir(char_u *name)
{
struct stat statb;
@ -1733,8 +1693,7 @@ static int executable_file __ARGS((char_u *name));
/*
* Return 1 if "name" is an executable file, 0 if not or it doesn't exist.
*/
static int executable_file(name)
char_u *name;
static int executable_file(char_u *name)
{
struct stat st;
@ -1747,8 +1706,7 @@ char_u *name;
* Return 1 if "name" can be found in $PATH and executed, 0 if not.
* Return -1 if unknown.
*/
int mch_can_exe(name)
char_u *name;
int mch_can_exe(char_u *name)
{
char_u *buf;
char_u *p, *e;
@ -1801,8 +1759,7 @@ char_u *name;
* NODE_WRITABLE: writable device, socket, fifo, etc.
* NODE_OTHER: non-writable things
*/
int mch_nodetype(name)
char_u *name;
int mch_nodetype(char_u *name)
{
struct stat st;
@ -1876,8 +1833,7 @@ static void exit_scroll() {
}
}
void mch_exit(r)
int r;
void mch_exit(int r)
{
exiting = TRUE;
@ -1934,8 +1890,7 @@ static void may_core_dump() {
}
}
void mch_settmode(tmode)
int tmode;
void mch_settmode(int tmode)
{
static int first = TRUE;
@ -2196,7 +2151,7 @@ void check_mouse_termcode() {
* set screen mode, always fails.
*/
int mch_screenmode(arg)
char_u *arg UNUSED;
char_u *arg;
{
EMSG(_(e_screenmode));
return FAIL;
@ -3153,7 +3108,7 @@ long msec;
static int RealWaitForChar(fd, msec, check_for_gpm)
int fd;
long msec;
int *check_for_gpm UNUSED;
int *check_for_gpm;
{
int ret;

View File

@ -81,7 +81,7 @@
# define SIGDUMMYARG 0, 0, (struct sigcontext *)0
# else
# define SIGPROTOARG (int)
# define SIGDEFARG(s) (s) int s UNUSED;
# define SIGDEFARG(s) (s) int s;
# define SIGDUMMYARG 0
# endif
#else

View File

@ -1,15 +1,4 @@
/*
* Simplistic program to correct SJIS inside strings. When a trail byte is a
* backslash it needs to be doubled.
* Public domain.
*/
#include <stdio.h>
#include <string.h>
int
main(argc, argv)
int argc;
char **argv;
__END_DECLS int main(int argc, char **argv)
{
char buffer[BUFSIZ];
char *p;

View File

@ -40,11 +40,13 @@ static int pum_set_selected __ARGS((int n, int repeat));
* When possible the leftmost character is aligned with screen column "col".
* The menu appears above the screen line "row" or at "row" + "height" - 1.
*/
void pum_display(array, size, selected)
pumitem_T *array;
int size;
int selected; /* index of initially selected item, none if
void
pum_display (
pumitem_T *array,
int size,
int selected /* index of initially selected item, none if
out of range */
)
{
int w;
int def_width;
@ -231,7 +233,7 @@ redo:
/*
* Redraw the popup menu, using "pum_first" and "pum_selected".
*/
void pum_redraw() {
void pum_redraw(void) {
int row = pum_row;
int col;
int attr_norm = highlight_attr[HLF_PNI];
@ -415,9 +417,7 @@ void pum_redraw() {
* Returns TRUE when the window was resized and the location of the popup menu
* must be recomputed.
*/
static int pum_set_selected(n, repeat)
int n;
int repeat;
static int pum_set_selected(int n, int repeat)
{
int resized = FALSE;
int context = pum_height / 2;
@ -584,7 +584,7 @@ int repeat;
/*
* Undisplay the popup menu (later).
*/
void pum_undisplay() {
void pum_undisplay(void) {
pum_array = NULL;
redraw_all_later(SOME_VALID);
redraw_tabline = TRUE;
@ -595,7 +595,7 @@ void pum_undisplay() {
* Clear the popup menu. Currently only resets the offset to the first
* displayed item.
*/
void pum_clear() {
void pum_clear(void) {
pum_first = 0;
}
@ -603,7 +603,7 @@ void pum_clear() {
* Return TRUE if the popup menu is displayed.
* Overruled when "pum_do_redraw" is set, used to redraw the status lines.
*/
int pum_visible() {
int pum_visible(void) {
return !pum_do_redraw && pum_array != NULL;
}
@ -611,7 +611,7 @@ int pum_visible() {
* Return the height of the popup menu, the number of entries visible.
* Only valid when pum_visible() returns TRUE!
*/
int pum_get_height() {
int pum_get_height(void) {
return pum_height;
}

View File

@ -152,12 +152,14 @@ static qf_info_T *ll_get_or_alloc_list __ARGS((win_T *));
* list. Set the error list's title to qf_title.
* Return -1 for error, number of errors for success.
*/
int qf_init(wp, efile, errorformat, newlist, qf_title)
win_T *wp;
char_u *efile;
char_u *errorformat;
int newlist; /* TRUE: start a new error list */
char_u *qf_title;
int
qf_init (
win_T *wp,
char_u *efile,
char_u *errorformat,
int newlist, /* TRUE: start a new error list */
char_u *qf_title
)
{
qf_info_T *qi = &ql_info;
@ -184,18 +186,18 @@ char_u *qf_title;
* Set the title of the list to "qf_title".
* Return -1 for error, number of errors for success.
*/
static int qf_init_ext(qi, efile, buf, tv, errorformat, newlist, lnumfirst,
lnumlast,
qf_title)
qf_info_T *qi;
char_u *efile;
buf_T *buf;
typval_T *tv;
char_u *errorformat;
int newlist; /* TRUE: start a new error list */
linenr_T lnumfirst; /* first line number to use */
linenr_T lnumlast; /* last line number to use */
char_u *qf_title;
static int
qf_init_ext (
qf_info_T *qi,
char_u *efile,
buf_T *buf,
typval_T *tv,
char_u *errorformat,
int newlist, /* TRUE: start a new error list */
linenr_T lnumfirst, /* first line number to use */
linenr_T lnumlast, /* last line number to use */
char_u *qf_title
)
{
char_u *namebuf;
char_u *errmsg;
@ -803,9 +805,7 @@ qf_init_end:
/*
* Prepare for adding a new quickfix list.
*/
static void qf_new_list(qi, qf_title)
qf_info_T *qi;
char_u *qf_title;
static void qf_new_list(qf_info_T *qi, char_u *qf_title)
{
int i;
@ -841,8 +841,7 @@ char_u *qf_title;
/*
* Free a location list
*/
static void ll_free_all(pqi)
qf_info_T **pqi;
static void ll_free_all(qf_info_T **pqi)
{
int i;
qf_info_T *qi;
@ -861,8 +860,7 @@ qf_info_T **pqi;
}
}
void qf_free_all(wp)
win_T *wp;
void qf_free_all(win_T *wp)
{
int i;
qf_info_T *qi = &ql_info;
@ -881,23 +879,22 @@ win_T *wp;
* Add an entry to the end of the list of errors.
* Returns OK or FAIL.
*/
static int qf_add_entry(qi, prevp, dir, fname, bufnum, mesg, lnum, col, vis_col,
pattern,
nr, type,
valid)
qf_info_T *qi; /* quickfix list */
qfline_T **prevp; /* pointer to previously added entry or NULL */
char_u *dir; /* optional directory name */
char_u *fname; /* file name or NULL */
int bufnum; /* buffer number or zero */
char_u *mesg; /* message */
long lnum; /* line number */
int col; /* column */
int vis_col; /* using visual column */
char_u *pattern; /* search pattern */
int nr; /* error number */
int type; /* type character */
int valid; /* valid entry */
static int
qf_add_entry (
qf_info_T *qi, /* quickfix list */
qfline_T **prevp, /* pointer to previously added entry or NULL */
char_u *dir, /* optional directory name */
char_u *fname, /* file name or NULL */
int bufnum, /* buffer number or zero */
char_u *mesg, /* message */
long lnum, /* line number */
int col, /* column */
int vis_col, /* using visual column */
char_u *pattern, /* search pattern */
int nr, /* error number */
int type, /* type character */
int valid /* valid entry */
)
{
qfline_T *qfp;
@ -952,7 +949,7 @@ int valid; /* valid entry */
/*
* Allocate a new location list
*/
static qf_info_T * ll_new_list() {
static qf_info_T *ll_new_list(void) {
qf_info_T *qi;
qi = (qf_info_T *)alloc((unsigned)sizeof(qf_info_T));
@ -968,8 +965,7 @@ static qf_info_T * ll_new_list() {
* Return the location list for window 'wp'.
* If not present, allocate a location list
*/
static qf_info_T * ll_get_or_alloc_list(wp)
win_T *wp;
static qf_info_T *ll_get_or_alloc_list(win_T *wp)
{
if (IS_LL_WINDOW(wp))
/* For a location list window, use the referenced location list */
@ -989,9 +985,7 @@ win_T *wp;
/*
* Copy the location list from window "from" to window "to".
*/
void copy_loclist(from, to)
win_T *from;
win_T *to;
void copy_loclist(win_T *from, win_T *to)
{
qf_info_T *qi;
int idx;
@ -1087,9 +1081,7 @@ win_T *to;
/*
* get buffer number for file "dir.name"
*/
static int qf_get_fnum(directory, fname)
char_u *directory;
char_u *fname;
static int qf_get_fnum(char_u *directory, char_u *fname)
{
if (fname == NULL || *fname == NUL) /* no file name */
return 0;
@ -1131,9 +1123,7 @@ char_u *fname;
* push dirbuf onto the directory stack and return pointer to actual dir or
* NULL on error
*/
static char_u * qf_push_dir(dirbuf, stackptr)
char_u *dirbuf;
struct dir_stack_T **stackptr;
static char_u *qf_push_dir(char_u *dirbuf, struct dir_stack_T **stackptr)
{
struct dir_stack_T *ds_new;
struct dir_stack_T *ds_ptr;
@ -1198,8 +1188,7 @@ struct dir_stack_T **stackptr;
* pop dirbuf from the directory stack and return previous directory or NULL if
* stack is empty
*/
static char_u * qf_pop_dir(stackptr)
struct dir_stack_T **stackptr;
static char_u *qf_pop_dir(struct dir_stack_T **stackptr)
{
struct dir_stack_T *ds_ptr;
@ -1221,8 +1210,7 @@ struct dir_stack_T **stackptr;
/*
* clean up directory stack
*/
static void qf_clean_dir_stack(stackptr)
struct dir_stack_T **stackptr;
static void qf_clean_dir_stack(struct dir_stack_T **stackptr)
{
struct dir_stack_T *ds_ptr;
@ -1253,8 +1241,7 @@ struct dir_stack_T **stackptr;
* Then qf_push_dir thinks we are in ./aa/bb, but we are in ./bb.
* qf_guess_filepath will return NULL.
*/
static char_u * qf_guess_filepath(filename)
char_u *filename;
static char_u *qf_guess_filepath(char_u *filename)
{
struct dir_stack_T *ds_ptr;
struct dir_stack_T *ds_tmp;
@ -1302,11 +1289,7 @@ char_u *filename;
* else if "errornr" is zero, redisplay the same line
* else go to entry "errornr"
*/
void qf_jump(qi, dir, errornr, forceit)
qf_info_T *qi;
int dir;
int errornr;
int forceit;
void qf_jump(qf_info_T *qi, int dir, int errornr, int forceit)
{
qf_info_T *ll_ref;
qfline_T *qf_ptr;
@ -1734,8 +1717,7 @@ theend:
* ":clist": list all errors
* ":llist": list all locations
*/
void qf_list(eap)
exarg_T *eap;
void qf_list(exarg_T *eap)
{
buf_T *buf;
char_u *fname;
@ -1831,10 +1813,7 @@ exarg_T *eap;
* Remove newlines and leading whitespace from an error message.
* Put the result in "buf[bufsize]".
*/
static void qf_fmt_text(text, buf, bufsize)
char_u *text;
char_u *buf;
int bufsize;
static void qf_fmt_text(char_u *text, char_u *buf, int bufsize)
{
int i;
char_u *p = text;
@ -1857,8 +1836,7 @@ int bufsize;
* ":lolder [count]": Up in the location list stack.
* ":lnewer [count]": Down in the location list stack.
*/
void qf_age(eap)
exarg_T *eap;
void qf_age(exarg_T *eap)
{
qf_info_T *qi = &ql_info;
int count;
@ -1893,8 +1871,7 @@ exarg_T *eap;
qf_msg(qi);
}
static void qf_msg(qi)
qf_info_T *qi;
static void qf_msg(qf_info_T *qi)
{
smsg((char_u *)_("error list %d of %d; %d errors"),
qi->qf_curlist + 1, qi->qf_listcount,
@ -1905,9 +1882,7 @@ qf_info_T *qi;
/*
* Free error list "idx".
*/
static void qf_free(qi, idx)
qf_info_T *qi;
int idx;
static void qf_free(qf_info_T *qi, int idx)
{
qfline_T *qfp;
int stop = FALSE;
@ -1935,12 +1910,7 @@ int idx;
/*
* qf_mark_adjust: adjust marks
*/
void qf_mark_adjust(wp, line1, line2, amount, amount_after)
win_T *wp;
linenr_T line1;
linenr_T line2;
long amount;
long amount_after;
void qf_mark_adjust(win_T *wp, linenr_T line1, linenr_T line2, long amount, long amount_after)
{
int i;
qfline_T *qfp;
@ -1983,8 +1953,7 @@ long amount_after;
* other n " c n"
* 1 x "" :helpgrep
*/
static char_u * qf_types(c, nr)
int c, nr;
static char_u *qf_types(int c, int nr)
{
static char_u buf[20];
static char_u cc[3];
@ -2018,8 +1987,7 @@ int c, nr;
* ":lwindow": open the location list window if we have locations to display,
* close it if not.
*/
void ex_cwindow(eap)
exarg_T *eap;
void ex_cwindow(exarg_T *eap)
{
qf_info_T *qi = &ql_info;
win_T *win;
@ -2051,8 +2019,7 @@ exarg_T *eap;
* ":cclose": close the window showing the list of errors.
* ":lclose": close the window showing the location list
*/
void ex_cclose(eap)
exarg_T *eap;
void ex_cclose(exarg_T *eap)
{
win_T *win = NULL;
qf_info_T *qi = &ql_info;
@ -2073,8 +2040,7 @@ exarg_T *eap;
* ":copen": open a window that shows the list of errors.
* ":lopen": open a window that shows the location list.
*/
void ex_copen(eap)
exarg_T *eap;
void ex_copen(exarg_T *eap)
{
qf_info_T *qi = &ql_info;
int height;
@ -2178,8 +2144,7 @@ exarg_T *eap;
* Return the number of the current entry (line number in the quickfix
* window).
*/
linenr_T qf_current_entry(wp)
win_T *wp;
linenr_T qf_current_entry(win_T *wp)
{
qf_info_T *qi = &ql_info;
@ -2194,9 +2159,11 @@ win_T *wp;
* Update the cursor position in the quickfix window to the current error.
* Return TRUE if there is a quickfix window.
*/
static int qf_win_pos_update(qi, old_qf_index)
qf_info_T *qi;
int old_qf_index; /* previous qf_index or zero */
static int
qf_win_pos_update (
qf_info_T *qi,
int old_qf_index /* previous qf_index or zero */
)
{
win_T *win;
int qf_index = qi->qf_lists[qi->qf_curlist].qf_index;
@ -2235,9 +2202,7 @@ int old_qf_index; /* previous qf_index or zero */
* Check whether the given window is displaying the specified quickfix/location
* list buffer
*/
static int is_qf_win(win, qi)
win_T *win;
qf_info_T *qi;
static int is_qf_win(win_T *win, qf_info_T *qi)
{
/*
* A window displaying the quickfix buffer will have the w_llist_ref field
@ -2257,8 +2222,7 @@ qf_info_T *qi;
* Find a window displaying the quickfix/location list 'qi'
* Searches in only the windows opened in the current tab.
*/
static win_T * qf_find_win(qi)
qf_info_T *qi;
static win_T *qf_find_win(qf_info_T *qi)
{
win_T *win;
@ -2273,8 +2237,7 @@ qf_info_T *qi;
* Find a quickfix buffer.
* Searches in windows opened in all the tabs.
*/
static buf_T * qf_find_buf(qi)
qf_info_T *qi;
static buf_T *qf_find_buf(qf_info_T *qi)
{
tabpage_T *tp;
win_T *win;
@ -2289,8 +2252,7 @@ qf_info_T *qi;
/*
* Find the quickfix buffer. If it exists, update the contents.
*/
static void qf_update_buffer(qi)
qf_info_T *qi;
static void qf_update_buffer(qf_info_T *qi)
{
buf_T *buf;
win_T *win;
@ -2321,8 +2283,7 @@ qf_info_T *qi;
}
}
static void qf_set_title(qi)
qf_info_T *qi;
static void qf_set_title(qf_info_T *qi)
{
set_internal_string_var((char_u *)"w:quickfix_title",
qi->qf_lists[qi->qf_curlist].qf_title);
@ -2332,8 +2293,7 @@ qf_info_T *qi;
* Fill current buffer with quickfix errors, replacing any previous contents.
* curbuf must be the quickfix buffer!
*/
static void qf_fill_buffer(qi)
qf_info_T *qi;
static void qf_fill_buffer(qf_info_T *qi)
{
linenr_T lnum;
qfline_T *qfp;
@ -2423,8 +2383,7 @@ qf_info_T *qi;
/*
* Return TRUE if "buf" is the quickfix buffer.
*/
int bt_quickfix(buf)
buf_T *buf;
int bt_quickfix(buf_T *buf)
{
return buf != NULL && buf->b_p_bt[0] == 'q';
}
@ -2433,8 +2392,7 @@ buf_T *buf;
* Return TRUE if "buf" is a "nofile" or "acwrite" buffer.
* This means the buffer name is not a file name.
*/
int bt_nofile(buf)
buf_T *buf;
int bt_nofile(buf_T *buf)
{
return buf != NULL && ((buf->b_p_bt[0] == 'n' && buf->b_p_bt[2] == 'f')
|| buf->b_p_bt[0] == 'a');
@ -2443,14 +2401,12 @@ buf_T *buf;
/*
* Return TRUE if "buf" is a "nowrite" or "nofile" buffer.
*/
int bt_dontwrite(buf)
buf_T *buf;
int bt_dontwrite(buf_T *buf)
{
return buf != NULL && buf->b_p_bt[0] == 'n';
}
int bt_dontwrite_msg(buf)
buf_T *buf;
int bt_dontwrite_msg(buf_T *buf)
{
if (bt_dontwrite(buf)) {
EMSG(_("E382: Cannot write, 'buftype' option is set"));
@ -2463,8 +2419,7 @@ buf_T *buf;
* Return TRUE if the buffer should be hidden, according to 'hidden', ":hide"
* and 'bufhidden'.
*/
int buf_hide(buf)
buf_T *buf;
int buf_hide(buf_T *buf)
{
/* 'bufhidden' overrules 'hidden' and ":hide", check it first */
switch (buf->b_p_bh[0]) {
@ -2479,8 +2434,7 @@ buf_T *buf;
/*
* Return TRUE when using ":vimgrep" for ":grep".
*/
int grep_internal(cmdidx)
cmdidx_T cmdidx;
int grep_internal(cmdidx_T cmdidx)
{
return (cmdidx == CMD_grep
|| cmdidx == CMD_lgrep
@ -2493,8 +2447,7 @@ cmdidx_T cmdidx;
/*
* Used for ":make", ":lmake", ":grep", ":lgrep", ":grepadd", and ":lgrepadd"
*/
void ex_make(eap)
exarg_T *eap;
void ex_make(exarg_T *eap)
{
char_u *fname;
char_u *cmd;
@ -2591,7 +2544,7 @@ exarg_T *eap;
* Find a new unique name when 'makeef' contains "##".
* Returns NULL for error.
*/
static char_u * get_mef_name() {
static char_u *get_mef_name(void) {
char_u *p;
char_u *name;
static int start = -1;
@ -2643,8 +2596,7 @@ static char_u * get_mef_name() {
* ":cc", ":crewind", ":cfirst" and ":clast".
* ":ll", ":lrewind", ":lfirst" and ":llast".
*/
void ex_cc(eap)
exarg_T *eap;
void ex_cc(exarg_T *eap)
{
qf_info_T *qi = &ql_info;
@ -2675,8 +2627,7 @@ exarg_T *eap;
* ":cnext", ":cnfile", ":cNext" and ":cprevious".
* ":lnext", ":lNext", ":lprevious", ":lnfile", ":lNfile" and ":lpfile".
*/
void ex_cnext(eap)
exarg_T *eap;
void ex_cnext(exarg_T *eap)
{
qf_info_T *qi = &ql_info;
@ -2708,8 +2659,7 @@ exarg_T *eap;
* ":cfile"/":cgetfile"/":caddfile" commands.
* ":lfile"/":lgetfile"/":laddfile" commands.
*/
void ex_cfile(eap)
exarg_T *eap;
void ex_cfile(exarg_T *eap)
{
win_T *wp = NULL;
qf_info_T *qi = &ql_info;
@ -2765,8 +2715,7 @@ exarg_T *eap;
* ":lvimgrep {pattern} file(s)"
* ":lvimgrepadd {pattern} file(s)"
*/
void ex_vimgrep(eap)
exarg_T *eap;
void ex_vimgrep(exarg_T *eap)
{
regmmatch_T regmatch;
int fcount;
@ -3103,10 +3052,7 @@ theend:
* If "s" is not NULL terminate the pattern with a NUL.
* Return a pointer to the char just past the pattern plus flags.
*/
char_u * skip_vimgrep_pat(p, s, flags)
char_u *p;
char_u **s;
int *flags;
char_u *skip_vimgrep_pat(char_u *p, char_u **s, int *flags)
{
int c;
@ -3149,8 +3095,7 @@ int *flags;
* Restore current working directory to "dirname_start" if they differ, taking
* into account whether it is set locally or globally.
*/
static void restore_start_dir(dirname_start)
char_u *dirname_start;
static void restore_start_dir(char_u *dirname_start)
{
char_u *dirname_now = alloc(MAXPATHL);
@ -3181,10 +3126,12 @@ char_u *dirname_start;
*
* Returns NULL if it fails.
*/
static buf_T * load_dummy_buffer(fname, dirname_start, resulting_dir)
char_u *fname;
char_u *dirname_start; /* in: old directory */
char_u *resulting_dir; /* out: new directory */
static buf_T *
load_dummy_buffer (
char_u *fname,
char_u *dirname_start, /* in: old directory */
char_u *resulting_dir /* out: new directory */
)
{
buf_T *newbuf;
buf_T *newbuf_to_wipe = NULL;
@ -3258,9 +3205,7 @@ char_u *resulting_dir; /* out: new directory */
* directory to "dirname_start" prior to returning, if autocmds or the
* 'autochdir' option have changed it.
*/
static void wipe_dummy_buffer(buf, dirname_start)
buf_T *buf;
char_u *dirname_start;
static void wipe_dummy_buffer(buf_T *buf, char_u *dirname_start)
{
if (curbuf != buf) { /* safety check */
cleanup_T cs;
@ -3285,9 +3230,7 @@ char_u *dirname_start;
* directory to "dirname_start" prior to returning, if autocmds or the
* 'autochdir' option have changed it.
*/
static void unload_dummy_buffer(buf, dirname_start)
buf_T *buf;
char_u *dirname_start;
static void unload_dummy_buffer(buf_T *buf, char_u *dirname_start)
{
if (curbuf != buf) { /* safety check */
close_buffer(NULL, buf, DOBUF_UNLOAD, FALSE);
@ -3300,9 +3243,7 @@ char_u *dirname_start;
/*
* Add each quickfix error to list "list" as a dictionary.
*/
int get_errorlist(wp, list)
win_T *wp;
list_T *list;
int get_errorlist(win_T *wp, list_T *list)
{
qf_info_T *qi = &ql_info;
dict_T *dict;
@ -3357,11 +3298,7 @@ list_T *list;
* Populate the quickfix list with the items supplied in the list
* of dictionaries. "title" will be copied to w:quickfix_title
*/
int set_errorlist(wp, list, action, title)
win_T *wp;
list_T *list;
int action;
char_u *title;
int set_errorlist(win_T *wp, list_T *list, int action, char_u *title)
{
listitem_T *li;
dict_T *d;
@ -3473,8 +3410,7 @@ char_u *title;
* ":[range]laddbuffer [bufnr]" command.
* ":[range]lgetbuffer [bufnr]" command.
*/
void ex_cbuffer(eap)
exarg_T *eap;
void ex_cbuffer(exarg_T *eap)
{
buf_T *buf = NULL;
qf_info_T *qi = &ql_info;
@ -3527,8 +3463,7 @@ exarg_T *eap;
* ":cexpr {expr}", ":cgetexpr {expr}", ":caddexpr {expr}" command.
* ":lexpr {expr}", ":lgetexpr {expr}", ":laddexpr {expr}" command.
*/
void ex_cexpr(eap)
exarg_T *eap;
void ex_cexpr(exarg_T *eap)
{
typval_T *tv;
qf_info_T *qi = &ql_info;
@ -3562,8 +3497,7 @@ exarg_T *eap;
/*
* ":helpgrep {pattern}"
*/
void ex_helpgrep(eap)
exarg_T *eap;
void ex_helpgrep(exarg_T *eap)
{
regmatch_T regmatch;
char_u *save_cpo;

View File

@ -255,16 +255,14 @@
static int no_Magic __ARGS((int x));
static int toggle_Magic __ARGS((int x));
static int no_Magic(x)
int x;
static int no_Magic(int x)
{
if (is_Magic(x))
return un_Magic(x);
return x;
}
static int toggle_Magic(x)
int x;
static int toggle_Magic(int x)
{
if (is_Magic(x))
return un_Magic(x);
@ -376,8 +374,7 @@ static char_u e_empty_sb[] = N_("E70: Empty %s%%[]");
* Return MULTI_ONE if c is a single "multi" operator.
* Return MULTI_MULT if c is a multi "multi" operator.
*/
static int re_multi_type(c)
int c;
static int re_multi_type(int c)
{
if (c == Magic('@') || c == Magic('=') || c == Magic('?'))
return MULTI_ONE;
@ -434,8 +431,7 @@ static void init_class_tab __ARGS((void));
/*
* Translate '\x' to its control character, except "\n", which is Magic.
*/
static int backslash_trans(c)
int c;
static int backslash_trans(int c)
{
switch (c) {
case 'r': return CAR;
@ -451,8 +447,7 @@ int c;
* Returns one of the CLASS_ items. CLASS_NONE means that no item was
* recognized. Otherwise "pp" is advanced to after the item.
*/
static int get_char_class(pp)
char_u **pp;
static int get_char_class(char_u **pp)
{
static const char *(class_names[]) =
{
@ -518,7 +513,7 @@ static short class_tab[256];
#define RI_UPPER 0x80
#define RI_WHITE 0x100
static void init_class_tab() {
static void init_class_tab(void) {
int i;
static int done = FALSE;
@ -687,8 +682,7 @@ static regengine_T nfa_regengine;
/*
* Return TRUE if compiled regular expression "prog" can match a line break.
*/
int re_multiline(prog)
regprog_T *prog;
int re_multiline(regprog_T *prog)
{
return prog->regflags & RF_HASNL;
}
@ -697,8 +691,7 @@ regprog_T *prog;
* Return TRUE if compiled regular expression "prog" looks before the start
* position (pattern contains "\@<=" or "\@<!").
*/
int re_lookbehind(prog)
regprog_T *prog;
int re_lookbehind(regprog_T *prog)
{
return prog->regflags & RF_LOOKBH;
}
@ -708,8 +701,7 @@ regprog_T *prog;
* Returns a character representing the class. Zero means that no item was
* recognized. Otherwise "pp" is advanced to after the item.
*/
static int get_equi_class(pp)
char_u **pp;
static int get_equi_class(char_u **pp)
{
int c;
int l = 1;
@ -736,8 +728,7 @@ char_u **pp;
* Currently only handles latin1, latin9 and utf-8.
* NOTE: When changing this function, also change nfa_emit_equi_class()
*/
static void reg_equi_class(c)
int c;
static void reg_equi_class(int c)
{
if (enc_utf8 || STRCMP(p_enc, "latin1") == 0
|| STRCMP(p_enc, "iso-8859-15") == 0) {
@ -1044,8 +1035,7 @@ int c;
* "pp" is advanced to after the item.
* Currently only single characters are recognized!
*/
static int get_coll_element(pp)
char_u **pp;
static int get_coll_element(char_u **pp)
{
int c;
int l = 1;
@ -1070,7 +1060,7 @@ static void get_cpo_flags __ARGS((void));
static int reg_cpo_lit; /* 'cpoptions' contains 'l' flag */
static int reg_cpo_bsl; /* 'cpoptions' contains '\' flag */
static void get_cpo_flags() {
static void get_cpo_flags(void) {
reg_cpo_lit = vim_strchr(p_cpo, CPO_LITERAL) != NULL;
reg_cpo_bsl = vim_strchr(p_cpo, CPO_BACKSL) != NULL;
}
@ -1080,8 +1070,7 @@ static void get_cpo_flags() {
* "p" must point to the character after the '['.
* The returned pointer is on the matching ']', or the terminating NUL.
*/
static char_u * skip_anyof(p)
char_u *p;
static char_u *skip_anyof(char_u *p)
{
int l;
@ -1122,11 +1111,7 @@ char_u *p;
* expression and change "\?" to "?". If "*newp" is not NULL the expression
* is changed in-place.
*/
char_u * skip_regexp(startp, dirc, magic, newp)
char_u *startp;
int dirc;
int magic;
char_u **newp;
char_u *skip_regexp(char_u *startp, int dirc, int magic, char_u **newp)
{
int mymagic;
char_u *p = startp;
@ -1192,9 +1177,7 @@ static void bt_regfree __ARGS((regprog_T *prog));
* of the structure of the compiled regexp.
* "re_flags": RE_MAGIC and/or RE_STRING.
*/
static regprog_T * bt_regcomp(expr, re_flags)
char_u *expr;
int re_flags;
static regprog_T *bt_regcomp(char_u *expr, int re_flags)
{
bt_regprog_T *r;
char_u *scan;
@ -1314,8 +1297,7 @@ int re_flags;
/*
* Free a compiled regexp program, returned by bt_regcomp().
*/
static void bt_regfree(prog)
regprog_T *prog;
static void bt_regfree(regprog_T *prog)
{
vim_free(prog);
}
@ -1323,9 +1305,11 @@ regprog_T *prog;
/*
* Setup to parse the regexp. Used once to get the length and once to do it.
*/
static void regcomp_start(expr, re_flags)
char_u *expr;
int re_flags; /* see vim_regcomp() */
static void
regcomp_start (
char_u *expr,
int re_flags /* see vim_regcomp() */
)
{
initchr(expr);
if (re_flags & RE_MAGIC)
@ -1351,7 +1335,7 @@ int re_flags; /* see vim_regcomp() */
* Check if during the previous call to vim_regcomp the EOL item "$" has been
* found. This is messy, but it works fine.
*/
int vim_regcomp_had_eol() {
int vim_regcomp_had_eol(void) {
return had_eol;
}
@ -1364,9 +1348,11 @@ int vim_regcomp_had_eol() {
* is a trifle forced, but the need to tie the tails of the branches to what
* follows makes it hard to avoid.
*/
static char_u * reg(paren, flagp)
int paren; /* REG_NOPAREN, REG_PAREN, REG_NPAREN or REG_ZPAREN */
int *flagp;
static char_u *
reg (
int paren, /* REG_NOPAREN, REG_PAREN, REG_NPAREN or REG_ZPAREN */
int *flagp
)
{
char_u *ret;
char_u *br;
@ -1460,8 +1446,7 @@ int *flagp;
* Parse one alternative of an | operator.
* Implements the & operator.
*/
static char_u * regbranch(flagp)
int *flagp;
static char_u *regbranch(int *flagp)
{
char_u *ret;
char_u *chain = NULL;
@ -1501,8 +1486,7 @@ int *flagp;
* Parse one alternative of an | or & operator.
* Implements the concatenation operator.
*/
static char_u * regconcat(flagp)
int *flagp;
static char_u *regconcat(int *flagp)
{
char_u *first = NULL;
char_u *chain = NULL;
@ -1581,8 +1565,7 @@ int *flagp;
* It might seem that this node could be dispensed with entirely, but the
* endmarker role is not redundant.
*/
static char_u * regpiece(flagp)
int *flagp;
static char_u *regpiece(int *flagp)
{
char_u *ret;
int op;
@ -1728,8 +1711,7 @@ static int classcodes[] = {
* it can turn them into a single node, which is smaller to store and
* faster to run. Don't do this when one_exactly is set.
*/
static char_u * regatom(flagp)
int *flagp;
static char_u *regatom(int *flagp)
{
char_u *ret;
int flags;
@ -2427,8 +2409,7 @@ do_multibyte:
* Return TRUE if MULTIBYTECODE should be used instead of EXACTLY for
* character "c".
*/
static int use_multibytecode(c)
int c;
static int use_multibytecode(int c)
{
return has_mbyte && (*mb_char2len)(c) > 1
&& (re_multi_type(peekchr()) != NOT_MULTI
@ -2439,8 +2420,7 @@ int c;
* Emit a node.
* Return pointer to generated code.
*/
static char_u * regnode(op)
int op;
static char_u *regnode(int op)
{
char_u *ret;
@ -2458,8 +2438,7 @@ int op;
/*
* Emit (if appropriate) a byte of code
*/
static void regc(b)
int b;
static void regc(int b)
{
if (regcode == JUST_CALC_SIZE)
regsize++;
@ -2470,8 +2449,7 @@ int b;
/*
* Emit (if appropriate) a multi-byte character of code
*/
static void regmbc(c)
int c;
static void regmbc(int c)
{
if (!has_mbyte && c > 0xff)
return;
@ -2486,9 +2464,7 @@ int c;
*
* Means relocating the operand.
*/
static void reginsert(op, opnd)
int op;
char_u *opnd;
static void reginsert(int op, char_u *opnd)
{
char_u *src;
char_u *dst;
@ -2514,10 +2490,7 @@ char_u *opnd;
* Insert an operator in front of already-emitted operand.
* Add a number to the operator.
*/
static void reginsert_nr(op, val, opnd)
int op;
long val;
char_u *opnd;
static void reginsert_nr(int op, long val, char_u *opnd)
{
char_u *src;
char_u *dst;
@ -2546,11 +2519,7 @@ char_u *opnd;
*
* Means relocating the operand.
*/
static void reginsert_limits(op, minval, maxval, opnd)
int op;
long minval;
long maxval;
char_u *opnd;
static void reginsert_limits(int op, long minval, long maxval, char_u *opnd)
{
char_u *src;
char_u *dst;
@ -2578,9 +2547,7 @@ char_u *opnd;
/*
* Write a long as four bytes at "p" and return pointer to the next char.
*/
static char_u * re_put_long(p, val)
char_u *p;
long_u val;
static char_u *re_put_long(char_u *p, long_u val)
{
*p++ = (char_u) ((val >> 24) & 0377);
*p++ = (char_u) ((val >> 16) & 0377);
@ -2592,9 +2559,7 @@ long_u val;
/*
* Set the next-pointer at the end of a node chain.
*/
static void regtail(p, val)
char_u *p;
char_u *val;
static void regtail(char_u *p, char_u *val)
{
char_u *scan;
char_u *temp;
@ -2630,9 +2595,7 @@ char_u *val;
/*
* Like regtail, on item after a BRANCH; nop if none.
*/
static void regoptail(p, val)
char_u *p;
char_u *val;
static void regoptail(char_u *p, char_u *val)
{
/* When op is neither BRANCH nor BRACE_COMPLEX0-9, it is "operandless" */
if (p == NULL || p == JUST_CALC_SIZE
@ -2652,8 +2615,7 @@ static int prev_at_start; /* True when on the second character */
/*
* Start parsing at "str".
*/
static void initchr(str)
char_u *str;
static void initchr(char_u *str)
{
regparse = str;
prevchr_len = 0;
@ -2666,8 +2628,7 @@ char_u *str;
* Save the current parse state, so that it can be restored and parsing
* starts in the same state again.
*/
static void save_parse_state(ps)
parse_state_T *ps;
static void save_parse_state(parse_state_T *ps)
{
ps->regparse = regparse;
ps->prevchr_len = prevchr_len;
@ -2683,8 +2644,7 @@ parse_state_T *ps;
/*
* Restore a previously saved parse state.
*/
static void restore_parse_state(ps)
parse_state_T *ps;
static void restore_parse_state(parse_state_T *ps)
{
regparse = ps->regparse;
prevchr_len = ps->prevchr_len;
@ -2701,7 +2661,7 @@ parse_state_T *ps;
/*
* Get the next character without advancing.
*/
static int peekchr() {
static int peekchr(void) {
static int after_slash = FALSE;
if (curchr == -1) {
@ -2844,7 +2804,7 @@ static int peekchr() {
/*
* Eat one lexed character. Do this in a way that we can undo it.
*/
static void skipchr() {
static void skipchr(void) {
/* peekchr() eats a backslash, do the same here */
if (*regparse == '\\')
prevchr_len = 1;
@ -2872,7 +2832,7 @@ static void skipchr() {
* Skip a character while keeping the value of prev_at_start for at_start.
* prevchr and prevprevchr are also kept.
*/
static void skipchr_keepstart() {
static void skipchr_keepstart(void) {
int as = prev_at_start;
int pr = prevchr;
int prpr = prevprevchr;
@ -2887,7 +2847,7 @@ static void skipchr_keepstart() {
* Get the next character from the pattern. We know about magic and such, so
* therefore we need a lexical analyzer.
*/
static int getchr() {
static int getchr(void) {
int chr = peekchr();
skipchr();
@ -2897,7 +2857,7 @@ static int getchr() {
/*
* put character back. Works only once!
*/
static void ungetchr() {
static void ungetchr(void) {
nextchr = curchr;
curchr = prevchr;
prevchr = prevprevchr;
@ -2918,8 +2878,7 @@ static void ungetchr() {
* The parameter controls the maximum number of input characters. This will be
* 2 when reading a \%x20 sequence and 4 when reading a \%u20AC sequence.
*/
static int gethexchrs(maxinputlen)
int maxinputlen;
static int gethexchrs(int maxinputlen)
{
int nr = 0;
int c;
@ -2943,7 +2902,7 @@ int maxinputlen;
* Get and return the value of the decimal string immediately after the
* current position. Return -1 for invalid. Consumes all digits.
*/
static int getdecchrs() {
static int getdecchrs(void) {
int nr = 0;
int c;
int i;
@ -2971,7 +2930,7 @@ static int getdecchrs() {
* blahblah\%o210asdf
* before-^ ^-after
*/
static int getoctchrs() {
static int getoctchrs(void) {
int nr = 0;
int c;
int i;
@ -2994,7 +2953,7 @@ static int getoctchrs() {
* Get a number after a backslash that is inside [].
* When nothing is recognized return a backslash.
*/
static int coll_get_char() {
static int coll_get_char(void) {
int nr = -1;
switch (*regparse++) {
@ -3019,9 +2978,7 @@ static int coll_get_char() {
* Should end with 'end'. If minval is missing, zero is default, if maxval is
* missing, a very big number is the default.
*/
static int read_limits(minval, maxval)
long *minval;
long *maxval;
static int read_limits(long *minval, long *maxval)
{
int reverse = FALSE;
char_u *first_char;
@ -3282,7 +3239,7 @@ static garray_T backpos = {0, 0, 0, 0, NULL};
#define BACKPOS_INITIAL 64
#if defined(EXITFREE) || defined(PROTO)
void free_regexp_stuff() {
void free_regexp_stuff(void) {
ga_clear(&regstack);
ga_clear(&backpos);
vim_free(reg_tofree);
@ -3294,8 +3251,7 @@ void free_regexp_stuff() {
/*
* Get pointer to the line "lnum", which is relative to "reg_firstlnum".
*/
static char_u * reg_getline(lnum)
linenr_T lnum;
static char_u *reg_getline(linenr_T lnum)
{
/* when looking behind for a match/no-match lnum is negative. But we
* can't go before line 1 */
@ -3326,10 +3282,12 @@ static int bt_regexec __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
*
* Return TRUE if there is a match, FALSE if not.
*/
static int bt_regexec(rmp, line, col)
regmatch_T *rmp;
char_u *line; /* string to match against */
colnr_T col; /* column to start looking for match */
static int
bt_regexec (
regmatch_T *rmp,
char_u *line, /* string to match against */
colnr_T col /* column to start looking for match */
)
{
reg_match = rmp;
reg_mmatch = NULL;
@ -3351,10 +3309,12 @@ static int bt_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
/*
* Like vim_regexec(), but consider a "\n" in "line" to be a line break.
*/
static int bt_regexec_nl(rmp, line, col)
regmatch_T *rmp;
char_u *line; /* string to match against */
colnr_T col; /* column to start looking for match */
static int
bt_regexec_nl (
regmatch_T *rmp,
char_u *line, /* string to match against */
colnr_T col /* column to start looking for match */
)
{
reg_match = rmp;
reg_mmatch = NULL;
@ -3414,7 +3374,7 @@ proftime_T *tm; /* timeout limit or NULL */
static long bt_regexec_both(line, col, tm)
char_u *line;
colnr_T col; /* column to start looking for match */
proftime_T *tm UNUSED; /* timeout limit or NULL */
proftime_T *tm; /* timeout limit or NULL */
{
bt_regprog_T *prog;
char_u *s;
@ -3602,7 +3562,7 @@ static reg_extmatch_T *make_extmatch __ARGS((void));
/*
* Create a new extmatch and mark it as referenced once.
*/
static reg_extmatch_T * make_extmatch() {
static reg_extmatch_T *make_extmatch(void) {
reg_extmatch_T *em;
em = (reg_extmatch_T *)alloc_clear((unsigned)sizeof(reg_extmatch_T));
@ -3614,8 +3574,7 @@ static reg_extmatch_T * make_extmatch() {
/*
* Add a reference to an extmatch.
*/
reg_extmatch_T * ref_extmatch(em)
reg_extmatch_T *em;
reg_extmatch_T *ref_extmatch(reg_extmatch_T *em)
{
if (em != NULL)
em->refcnt++;
@ -3626,8 +3585,7 @@ reg_extmatch_T *em;
* Remove a reference to an extmatch. If there are no references left, free
* the info.
*/
void unref_extmatch(em)
reg_extmatch_T *em;
void unref_extmatch(reg_extmatch_T *em)
{
int i;
@ -3642,9 +3600,7 @@ reg_extmatch_T *em;
* regtry - try match of "prog" with at regline["col"].
* Returns 0 for failure, number of lines contained in the match otherwise.
*/
static long regtry(prog, col)
bt_regprog_T *prog;
colnr_T col;
static long regtry(bt_regprog_T *prog, colnr_T col)
{
reginput = regline + col;
need_clear_subexpr = TRUE;
@ -3707,7 +3663,7 @@ static int reg_prev_class __ARGS((void));
/*
* Get class of previous character.
*/
static int reg_prev_class() {
static int reg_prev_class(void) {
if (reginput > regline)
return mb_get_class_buf(reginput - 1
- (*mb_head_off)(regline, reginput - 1), reg_buf);
@ -3719,7 +3675,7 @@ static int reg_match_visual __ARGS((void));
/*
* Return TRUE if the current reginput position matches the Visual area.
*/
static int reg_match_visual() {
static int reg_match_visual(void) {
pos_T top, bot;
linenr_T lnum;
colnr_T col;
@ -3802,8 +3758,10 @@ static long bl_maxval;
* Returns FALSE when there is no match. Leaves reginput and reglnum in an
* undefined state!
*/
static int regmatch(scan)
char_u *scan; /* Current node. */
static int
regmatch (
char_u *scan /* Current node. */
)
{
char_u *next; /* Next node. */
int op;
@ -5103,9 +5061,7 @@ char_u *scan; /* Current node. */
* Push an item onto the regstack.
* Returns pointer to new item. Returns NULL when out of memory.
*/
static regitem_T * regstack_push(state, scan)
regstate_T state;
char_u *scan;
static regitem_T *regstack_push(regstate_T state, char_u *scan)
{
regitem_T *rp;
@ -5127,8 +5083,7 @@ char_u *scan;
/*
* Pop an item from the regstack.
*/
static void regstack_pop(scan)
char_u **scan;
static void regstack_pop(char_u **scan)
{
regitem_T *rp;
@ -5142,9 +5097,11 @@ char_u **scan;
* regrepeat - repeatedly match something simple, return how many.
* Advances reginput (and reglnum) to just after the matched chars.
*/
static int regrepeat(p, maxcount)
char_u *p;
long maxcount; /* maximum number of matches allowed */
static int
regrepeat (
char_u *p,
long maxcount /* maximum number of matches allowed */
)
{
long count = 0;
char_u *scan;
@ -5486,8 +5443,7 @@ do_class:
* Returns NULL when calculating size, when there is no next item and when
* there is an error.
*/
static char_u * regnext(p)
char_u *p;
static char_u *regnext(char_u *p)
{
int offset;
@ -5508,7 +5464,7 @@ char_u *p;
* Check the regexp program for its magic number.
* Return TRUE if it's wrong.
*/
static int prog_magic_wrong() {
static int prog_magic_wrong(void) {
regprog_T *prog;
prog = REG_MULTI ? reg_mmatch->regprog : reg_match->regprog;
@ -5528,7 +5484,7 @@ static int prog_magic_wrong() {
* This construction is used to clear the subexpressions only when they are
* used (to increase speed).
*/
static void cleanup_subexpr() {
static void cleanup_subexpr(void) {
if (need_clear_subexpr) {
if (REG_MULTI) {
/* Use 0xff to set lnum to -1 */
@ -5542,7 +5498,7 @@ static void cleanup_subexpr() {
}
}
static void cleanup_zsubexpr() {
static void cleanup_zsubexpr(void) {
if (need_clear_zsubexpr) {
if (REG_MULTI) {
/* Use 0xff to set lnum to -1 */
@ -5560,8 +5516,7 @@ static void cleanup_zsubexpr() {
* Save the current subexpr to "bp", so that they can be restored
* later by restore_subexpr().
*/
static void save_subexpr(bp)
regbehind_T *bp;
static void save_subexpr(regbehind_T *bp)
{
int i;
@ -5584,8 +5539,7 @@ regbehind_T *bp;
/*
* Restore the subexpr from "bp".
*/
static void restore_subexpr(bp)
regbehind_T *bp;
static void restore_subexpr(regbehind_T *bp)
{
int i;
@ -5607,7 +5561,7 @@ regbehind_T *bp;
/*
* Advance reglnum, regline and reginput to the next line.
*/
static void reg_nextline() {
static void reg_nextline(void) {
regline = reg_getline(++reglnum);
reginput = regline;
fast_breakcheck();
@ -5616,9 +5570,7 @@ static void reg_nextline() {
/*
* Save the input line and position in a regsave_T.
*/
static void reg_save(save, gap)
regsave_T *save;
garray_T *gap;
static void reg_save(regsave_T *save, garray_T *gap)
{
if (REG_MULTI) {
save->rs_u.pos.col = (colnr_T)(reginput - regline);
@ -5631,9 +5583,7 @@ garray_T *gap;
/*
* Restore the input line and position from a regsave_T.
*/
static void reg_restore(save, gap)
regsave_T *save;
garray_T *gap;
static void reg_restore(regsave_T *save, garray_T *gap)
{
if (REG_MULTI) {
if (reglnum != save->rs_u.pos.lnum) {
@ -5651,8 +5601,7 @@ garray_T *gap;
/*
* Return TRUE if current position is equal to saved position.
*/
static int reg_save_equal(save)
regsave_T *save;
static int reg_save_equal(regsave_T *save)
{
if (REG_MULTI)
return reglnum == save->rs_u.pos.lnum
@ -5667,18 +5616,14 @@ regsave_T *save;
* Use se_save() to use pointer (save_se_multi()) or position (save_se_one()),
* depending on REG_MULTI.
*/
static void save_se_multi(savep, posp)
save_se_T *savep;
lpos_T *posp;
static void save_se_multi(save_se_T *savep, lpos_T *posp)
{
savep->se_u.pos = *posp;
posp->lnum = reglnum;
posp->col = (colnr_T)(reginput - regline);
}
static void save_se_one(savep, pp)
save_se_T *savep;
char_u **pp;
static void save_se_one(save_se_T *savep, char_u **pp)
{
savep->se_u.ptr = *pp;
*pp = reginput;
@ -5687,9 +5632,7 @@ char_u **pp;
/*
* Compare a number with the operand of RE_LNUM, RE_COL or RE_VCOL.
*/
static int re_num_cmp(val, scan)
long_u val;
char_u *scan;
static int re_num_cmp(long_u val, char_u *scan)
{
long_u n = OPERAND_MIN(scan);
@ -5706,12 +5649,7 @@ char_u *scan;
* If "bytelen" is not NULL, it is set to the byte length of the match in the
* last line.
*/
static int match_with_backref(start_lnum, start_col, end_lnum, end_col, bytelen)
linenr_T start_lnum;
colnr_T start_col;
linenr_T end_lnum;
colnr_T end_col;
int *bytelen;
static int match_with_backref(linenr_T start_lnum, colnr_T start_col, linenr_T end_lnum, colnr_T end_col, int *bytelen)
{
linenr_T clnum = start_lnum;
colnr_T ccol = start_col;
@ -5774,9 +5712,7 @@ int *bytelen;
/*
* regdump - dump a regexp onto stdout in vaguely comprehensible form
*/
static void regdump(pattern, r)
char_u *pattern;
bt_regprog_T *r;
static void regdump(char_u *pattern, bt_regprog_T *r)
{
char_u *s;
int op = EXACTLY; /* Arbitrary non-END op. */
@ -5857,8 +5793,7 @@ bt_regprog_T *r;
/*
* regprop - printable representation of opcode
*/
static char_u * regprop(op)
char_u *op;
static char_u *regprop(char_u *op)
{
char *p;
static char buf[50];
@ -6265,21 +6200,21 @@ static decomp_T decomp_table[0xfb4f-0xfb20+1] =
{0x5d4, 0x5bc, 0}, /* 0xfb34 he+dagesh */
{0x5d5, 0x5bc, 0}, /* 0xfb35 vav+dagesh */
{0x5d6, 0x5bc, 0}, /* 0xfb36 zayin+dagesh */
{0xfb37, 0, 0}, /* 0xfb37 -- UNUSED */
{0xfb37, 0, 0}, /* 0xfb37 -- */
{0x5d8, 0x5bc, 0}, /* 0xfb38 tet+dagesh */
{0x5d9, 0x5bc, 0}, /* 0xfb39 yud+dagesh */
{0x5da, 0x5bc, 0}, /* 0xfb3a kaf sofit+dagesh */
{0x5db, 0x5bc, 0}, /* 0xfb3b kaf+dagesh */
{0x5dc, 0x5bc, 0}, /* 0xfb3c lamed+dagesh */
{0xfb3d, 0, 0}, /* 0xfb3d -- UNUSED */
{0xfb3d, 0, 0}, /* 0xfb3d -- */
{0x5de, 0x5bc, 0}, /* 0xfb3e mem+dagesh */
{0xfb3f, 0, 0}, /* 0xfb3f -- UNUSED */
{0xfb3f, 0, 0}, /* 0xfb3f -- */
{0x5e0, 0x5bc, 0}, /* 0xfb40 nun+dagesh */
{0x5e1, 0x5bc, 0}, /* 0xfb41 samech+dagesh */
{0xfb42, 0, 0}, /* 0xfb42 -- UNUSED */
{0xfb42, 0, 0}, /* 0xfb42 -- */
{0x5e3, 0x5bc, 0}, /* 0xfb43 pe sofit+dagesh */
{0x5e4, 0x5bc,0}, /* 0xfb44 pe+dagesh */
{0xfb45, 0, 0}, /* 0xfb45 -- UNUSED */
{0xfb45, 0, 0}, /* 0xfb45 -- */
{0x5e6, 0x5bc, 0}, /* 0xfb46 tsadi+dagesh */
{0x5e7, 0x5bc, 0}, /* 0xfb47 qof+dagesh */
{0x5e8, 0x5bc, 0}, /* 0xfb48 resh+dagesh */
@ -6292,8 +6227,7 @@ static decomp_T decomp_table[0xfb4f-0xfb20+1] =
{0x5d0, 0x5dc, 0} /* 0xfb4f alef-lamed */
};
static void mb_decompose(c, c1, c2, c3)
int c, *c1, *c2, *c3;
static void mb_decompose(int c, int *c1, int *c2, int *c3)
{
decomp_T d;
@ -6313,9 +6247,7 @@ int c, *c1, *c2, *c3;
* Return 0 if strings match, non-zero otherwise.
* Correct the length "*n" when composing characters are ignored.
*/
static int cstrncmp(s1, s2, n)
char_u *s1, *s2;
int *n;
static int cstrncmp(char_u *s1, char_u *s2, int *n)
{
int result;
@ -6363,9 +6295,7 @@ int *n;
/*
* cstrchr: This function is used a lot for simple searches, keep it fast!
*/
static char_u * cstrchr(s, c)
char_u *s;
int c;
static char_u *cstrchr(char_u *s, int c)
{
char_u *p;
int cc;
@ -6475,9 +6405,7 @@ int c;
*
* The tildes are parsed once before the first call to vim_regsub().
*/
char_u * regtilde(source, magic)
char_u *source;
int magic;
char_u *regtilde(char_u *source, int magic)
{
char_u *newsub = source;
char_u *tmpsub;
@ -6557,13 +6485,7 @@ static int submatch_line_lbr;
*
* Returns the size of the replacement, including terminating NUL.
*/
int vim_regsub(rmp, source, dest, copy, magic, backslash)
regmatch_T *rmp;
char_u *source;
char_u *dest;
int copy;
int magic;
int backslash;
int vim_regsub(regmatch_T *rmp, char_u *source, char_u *dest, int copy, int magic, int backslash)
{
reg_match = rmp;
reg_mmatch = NULL;
@ -6572,14 +6494,7 @@ int backslash;
return vim_regsub_both(source, dest, copy, magic, backslash);
}
int vim_regsub_multi(rmp, lnum, source, dest, copy, magic, backslash)
regmmatch_T *rmp;
linenr_T lnum;
char_u *source;
char_u *dest;
int copy;
int magic;
int backslash;
int vim_regsub_multi(regmmatch_T *rmp, linenr_T lnum, char_u *source, char_u *dest, int copy, int magic, int backslash)
{
reg_match = NULL;
reg_mmatch = rmp;
@ -6589,12 +6504,7 @@ int backslash;
return vim_regsub_both(source, dest, copy, magic, backslash);
}
static int vim_regsub_both(source, dest, copy, magic, backslash)
char_u *source;
char_u *dest;
int copy;
int magic;
int backslash;
static int vim_regsub_both(char_u *source, char_u *dest, int copy, int magic, int backslash)
{
char_u *src;
char_u *dst;
@ -6902,8 +6812,7 @@ static char_u *reg_getline_submatch __ARGS((linenr_T lnum));
* substitute() was used the reg_maxline and other values have been
* overwritten.
*/
static char_u * reg_getline_submatch(lnum)
linenr_T lnum;
static char_u *reg_getline_submatch(linenr_T lnum)
{
char_u *s;
linenr_T save_first = reg_firstlnum;
@ -6924,8 +6833,7 @@ linenr_T lnum;
* allocated memory.
* Returns NULL when not in a ":s" command and for a non-existing submatch.
*/
char_u * reg_submatch(no)
int no;
char_u *reg_submatch(int no)
{
char_u *retval = NULL;
char_u *s;
@ -7054,9 +6962,7 @@ static char_u regname[][30] = {
* Use vim_regfree() to free the memory.
* Returns NULL for an error.
*/
regprog_T * vim_regcomp(expr_arg, re_flags)
char_u *expr_arg;
int re_flags;
regprog_T *vim_regcomp(char_u *expr_arg, int re_flags)
{
regprog_T *prog = NULL;
char_u *expr = expr_arg;
@ -7122,8 +7028,7 @@ int re_flags;
/*
* Free a compiled regexp program, returned by vim_regcomp().
*/
void vim_regfree(prog)
regprog_T *prog;
void vim_regfree(regprog_T *prog)
{
if (prog != NULL)
prog->engine->regfree(prog);
@ -7136,10 +7041,12 @@ regprog_T *prog;
*
* Return TRUE if there is a match, FALSE if not.
*/
int vim_regexec(rmp, line, col)
regmatch_T *rmp;
char_u *line; /* string to match against */
colnr_T col; /* column to start looking for match */
int
vim_regexec (
regmatch_T *rmp,
char_u *line, /* string to match against */
colnr_T col /* column to start looking for match */
)
{
return rmp->regprog->engine->regexec(rmp, line, col);
}
@ -7149,10 +7056,7 @@ colnr_T col; /* column to start looking for match */
/*
* Like vim_regexec(), but consider a "\n" in "line" to be a line break.
*/
int vim_regexec_nl(rmp, line, col)
regmatch_T *rmp;
char_u *line;
colnr_T col;
int vim_regexec_nl(regmatch_T *rmp, char_u *line, colnr_T col)
{
return rmp->regprog->engine->regexec_nl(rmp, line, col);
}

View File

@ -327,9 +327,11 @@ static int failure_chance __ARGS((nfa_state_T *state, int depth));
* Initialize internal variables before NFA compilation.
* Return OK on success, FAIL otherwise.
*/
static int nfa_regcomp_start(expr, re_flags)
char_u *expr;
int re_flags; /* see vim_regcomp() */
static int
nfa_regcomp_start (
char_u *expr,
int re_flags /* see vim_regcomp() */
)
{
size_t postfix_size;
int nstate_max;
@ -364,9 +366,7 @@ int re_flags; /* see vim_regcomp() */
* Figure out if the NFA state list starts with an anchor, must match at start
* of the line.
*/
static int nfa_get_reganch(start, depth)
nfa_state_T *start;
int depth;
static int nfa_get_reganch(nfa_state_T *start, int depth)
{
nfa_state_T *p = start;
@ -423,9 +423,7 @@ int depth;
* Figure out if the NFA state list starts with a character which must match
* at start of the match.
*/
static int nfa_get_regstart(start, depth)
nfa_state_T *start;
int depth;
static int nfa_get_regstart(nfa_state_T *start, int depth)
{
nfa_state_T *p = start;
@ -504,8 +502,7 @@ int depth;
* else. If so return a string in allocated memory with what must match after
* regstart. Otherwise return NULL.
*/
static char_u * nfa_get_match_text(start)
nfa_state_T *start;
static char_u *nfa_get_match_text(nfa_state_T *start)
{
nfa_state_T *p = start;
int len = 0;
@ -543,7 +540,7 @@ nfa_state_T *start;
* Allocate more space for post_start. Called when
* running above the estimated number of states.
*/
static int realloc_post_list() {
static int realloc_post_list(void) {
int nstate_max = (int)(post_end - post_start);
int new_max = nstate_max + 1000;
int *new_start;
@ -571,10 +568,7 @@ static int realloc_post_list() {
* Keep in mind that 'ignorecase' applies at execution time, thus [a-z] may
* need to be interpreted as [a-zA-Z].
*/
static int nfa_recognize_char_class(start, end, extra_newl)
char_u *start;
char_u *end;
int extra_newl;
static int nfa_recognize_char_class(char_u *start, char_u *end, int extra_newl)
{
# define CLASS_not 0x80
# define CLASS_af 0x40
@ -696,8 +690,7 @@ int extra_newl;
*
* NOTE! When changing this function, also update reg_equi_class()
*/
static int nfa_emit_equi_class(c)
int c;
static int nfa_emit_equi_class(int c)
{
#define EMIT2(c) EMIT(c); EMIT(NFA_CONCAT);
# define EMITMBC(c) EMIT(c); EMIT(NFA_CONCAT);
@ -1061,7 +1054,7 @@ int c;
* or \%( pattern \)
* or \z( pattern \)
*/
static int nfa_regatom() {
static int nfa_regatom(void) {
int c;
int charclass;
int equiclass;
@ -1740,7 +1733,7 @@ nfa_do_multibyte:
* piece ::= atom
* or atom multi
*/
static int nfa_regpiece() {
static int nfa_regpiece(void) {
int i;
int op;
int ret;
@ -1931,7 +1924,7 @@ static int nfa_regpiece() {
* or piece piece piece
* etc.
*/
static int nfa_regconcat() {
static int nfa_regconcat(void) {
int cont = TRUE;
int first = TRUE;
@ -2003,7 +1996,7 @@ static int nfa_regconcat() {
* or concat \& concat \& concat
* etc.
*/
static int nfa_regbranch() {
static int nfa_regbranch(void) {
int ch;
int old_post_pos;
@ -2047,8 +2040,10 @@ static int nfa_regbranch() {
* or branch \| branch \| branch
* etc.
*/
static int nfa_reg(paren)
int paren; /* REG_NOPAREN, REG_PAREN, REG_NPAREN or REG_ZPAREN */
static int
nfa_reg (
int paren /* REG_NOPAREN, REG_PAREN, REG_NPAREN or REG_ZPAREN */
)
{
int parno = 0;
@ -2101,8 +2096,7 @@ int paren; /* REG_NOPAREN, REG_PAREN, REG_NPAREN or REG_ZPAREN */
#ifdef REGEXP_DEBUG
static char_u code[50];
static void nfa_set_code(c)
int c;
static void nfa_set_code(int c)
{
int addnl = FALSE;
@ -2330,9 +2324,7 @@ static FILE *log_fd;
/*
* Print the postfix notation of the current regexp.
*/
static void nfa_postfix_dump(expr, retval)
char_u *expr;
int retval;
static void nfa_postfix_dump(char_u *expr, int retval)
{
int *p;
FILE *f;
@ -2360,9 +2352,7 @@ int retval;
/*
* Print the NFA starting with a root node "state".
*/
static void nfa_print_state(debugf, state)
FILE *debugf;
nfa_state_T *state;
static void nfa_print_state(FILE *debugf, nfa_state_T *state)
{
garray_T indent;
@ -2372,10 +2362,7 @@ nfa_state_T *state;
ga_clear(&indent);
}
static void nfa_print_state2(debugf, state, indent)
FILE *debugf;
nfa_state_T *state;
garray_T *indent;
static void nfa_print_state2(FILE *debugf, nfa_state_T *state, garray_T *indent)
{
char_u *p;
@ -2433,8 +2420,7 @@ garray_T *indent;
/*
* Print the NFA state machine.
*/
static void nfa_dump(prog)
nfa_regprog_T *prog;
static void nfa_dump(nfa_regprog_T *prog)
{
FILE *debugf = fopen(NFA_REGEXP_DUMP_LOG, "a");
@ -2459,7 +2445,7 @@ nfa_regprog_T *prog;
* Parse r.e. @expr and convert it into postfix form.
* Return the postfix string on success, NULL otherwise.
*/
static int * re2post() {
static int *re2post(void) {
if (nfa_reg(REG_NOPAREN) == FAIL)
return NULL;
EMIT(NFA_MOPEN);
@ -2480,10 +2466,7 @@ static nfa_state_T *state_ptr; /* points to nfa_prog->state */
/*
* Allocate and initialize nfa_state_T.
*/
static nfa_state_T * alloc_state(c, out, out1)
int c;
nfa_state_T *out;
nfa_state_T *out1;
static nfa_state_T *alloc_state(int c, nfa_state_T *out, nfa_state_T *out1)
{
nfa_state_T *s;
@ -2536,9 +2519,7 @@ static Frag_T st_pop __ARGS((Frag_T **p, Frag_T *stack));
/*
* Initialize a Frag_T struct and return it.
*/
static Frag_T frag(start, out)
nfa_state_T *start;
Ptrlist *out;
static Frag_T frag(nfa_state_T *start, Ptrlist *out)
{
Frag_T n;
@ -2550,8 +2531,7 @@ Ptrlist *out;
/*
* Create singleton list containing just outp.
*/
static Ptrlist * list1(outp)
nfa_state_T **outp;
static Ptrlist *list1(nfa_state_T **outp)
{
Ptrlist *l;
@ -2563,9 +2543,7 @@ nfa_state_T **outp;
/*
* Patch the list of states at out to point to start.
*/
static void patch(l, s)
Ptrlist *l;
nfa_state_T *s;
static void patch(Ptrlist *l, nfa_state_T *s)
{
Ptrlist *next;
@ -2579,9 +2557,7 @@ nfa_state_T *s;
/*
* Join the two lists l1 and l2, returning the combination.
*/
static Ptrlist * append(l1, l2)
Ptrlist *l1;
Ptrlist *l2;
static Ptrlist *append(Ptrlist *l1, Ptrlist *l2)
{
Ptrlist *oldl1;
@ -2597,10 +2573,7 @@ Ptrlist *l2;
*/
static Frag_T empty;
static void st_error(postfix, end, p)
int *postfix UNUSED;
int *end UNUSED;
int *p UNUSED;
static void st_error(int *postfix, int *end, int *p)
{
#ifdef NFA_REGEXP_ERROR_LOG
FILE *df;
@ -2643,10 +2616,7 @@ int *p UNUSED;
/*
* Push an item onto the stack.
*/
static void st_push(s, p, stack_end)
Frag_T s;
Frag_T **p;
Frag_T *stack_end;
static void st_push(Frag_T s, Frag_T **p, Frag_T *stack_end)
{
Frag_T *stackp = *p;
@ -2659,9 +2629,7 @@ Frag_T *stack_end;
/*
* Pop an item from the stack.
*/
static Frag_T st_pop(p, stack)
Frag_T **p;
Frag_T *stack;
static Frag_T st_pop(Frag_T **p, Frag_T *stack)
{
Frag_T *stackp;
@ -2676,9 +2644,7 @@ Frag_T *stack;
* Estimate the maximum byte length of anything matching "state".
* When unknown or unlimited return -1.
*/
static int nfa_max_width(startstate, depth)
nfa_state_T *startstate;
int depth;
static int nfa_max_width(nfa_state_T *startstate, int depth)
{
int l, r;
nfa_state_T *state = startstate;
@ -2888,10 +2854,7 @@ int depth;
* Convert a postfix form into its equivalent NFA.
* Return the NFA start state on success, NULL otherwise.
*/
static nfa_state_T * post2nfa(postfix, end, nfa_calc_size)
int *postfix;
int *end;
int nfa_calc_size;
static nfa_state_T *post2nfa(int *postfix, int *end, int nfa_calc_size)
{
int *p;
int mopen;
@ -3375,8 +3338,7 @@ theend:
/*
* After building the NFA program, inspect it to add optimization hints.
*/
static void nfa_postprocess(prog)
nfa_regprog_T *prog;
static void nfa_postprocess(nfa_regprog_T *prog)
{
int i;
int c;
@ -3489,16 +3451,14 @@ static void log_subsexpr __ARGS((regsubs_T *subs));
static void log_subexpr __ARGS((regsub_T *sub));
static char *pim_info __ARGS((nfa_pim_T *pim));
static void log_subsexpr(subs)
regsubs_T *subs;
static void log_subsexpr(regsubs_T *subs)
{
log_subexpr(&subs->norm);
if (nfa_has_zsubexpr)
log_subexpr(&subs->synt);
}
static void log_subexpr(sub)
regsub_T *sub;
static void log_subexpr(regsub_T *sub)
{
int j;
@ -3521,8 +3481,7 @@ regsub_T *sub;
}
}
static char * pim_info(pim)
nfa_pim_T *pim;
static char *pim_info(nfa_pim_T *pim)
{
static char buf[30];
@ -3563,9 +3522,7 @@ static void addstate_here __ARGS((nfa_list_T *l, nfa_state_T *state,
/*
* Copy postponed invisible match info from "from" to "to".
*/
static void copy_pim(to, from)
nfa_pim_T *to;
nfa_pim_T *from;
static void copy_pim(nfa_pim_T *to, nfa_pim_T *from)
{
to->result = from->result;
to->state = from->state;
@ -3575,8 +3532,7 @@ nfa_pim_T *from;
to->end = from->end;
}
static void clear_sub(sub)
regsub_T *sub;
static void clear_sub(regsub_T *sub)
{
if (REG_MULTI)
/* Use 0xff to set lnum to -1 */
@ -3590,9 +3546,7 @@ regsub_T *sub;
/*
* Copy the submatches from "from" to "to".
*/
static void copy_sub(to, from)
regsub_T *to;
regsub_T *from;
static void copy_sub(regsub_T *to, regsub_T *from)
{
to->in_use = from->in_use;
if (from->in_use > 0) {
@ -3611,9 +3565,7 @@ regsub_T *from;
/*
* Like copy_sub() but exclude the main match.
*/
static void copy_sub_off(to, from)
regsub_T *to;
regsub_T *from;
static void copy_sub_off(regsub_T *to, regsub_T *from)
{
if (to->in_use < from->in_use)
to->in_use = from->in_use;
@ -3633,9 +3585,7 @@ regsub_T *from;
/*
* Like copy_sub() but only do the end of the main match if \ze is present.
*/
static void copy_ze_off(to, from)
regsub_T *to;
regsub_T *from;
static void copy_ze_off(regsub_T *to, regsub_T *from)
{
if (nfa_has_zend) {
if (REG_MULTI) {
@ -3651,9 +3601,7 @@ regsub_T *from;
/*
* Return TRUE if "sub1" and "sub2" have the same start positions.
*/
static int sub_equal(sub1, sub2)
regsub_T *sub1;
regsub_T *sub2;
static int sub_equal(regsub_T *sub1, regsub_T *sub2)
{
int i;
int todo;
@ -3723,11 +3671,13 @@ static void report_state(char *action,
* Return TRUE if the same state is already in list "l" with the same
* positions as "subs".
*/
static int has_state_with_pos(l, state, subs, pim)
nfa_list_T *l; /* runtime state list */
nfa_state_T *state; /* state to update */
regsubs_T *subs; /* pointers to subexpressions */
nfa_pim_T *pim; /* postponed match or NULL */
static int
has_state_with_pos (
nfa_list_T *l, /* runtime state list */
nfa_state_T *state, /* state to update */
regsubs_T *subs, /* pointers to subexpressions */
nfa_pim_T *pim /* postponed match or NULL */
)
{
nfa_thread_T *thread;
int i;
@ -3748,9 +3698,7 @@ nfa_pim_T *pim; /* postponed match or NULL */
* Return TRUE if "one" and "two" are equal. That includes when both are not
* set.
*/
static int pim_equal(one, two)
nfa_pim_T *one;
nfa_pim_T *two;
static int pim_equal(nfa_pim_T *one, nfa_pim_T *two)
{
int one_unused = (one == NULL || one->result == NFA_PIM_UNUSED);
int two_unused = (two == NULL || two->result == NFA_PIM_UNUSED);
@ -3774,9 +3722,7 @@ nfa_pim_T *two;
/*
* Return TRUE if "state" leads to a NFA_MATCH without advancing the input.
*/
static int match_follows(startstate, depth)
nfa_state_T *startstate;
int depth;
static int match_follows(nfa_state_T *startstate, int depth)
{
nfa_state_T *state = startstate;
@ -3865,10 +3811,12 @@ int depth;
/*
* Return TRUE if "state" is already in list "l".
*/
static int state_in_list(l, state, subs)
nfa_list_T *l; /* runtime state list */
nfa_state_T *state; /* state to update */
regsubs_T *subs; /* pointers to subexpressions */
static int
state_in_list (
nfa_list_T *l, /* runtime state list */
nfa_state_T *state, /* state to update */
regsubs_T *subs /* pointers to subexpressions */
)
{
if (state->lastlist[nfa_ll_index] == l->id) {
if (!nfa_has_backref || has_state_with_pos(l, state, subs, NULL))
@ -3882,12 +3830,14 @@ regsubs_T *subs; /* pointers to subexpressions */
* Returns "subs_arg", possibly copied into temp_subs.
*/
static regsubs_T * addstate(l, state, subs_arg, pim, off)
nfa_list_T *l; /* runtime state list */
nfa_state_T *state; /* state to update */
regsubs_T *subs_arg; /* pointers to subexpressions */
nfa_pim_T *pim; /* postponed look-behind match */
int off; /* byte offset, when -1 go to next line */
static regsubs_T *
addstate (
nfa_list_T *l, /* runtime state list */
nfa_state_T *state, /* state to update */
regsubs_T *subs_arg, /* pointers to subexpressions */
nfa_pim_T *pim, /* postponed look-behind match */
int off /* byte offset, when -1 go to next line */
)
{
int subidx;
nfa_thread_T *thread;
@ -4226,12 +4176,14 @@ skip_add:
* This makes sure the order of states to be tried does not change, which
* matters for alternatives.
*/
static void addstate_here(l, state, subs, pim, ip)
nfa_list_T *l; /* runtime state list */
nfa_state_T *state; /* state to update */
regsubs_T *subs; /* pointers to subexpressions */
nfa_pim_T *pim; /* postponed look-behind match */
int *ip;
static void
addstate_here (
nfa_list_T *l, /* runtime state list */
nfa_state_T *state, /* state to update */
regsubs_T *subs, /* pointers to subexpressions */
nfa_pim_T *pim, /* postponed look-behind match */
int *ip
)
{
int tlen = l->n;
int count;
@ -4290,9 +4242,7 @@ int *ip;
/*
* Check character class "class" against current character c.
*/
static int check_char_class(class, c)
int class;
int c;
static int check_char_class(int class, int c)
{
switch (class) {
case NFA_CLASS_ALNUM:
@ -4372,10 +4322,12 @@ int c;
* Check for a match with subexpression "subidx".
* Return TRUE if it matches.
*/
static int match_backref(sub, subidx, bytelen)
regsub_T *sub; /* pointers to subexpressions */
int subidx;
int *bytelen; /* out: length of match in bytes */
static int
match_backref (
regsub_T *sub, /* pointers to subexpressions */
int subidx,
int *bytelen /* out: length of match in bytes */
)
{
int len;
@ -4428,9 +4380,11 @@ static int match_zref __ARGS((int subidx, int *bytelen));
* Check for a match with \z subexpression "subidx".
* Return TRUE if it matches.
*/
static int match_zref(subidx, bytelen)
int subidx;
int *bytelen; /* out: length of match in bytes */
static int
match_zref (
int subidx,
int *bytelen /* out: length of match in bytes */
)
{
int len;
@ -4454,9 +4408,7 @@ int *bytelen; /* out: length of match in bytes */
* Also reset the IDs to zero.
* Only used for the recursive value lastlist[1].
*/
static void nfa_save_listids(prog, list)
nfa_regprog_T *prog;
int *list;
static void nfa_save_listids(nfa_regprog_T *prog, int *list)
{
int i;
nfa_state_T *p;
@ -4473,9 +4425,7 @@ int *list;
/*
* Restore list IDs from "list" to all NFA states.
*/
static void nfa_restore_listids(prog, list)
nfa_regprog_T *prog;
int *list;
static void nfa_restore_listids(nfa_regprog_T *prog, int *list)
{
int i;
nfa_state_T *p;
@ -4487,10 +4437,7 @@ int *list;
}
}
static int nfa_re_num_cmp(val, op, pos)
long_u val;
int op;
long_u pos;
static int nfa_re_num_cmp(long_u val, int op, long_u pos)
{
if (op == 1) return pos > val;
if (op == 2) return pos < val;
@ -4510,13 +4457,7 @@ static int nfa_regmatch __ARGS((nfa_regprog_T *prog, nfa_state_T *start,
* "pim" is NULL or contains info about a Postponed Invisible Match (start
* position).
*/
static int recursive_regmatch(state, pim, prog, submatch, m, listids)
nfa_state_T *state;
nfa_pim_T *pim;
nfa_regprog_T *prog;
regsubs_T *submatch;
regsubs_T *m;
int **listids;
static int recursive_regmatch(nfa_state_T *state, nfa_pim_T *pim, nfa_regprog_T *prog, regsubs_T *submatch, regsubs_T *m, int **listids)
{
int save_reginput_col = (int)(reginput - regline);
int save_reglnum = reglnum;
@ -4666,9 +4607,7 @@ static long find_match_text __ARGS((colnr_T startcol, int regstart,
* NFA_ANY: 1
* specific character: 99
*/
static int failure_chance(state, depth)
nfa_state_T *state;
int depth;
static int failure_chance(nfa_state_T *state, int depth)
{
int c = state->c;
int l, r;
@ -4821,9 +4760,7 @@ int depth;
/*
* Skip until the char "c" we know a match must start with.
*/
static int skip_to_start(c, colp)
int c;
colnr_T *colp;
static int skip_to_start(int c, colnr_T *colp)
{
char_u *s;
@ -4845,10 +4782,7 @@ colnr_T *colp;
* Called after skip_to_start() has found regstart.
* Returns zero for no match, 1 for a match.
*/
static long find_match_text(startcol, regstart, match_text)
colnr_T startcol;
int regstart;
char_u *match_text;
static long find_match_text(colnr_T startcol, int regstart, char_u *match_text)
{
colnr_T col = startcol;
int c1, c2;
@ -4904,11 +4838,7 @@ char_u *match_text;
* When there is a match "submatch" contains the positions.
* Note: Caller must ensure that: start != NULL.
*/
static int nfa_regmatch(prog, start, submatch, m)
nfa_regprog_T *prog;
nfa_state_T *start;
regsubs_T *submatch;
regsubs_T *m;
static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start, regsubs_T *submatch, regsubs_T *m)
{
int result;
int size = 0;
@ -6116,9 +6046,7 @@ theend:
* Try match of "prog" with at regline["col"].
* Returns 0 for failure, number of lines contained in the match otherwise.
*/
static long nfa_regtry(prog, col)
nfa_regprog_T *prog;
colnr_T col;
static long nfa_regtry(nfa_regprog_T *prog, colnr_T col)
{
int i;
regsubs_T subs, m;
@ -6221,9 +6149,11 @@ colnr_T col;
*
* Returns 0 for failure, number of lines contained in the match otherwise.
*/
static long nfa_regexec_both(line, startcol)
char_u *line;
colnr_T startcol; /* column to start looking for match */
static long
nfa_regexec_both (
char_u *line,
colnr_T startcol /* column to start looking for match */
)
{
nfa_regprog_T *prog;
long retval = 0L;
@ -6319,9 +6249,7 @@ theend:
* Compile a regular expression into internal code for the NFA matcher.
* Returns the program in allocated space. Returns NULL for an error.
*/
static regprog_T * nfa_regcomp(expr, re_flags)
char_u *expr;
int re_flags;
static regprog_T *nfa_regcomp(char_u *expr, int re_flags)
{
nfa_regprog_T *prog = NULL;
size_t prog_size;
@ -6435,8 +6363,7 @@ fail:
/*
* Free a compiled regexp program, returned by nfa_regcomp().
*/
static void nfa_regfree(prog)
regprog_T *prog;
static void nfa_regfree(regprog_T *prog)
{
if (prog != NULL) {
vim_free(((nfa_regprog_T *)prog)->match_text);
@ -6454,10 +6381,12 @@ regprog_T *prog;
*
* Return TRUE if there is a match, FALSE if not.
*/
static int nfa_regexec(rmp, line, col)
regmatch_T *rmp;
char_u *line; /* string to match against */
colnr_T col; /* column to start looking for match */
static int
nfa_regexec (
regmatch_T *rmp,
char_u *line, /* string to match against */
colnr_T col /* column to start looking for match */
)
{
reg_match = rmp;
reg_mmatch = NULL;
@ -6479,10 +6408,12 @@ static int nfa_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
/*
* Like nfa_regexec(), but consider a "\n" in "line" to be a line break.
*/
static int nfa_regexec_nl(rmp, line, col)
regmatch_T *rmp;
char_u *line; /* string to match against */
colnr_T col; /* column to start looking for match */
static int
nfa_regexec_nl (
regmatch_T *rmp,
char_u *line, /* string to match against */
colnr_T col /* column to start looking for match */
)
{
reg_match = rmp;
reg_mmatch = NULL;
@ -6529,7 +6460,7 @@ win_T *win; /* window in which to search or NULL */
buf_T *buf; /* buffer in which to search */
linenr_T lnum; /* nr of line to start looking for match */
colnr_T col; /* column to start looking for match */
proftime_T *tm UNUSED; /* timeout limit or NULL */
proftime_T *tm; /* timeout limit or NULL */
{
reg_match = NULL;
reg_mmatch = rmp;

View File

@ -163,15 +163,12 @@ static int screen_char_attr = 0;
* Set must_redraw only if not already set to a higher value.
* e.g. if must_redraw is CLEAR, type NOT_VALID will do nothing.
*/
void redraw_later(type)
int type;
void redraw_later(int type)
{
redraw_win_later(curwin, type);
}
void redraw_win_later(wp, type)
win_T *wp;
int type;
void redraw_win_later(win_T *wp, int type)
{
if (wp->w_redr_type < type) {
wp->w_redr_type = type;
@ -186,7 +183,7 @@ int type;
* Force a complete redraw later. Also resets the highlighting. To be used
* after executing a shell command that messes up the screen.
*/
void redraw_later_clear() {
void redraw_later_clear(void) {
redraw_all_later(CLEAR);
/* Use attributes that is very unlikely to appear in text. */
screen_attr = HL_BOLD | HL_UNDERLINE | HL_INVERSE;
@ -195,8 +192,7 @@ void redraw_later_clear() {
/*
* Mark all windows to be redrawn later.
*/
void redraw_all_later(type)
int type;
void redraw_all_later(int type)
{
win_T *wp;
@ -209,15 +205,12 @@ int type;
/*
* Mark all windows that are editing the current buffer to be updated later.
*/
void redraw_curbuf_later(type)
int type;
void redraw_curbuf_later(int type)
{
redraw_buf_later(curbuf, type);
}
void redraw_buf_later(buf, type)
buf_T *buf;
int type;
void redraw_buf_later(buf_T *buf, int type)
{
win_T *wp;
@ -233,8 +226,7 @@ int type;
* right away and restore what was on the command line.
* Return a code indicating what happened.
*/
int redraw_asap(type)
int type;
int redraw_asap(int type)
{
int rows;
int r;
@ -360,9 +352,11 @@ int type;
* Note that when also inserting/deleting lines w_redraw_top and w_redraw_bot
* may become invalid and the whole window will have to be redrawn.
*/
void redrawWinline(lnum, invalid)
linenr_T lnum;
int invalid UNUSED; /* window line height is invalid now */
void
redrawWinline (
linenr_T lnum,
int invalid /* window line height is invalid now */
)
{
int i;
@ -385,8 +379,7 @@ int invalid UNUSED; /* window line height is invalid now */
/*
* update all windows that are editing the current buffer
*/
void update_curbuf(type)
int type;
void update_curbuf(int type)
{
redraw_curbuf_later(type);
update_screen(type);
@ -399,8 +392,7 @@ int type;
* Based on the current value of curwin->w_topline, transfer a screenfull
* of stuff from Filemem to ScreenLines[], and update curwin->w_botline.
*/
void update_screen(type)
int type;
void update_screen(int type)
{
win_T *wp;
static int did_intro = FALSE;
@ -591,8 +583,7 @@ int type;
* Return TRUE if the cursor line in window "wp" may be concealed, according
* to the 'concealcursor' option.
*/
int conceal_cursor_line(wp)
win_T *wp;
int conceal_cursor_line(win_T *wp)
{
int c;
@ -614,7 +605,7 @@ win_T *wp;
/*
* Check if the cursor line needs to be redrawn because of 'concealcursor'.
*/
void conceal_check_cursur_line() {
void conceal_check_cursur_line(void) {
if (curwin->w_p_cole > 0 && conceal_cursor_line(curwin)) {
need_cursor_line_redraw = TRUE;
/* Need to recompute cursor column, e.g., when starting Visual mode
@ -623,9 +614,7 @@ void conceal_check_cursur_line() {
}
}
void update_single_line(wp, lnum)
win_T *wp;
linenr_T lnum;
void update_single_line(win_T *wp, linenr_T lnum)
{
int row;
int j;
@ -680,8 +669,7 @@ linenr_T lnum;
* mid: from mid_start to mid_end (update inversion or changed text)
* bot: from bot_start to last row (when scrolled up)
*/
static void win_update(wp)
win_T *wp;
static void win_update(win_T *wp)
{
buf_T *buf = wp->w_buffer;
int type;
@ -1633,13 +1621,7 @@ win_T *wp;
* Clear the rest of the window and mark the unused lines with "c1". use "c2"
* as the filler character.
*/
static void win_draw_end(wp, c1, c2, row, endrow, hl)
win_T *wp;
int c1;
int c2;
int row;
int endrow;
hlf_T hl;
static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T hl)
{
int n = 0;
# define FDC_OFF n
@ -1695,9 +1677,7 @@ static int advance_color_col __ARGS((int vcol, int **color_cols));
/*
* Advance **color_cols and return TRUE when there are columns to draw.
*/
static int advance_color_col(vcol, color_cols)
int vcol;
int **color_cols;
static int advance_color_col(int vcol, int **color_cols)
{
while (**color_cols >= 0 && vcol > **color_cols)
++*color_cols;
@ -1707,12 +1687,7 @@ int **color_cols;
/*
* Display one folded line.
*/
static void fold_line(wp, fold_count, foldinfo, lnum, row)
win_T *wp;
long fold_count;
foldinfo_T *foldinfo;
linenr_T lnum;
int row;
static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T lnum, int row)
{
char_u buf[51];
pos_T *top, *bot;
@ -2018,11 +1993,7 @@ int row;
/*
* Copy "buf[len]" to ScreenLines["off"] and set attributes to "attr".
*/
static void copy_text_attr(off, buf, len, attr)
int off;
char_u *buf;
int len;
int attr;
static void copy_text_attr(int off, char_u *buf, int len, int attr)
{
int i;
@ -2037,11 +2008,13 @@ int attr;
* Fill the foldcolumn at "p" for window "wp".
* Only to be called when 'foldcolumn' > 0.
*/
static void fill_foldcolumn(p, wp, closed, lnum)
char_u *p;
win_T *wp;
int closed; /* TRUE of FALSE */
linenr_T lnum; /* current line number */
static void
fill_foldcolumn (
char_u *p,
win_T *wp,
int closed, /* TRUE of FALSE */
linenr_T lnum /* current line number */
)
{
int i = 0;
int level;
@ -2087,12 +2060,14 @@ linenr_T lnum; /* current line number */
*
* Return the number of last row the line occupies.
*/
static int win_line(wp, lnum, startrow, endrow, nochange)
win_T *wp;
linenr_T lnum;
int startrow;
int endrow;
int nochange UNUSED; /* not updating for changed text */
static int
win_line (
win_T *wp,
linenr_T lnum,
int startrow,
int endrow,
int nochange /* not updating for changed text */
)
{
int col; /* visual column on screen */
unsigned off; /* offset in ScreenLines/ScreenAttrs */
@ -4056,9 +4031,7 @@ static int comp_char_differs __ARGS((int, int));
* Return if the composing characters at "off_from" and "off_to" differ.
* Only to be used when ScreenLinesUC[off_from] != 0.
*/
static int comp_char_differs(off_from, off_to)
int off_from;
int off_to;
static int comp_char_differs(int off_from, int off_to)
{
int i;
@ -4078,10 +4051,7 @@ int off_to;
* - the character is multi-byte and the next byte is different
* - the character is two cells wide and the second cell differs.
*/
static int char_needs_redraw(off_from, off_to, cols)
int off_from;
int off_to;
int cols;
static int char_needs_redraw(int off_from, int off_to, int cols)
{
if (cols > 0
&& ((ScreenLines[off_from] != ScreenLines[off_to]
@ -4116,13 +4086,7 @@ int cols;
* When TRUE and "clear_width" > 0, clear columns 0 to "endcol"
* When FALSE and "clear_width" > 0, clear columns "endcol" to "clear_width"
*/
static void screen_line(row, coloff, endcol, clear_width
, rlflag )
int row;
int coloff;
int endcol;
int clear_width;
int rlflag;
static void screen_line(int row, int coloff, int endcol, int clear_width, int rlflag)
{
unsigned off_from;
unsigned off_to;
@ -4376,8 +4340,7 @@ int rlflag;
* Mirror text "str" for right-left displaying.
* Only works for single-byte characters (e.g., numbers).
*/
void rl_mirror(str)
char_u *str;
void rl_mirror(char_u *str)
{
char_u *p1, *p2;
int t;
@ -4392,7 +4355,7 @@ char_u *str;
/*
* mark all status lines for redraw; used after first :cd
*/
void status_redraw_all() {
void status_redraw_all(void) {
win_T *wp;
for (wp = firstwin; wp; wp = wp->w_next)
@ -4405,7 +4368,7 @@ void status_redraw_all() {
/*
* mark all status lines of the current buffer for redraw
*/
void status_redraw_curbuf() {
void status_redraw_curbuf(void) {
win_T *wp;
for (wp = firstwin; wp; wp = wp->w_next)
@ -4418,7 +4381,7 @@ void status_redraw_curbuf() {
/*
* Redraw all status lines that need to be redrawn.
*/
void redraw_statuslines() {
void redraw_statuslines(void) {
win_T *wp;
for (wp = firstwin; wp; wp = wp->w_next)
@ -4431,8 +4394,7 @@ void redraw_statuslines() {
/*
* Redraw all status lines at the bottom of frame "frp".
*/
void win_redraw_last_status(frp)
frame_T *frp;
void win_redraw_last_status(frame_T *frp)
{
if (frp->fr_layout == FR_LEAF)
frp->fr_win->w_redr_status = TRUE;
@ -4450,9 +4412,7 @@ frame_T *frp;
/*
* Draw the verticap separator right of window "wp" starting with line "row".
*/
static void draw_vsep_win(wp, row)
win_T *wp;
int row;
static void draw_vsep_win(win_T *wp, int row)
{
int hl;
int c;
@ -4472,9 +4432,7 @@ static int skip_status_match_char __ARGS((expand_T *xp, char_u *s));
/*
* Get the length of an item as it will be shown in the status line.
*/
static int status_match_len(xp, s)
expand_T *xp;
char_u *s;
static int status_match_len(expand_T *xp, char_u *s)
{
int len = 0;
@ -4498,9 +4456,7 @@ char_u *s;
* Return the number of characters that should be skipped in a status match.
* These are backslashes used for escaping. Do show backslashes in help tags.
*/
static int skip_status_match_char(xp, s)
expand_T *xp;
char_u *s;
static int skip_status_match_char(expand_T *xp, char_u *s)
{
if ((rem_backslash(s) && xp->xp_context != EXPAND_HELP)
|| ((xp->xp_context == EXPAND_MENUS
@ -4523,12 +4479,14 @@ char_u *s;
*
* If inversion is possible we use it. Else '=' characters are used.
*/
void win_redr_status_matches(xp, num_matches, matches, match, showtail)
expand_T *xp;
int num_matches;
char_u **matches; /* list of matches */
int match;
int showtail;
void
win_redr_status_matches (
expand_T *xp,
int num_matches,
char_u **matches, /* list of matches */
int match,
int showtail
)
{
#define L_MATCH(m) (showtail ? sm_gettail(matches[m]) : matches[m])
int row;
@ -4702,8 +4660,7 @@ int showtail;
*
* If inversion is possible we use it. Else '=' characters are used.
*/
void win_redr_status(wp)
win_T *wp;
void win_redr_status(win_T *wp)
{
int row;
char_u *p;
@ -4823,8 +4780,7 @@ win_T *wp;
* Redraw the status line according to 'statusline' and take care of any
* errors encountered.
*/
static void redraw_custom_statusline(wp)
win_T *wp;
static void redraw_custom_statusline(win_T *wp)
{
static int entered = FALSE;
int save_called_emsg = called_emsg;
@ -4854,8 +4810,7 @@ win_T *wp;
* line of the window right of it. If not, then it's a vertical separator.
* Only call if (wp->w_vsep_width != 0).
*/
int stl_connected(wp)
win_T *wp;
int stl_connected(win_T *wp)
{
frame_T *fr;
@ -4877,10 +4832,12 @@ win_T *wp;
/*
* Get the value to show for the language mappings, active 'keymap'.
*/
int get_keymap_str(wp, buf, len)
win_T *wp;
char_u *buf; /* buffer for the result */
int len; /* length of buffer */
int
get_keymap_str (
win_T *wp,
char_u *buf, /* buffer for the result */
int len /* length of buffer */
)
{
char_u *p;
@ -4919,9 +4876,11 @@ int len; /* length of buffer */
* Redraw the status line or ruler of window "wp".
* When "wp" is NULL redraw the tab pages line from 'tabline'.
*/
static void win_redr_custom(wp, draw_ruler)
win_T *wp;
int draw_ruler; /* TRUE or FALSE */
static void
win_redr_custom (
win_T *wp,
int draw_ruler /* TRUE or FALSE */
)
{
static int entered = FALSE;
int attr;
@ -5079,10 +5038,7 @@ theend:
/*
* Output a single character directly to the screen and update ScreenLines.
*/
void screen_putchar(c, row, col, attr)
int c;
int row, col;
int attr;
void screen_putchar(int c, int row, int col, int attr)
{
char_u buf[MB_MAXBYTES + 1];
@ -5099,10 +5055,7 @@ int attr;
* Get a single character directly from ScreenLines into "bytes[]".
* Also return its attribute in *attrp;
*/
void screen_getbytes(row, col, bytes, attrp)
int row, col;
char_u *bytes;
int *attrp;
void screen_getbytes(int row, int col, char_u *bytes, int *attrp)
{
unsigned off;
@ -5133,9 +5086,7 @@ static int screen_comp_differs __ARGS((int, int*));
* composing characters in "u8cc".
* Only to be used when ScreenLinesUC[off] != 0.
*/
static int screen_comp_differs(off, u8cc)
int off;
int *u8cc;
static int screen_comp_differs(int off, int *u8cc)
{
int i;
@ -5154,11 +5105,7 @@ int *u8cc;
* Note: only outputs within one row, message is truncated at screen boundary!
* Note: if ScreenLines[], row and/or col is invalid, nothing is done.
*/
void screen_puts(text, row, col, attr)
char_u *text;
int row;
int col;
int attr;
void screen_puts(char_u *text, int row, int col, int attr)
{
screen_puts_len(text, -1, row, col, attr);
}
@ -5167,12 +5114,7 @@ int attr;
* Like screen_puts(), but output "text[len]". When "len" is -1 output up to
* a NUL.
*/
void screen_puts_len(text, len, row, col, attr)
char_u *text;
int len;
int row;
int col;
int attr;
void screen_puts_len(char_u *text, int len, int row, int col, int attr)
{
unsigned off;
char_u *ptr = text;
@ -5383,7 +5325,7 @@ int attr;
/*
* Prepare for 'hlsearch' highlighting.
*/
static void start_search_hl() {
static void start_search_hl(void) {
if (p_hls && !no_hlsearch) {
last_pat_prog(&search_hl.rm);
search_hl.attr = hl_attr(HLF_L);
@ -5395,7 +5337,7 @@ static void start_search_hl() {
/*
* Clean up for 'hlsearch' highlighting.
*/
static void end_search_hl() {
static void end_search_hl(void) {
if (search_hl.rm.regprog != NULL) {
vim_regfree(search_hl.rm.regprog);
search_hl.rm.regprog = NULL;
@ -5405,8 +5347,7 @@ static void end_search_hl() {
/*
* Init for calling prepare_search_hl().
*/
static void init_search_hl(wp)
win_T *wp;
static void init_search_hl(win_T *wp)
{
matchitem_T *cur;
@ -5435,9 +5376,7 @@ win_T *wp;
/*
* Advance to the match in window "wp" line "lnum" or past it.
*/
static void prepare_search_hl(wp, lnum)
win_T *wp;
linenr_T lnum;
static void prepare_search_hl(win_T *wp, linenr_T lnum)
{
matchitem_T *cur; /* points to the match list */
match_T *shl; /* points to search_hl or a match */
@ -5495,11 +5434,13 @@ linenr_T lnum;
* shl->lnum is zero.
* Careful: Any pointers for buffer lines will become invalid.
*/
static void next_search_hl(win, shl, lnum, mincol)
win_T *win;
match_T *shl; /* points to search_hl or a match */
linenr_T lnum;
colnr_T mincol; /* minimal column for a match */
static void
next_search_hl (
win_T *win,
match_T *shl, /* points to search_hl or a match */
linenr_T lnum,
colnr_T mincol /* minimal column for a match */
)
{
linenr_T l;
colnr_T matchcol;
@ -5586,8 +5527,7 @@ colnr_T mincol; /* minimal column for a match */
}
}
static void screen_start_highlight(attr)
int attr;
static void screen_start_highlight(int attr)
{
attrentry_T *aep = NULL;
@ -5641,7 +5581,7 @@ int attr;
}
}
void screen_stop_highlight() {
void screen_stop_highlight(void) {
int do_ME = FALSE; /* output T_ME code */
if (screen_attr != 0
@ -5716,7 +5656,7 @@ void screen_stop_highlight() {
* Reset the colors for a cterm. Used when leaving Vim.
* The machine specific code may override this again.
*/
void reset_cterm_colors() {
void reset_cterm_colors(void) {
if (t_colors > 1) {
/* set Normal cterm colors */
if (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0) {
@ -5734,10 +5674,7 @@ void reset_cterm_colors() {
* Put character ScreenLines["off"] on the screen at position "row" and "col",
* using the attributes from ScreenAttrs["off"].
*/
static void screen_char(off, row, col)
unsigned off;
int row;
int col;
static void screen_char(unsigned off, int row, int col)
{
int attr;
@ -5799,10 +5736,7 @@ int col;
* The attributes of the first byte is used for all. This is required to
* output the two bytes of a double-byte character with nothing in between.
*/
static void screen_char_2(off, row, col)
unsigned off;
int row;
int col;
static void screen_char_2(unsigned off, int row, int col)
{
/* Check for illegal values (could be wrong when screen was resized). */
if (off + 1 >= (unsigned)(screen_Rows * screen_Columns))
@ -5826,12 +5760,7 @@ int col;
* Draw a rectangle of the screen, inverted when "invert" is TRUE.
* This uses the contents of ScreenLines[] and doesn't change it.
*/
void screen_draw_rectangle(row, col, height, width, invert)
int row;
int col;
int height;
int width;
int invert;
void screen_draw_rectangle(int row, int col, int height, int width, int invert)
{
int r, c;
int off;
@ -5863,10 +5792,7 @@ int invert;
/*
* Redraw the characters for a vertically split window.
*/
static void redraw_block(row, end, wp)
int row;
int end;
win_T *wp;
static void redraw_block(int row, int end, win_T *wp)
{
int col;
int width;
@ -5887,11 +5813,7 @@ win_T *wp;
* with character 'c1' in first column followed by 'c2' in the other columns.
* Use attributes 'attr'.
*/
void screen_fill(start_row, end_row, start_col, end_col, c1, c2, attr)
int start_row, end_row;
int start_col, end_col;
int c1, c2;
int attr;
void screen_fill(int start_row, int end_row, int start_col, int end_col, int c1, int c2, int attr)
{
int row;
int col;
@ -6042,8 +5964,7 @@ int attr;
* Check if there should be a delay. Used before clearing or redrawing the
* screen or the command line.
*/
void check_for_delay(check_msg_scroll)
int check_msg_scroll;
void check_for_delay(int check_msg_scroll)
{
if ((emsg_on_display || (check_msg_scroll && msg_scroll))
&& !did_wait_return
@ -6062,8 +5983,7 @@ int check_msg_scroll;
* Returns TRUE if there is a valid screen to write to.
* Returns FALSE when starting up and screen not initialized yet.
*/
int screen_valid(doclear)
int doclear;
int screen_valid(int doclear)
{
screenalloc(doclear); /* allocate screen buffers if size changed */
return ScreenLines != NULL;
@ -6079,8 +5999,7 @@ int doclear;
* in ScreenLines[]. Use Rows and Columns for positioning text etc. where the
* final size of the shell is needed.
*/
void screenalloc(doclear)
int doclear;
void screenalloc(int doclear)
{
int new_row, old_row;
win_T *wp;
@ -6327,7 +6246,7 @@ give_up:
}
}
void free_screenlines() {
void free_screenlines(void) {
int i;
vim_free(ScreenLinesUC);
@ -6341,13 +6260,13 @@ void free_screenlines() {
vim_free(TabPageIdxs);
}
void screenclear() {
void screenclear(void) {
check_for_delay(FALSE);
screenalloc(FALSE); /* allocate screen buffers if size changed */
screenclear2(); /* clear the screen */
}
static void screenclear2() {
static void screenclear2(void) {
int i;
if (starting == NO_SCREEN || ScreenLines == NULL
@ -6394,9 +6313,7 @@ static void screenclear2() {
/*
* Clear one line in ScreenLines.
*/
static void lineclear(off, width)
unsigned off;
int width;
static void lineclear(unsigned off, int width)
{
(void)vim_memset(ScreenLines + off, ' ', (size_t)width * sizeof(schar_T));
if (enc_utf8)
@ -6409,9 +6326,7 @@ int width;
* Mark one line in ScreenLines invalid by setting the attributes to an
* invalid value.
*/
static void lineinvalid(off, width)
unsigned off;
int width;
static void lineinvalid(unsigned off, int width)
{
(void)vim_memset(ScreenAttrs + off, -1, (size_t)width * sizeof(sattr_T));
}
@ -6419,10 +6334,7 @@ int width;
/*
* Copy part of a Screenline for vertically split window "wp".
*/
static void linecopy(to, from, wp)
int to;
int from;
win_T *wp;
static void linecopy(int to, int from, win_T *wp)
{
unsigned off_to = LineOffset[to] + wp->w_wincol;
unsigned off_from = LineOffset[from] + wp->w_wincol;
@ -6449,8 +6361,7 @@ win_T *wp;
* Return TRUE if clearing with term string "p" would work.
* It can't work when the string is empty or it won't set the right background.
*/
int can_clear(p)
char_u *p;
int can_clear(char_u *p)
{
return *p != NUL && (t_colors <= 1
|| cterm_normal_bg_color == 0 || *T_UT != NUL);
@ -6461,7 +6372,7 @@ char_u *p;
* something directly to the screen (shell commands) or a terminal control
* code.
*/
void screen_start() {
void screen_start(void) {
screen_cur_row = screen_cur_col = 9999;
}
@ -6470,9 +6381,7 @@ void screen_start() {
* This tries to find the most efficient way to move, minimizing the number of
* characters sent to the terminal.
*/
void windgoto(row, col)
int row;
int col;
void windgoto(int row, int col)
{
sattr_T *p;
int i;
@ -6685,7 +6594,7 @@ int col;
/*
* Set cursor to its position in the current window.
*/
void setcursor() {
void setcursor(void) {
if (redrawing()) {
validate_cursor();
windgoto(W_WINROW(curwin) + curwin->w_wrow,
@ -6708,12 +6617,7 @@ void setcursor() {
* scrolling.
* Returns FAIL if the lines are not inserted, OK for success.
*/
int win_ins_lines(wp, row, line_count, invalid, mayclear)
win_T *wp;
int row;
int line_count;
int invalid;
int mayclear;
int win_ins_lines(win_T *wp, int row, int line_count, int invalid, int mayclear)
{
int did_delete;
int nextrow;
@ -6782,12 +6686,7 @@ int mayclear;
* scrolling
* Return OK for success, FAIL if the lines are not deleted.
*/
int win_del_lines(wp, row, line_count, invalid, mayclear)
win_T *wp;
int row;
int line_count;
int invalid;
int mayclear;
int win_del_lines(win_T *wp, int row, int line_count, int invalid, int mayclear)
{
int retval;
@ -6830,12 +6729,7 @@ int mayclear;
* Returns OK or FAIL when the work has been done.
* Returns MAYBE when not finished yet.
*/
static int win_do_lines(wp, row, line_count, mayclear, del)
win_T *wp;
int row;
int line_count;
int mayclear;
int del;
static int win_do_lines(win_T *wp, int row, int line_count, int mayclear, int del)
{
int retval;
@ -6900,8 +6794,7 @@ int del;
/*
* window 'wp' and everything after it is messed up, mark it for redraw
*/
static void win_rest_invalid(wp)
win_T *wp;
static void win_rest_invalid(win_T *wp)
{
while (wp != NULL) {
redraw_win_later(wp, NOT_VALID);
@ -6942,12 +6835,14 @@ win_T *wp;
*
* return FAIL for failure, OK for success.
*/
int screen_ins_lines(off, row, line_count, end, wp)
int off;
int row;
int line_count;
int end;
win_T *wp; /* NULL or window to use width from */
int
screen_ins_lines (
int off,
int row,
int line_count,
int end,
win_T *wp /* NULL or window to use width from */
)
{
int i;
int j;
@ -7113,13 +7008,15 @@ win_T *wp; /* NULL or window to use width from */
*
* Return OK for success, FAIL if the lines are not deleted.
*/
int screen_del_lines(off, row, line_count, end, force, wp)
int off;
int row;
int line_count;
int end;
int force; /* even when line_count > p_ttyscroll */
win_T *wp UNUSED; /* NULL or window to use width from */
int
screen_del_lines (
int off,
int row,
int line_count,
int end,
int force, /* even when line_count > p_ttyscroll */
win_T *wp /* NULL or window to use width from */
)
{
int j;
int i;
@ -7292,7 +7189,7 @@ win_T *wp UNUSED; /* NULL or window to use width from */
* cleared only if a mode is shown.
* Return the length of the message (0 if no message).
*/
int showmode() {
int showmode(void) {
int need_clear;
int length = 0;
int do_mode;
@ -7443,7 +7340,7 @@ int showmode() {
/*
* Position for a mode message.
*/
static void msg_pos_mode() {
static void msg_pos_mode(void) {
msg_col = 0;
msg_row = Rows - 1;
}
@ -7453,8 +7350,7 @@ static void msg_pos_mode() {
* Insert mode (but Insert mode didn't end yet!).
* Caller should check "mode_displayed".
*/
void unshowmode(force)
int force;
void unshowmode(int force)
{
/*
* Don't delete it right now, when not redrawing or inside a mapping.
@ -7472,7 +7368,7 @@ int force;
/*
* Draw the tab pages line at the top of the Vim window.
*/
static void draw_tabline() {
static void draw_tabline(void) {
int tabcount = 0;
tabpage_T *tp;
int tabwidth;
@ -7622,8 +7518,7 @@ static void draw_tabline() {
* Get buffer name for "buf" into NameBuff[].
* Takes care of special buffer names and translates special characters.
*/
void get_trans_bufname(buf)
buf_T *buf;
void get_trans_bufname(buf_T *buf)
{
if (buf_spname(buf) != NULL)
vim_strncpy(NameBuff, buf_spname(buf), MAXPATHL - 1);
@ -7635,9 +7530,7 @@ buf_T *buf;
/*
* Get the character to use in a status line. Get its attributes in "*attr".
*/
static int fillchar_status(attr, is_curwin)
int *attr;
int is_curwin;
static int fillchar_status(int *attr, int is_curwin)
{
int fill;
if (is_curwin) {
@ -7663,8 +7556,7 @@ int is_curwin;
* Get the character to use in a separator between vertically split windows.
* Get its attributes in "*attr".
*/
static int fillchar_vsep(attr)
int *attr;
static int fillchar_vsep(int *attr)
{
*attr = hl_attr(HLF_C);
if (*attr == 0 && fill_vert == ' ')
@ -7676,7 +7568,7 @@ int *attr;
/*
* Return TRUE if redrawing should currently be done.
*/
int redrawing() {
int redrawing(void) {
return !RedrawingDisabled
&& !(p_lz && char_avail() && !KeyTyped && !do_redraw);
}
@ -7684,7 +7576,7 @@ int redrawing() {
/*
* Return TRUE if printing messages should currently be done.
*/
int messaging() {
int messaging(void) {
return !(p_lz && char_avail() && !KeyTyped);
}
@ -7692,8 +7584,7 @@ int messaging() {
* Show current status info in ruler and various other places
* If always is FALSE, only show ruler if position has changed.
*/
void showruler(always)
int always;
void showruler(int always)
{
if (!always && !redrawing())
return;
@ -7717,9 +7608,7 @@ int always;
draw_tabline();
}
static void win_redr_ruler(wp, always)
win_T *wp;
int always;
static void win_redr_ruler(win_T *wp, int always)
{
#define RULER_BUF_LEN 70
char_u buffer[RULER_BUF_LEN];
@ -7887,8 +7776,7 @@ int always;
* Caller may need to check if 'number' or 'relativenumber' is set.
* Otherwise it depends on 'numberwidth' and the line count.
*/
int number_width(wp)
win_T *wp;
int number_width(win_T *wp)
{
int n;
linenr_T lnum;
@ -7922,7 +7810,7 @@ win_T *wp;
* Return the current cursor column. This is the actual position on the
* screen. First column is 0.
*/
int screen_screencol() {
int screen_screencol(void) {
return screen_cur_col;
}
@ -7930,7 +7818,7 @@ int screen_screencol() {
* Return the current cursor row. This is the actual position on the screen.
* First row is 0.
*/
int screen_screenrow() {
int screen_screenrow(void) {
return screen_cur_row;
}

View File

@ -113,12 +113,14 @@ typedef struct SearchedFile {
*
* returns FAIL if failed, OK otherwise.
*/
int search_regcomp(pat, pat_save, pat_use, options, regmatch)
char_u *pat;
int pat_save;
int pat_use;
int options;
regmmatch_T *regmatch; /* return: pattern and ignore-case flag */
int
search_regcomp (
char_u *pat,
int pat_save,
int pat_use,
int options,
regmmatch_T *regmatch /* return: pattern and ignore-case flag */
)
{
int magic;
int i;
@ -190,7 +192,7 @@ regmmatch_T *regmatch; /* return: pattern and ignore-case flag */
/*
* Get search pattern used by search_regcomp().
*/
char_u * get_search_pat() {
char_u *get_search_pat(void) {
return mr_pattern;
}
@ -198,8 +200,7 @@ char_u * get_search_pat() {
* Reverse text into allocated memory.
* Returns the allocated string, NULL when out of memory.
*/
char_u * reverse_text(s)
char_u *s;
char_u *reverse_text(char_u *s)
{
unsigned len;
unsigned s_i, rev_i;
@ -229,10 +230,7 @@ char_u *s;
return rev;
}
static void save_re_pat(idx, pat, magic)
int idx;
char_u *pat;
int magic;
static void save_re_pat(int idx, char_u *pat, int magic)
{
if (spats[idx].pat != pat) {
vim_free(spats[idx].pat);
@ -253,7 +251,7 @@ int magic;
*/
static int save_level = 0;
void save_search_patterns() {
void save_search_patterns(void) {
if (save_level++ == 0) {
saved_spats[0] = spats[0];
if (spats[0].pat != NULL)
@ -266,7 +264,7 @@ void save_search_patterns() {
}
}
void restore_search_patterns() {
void restore_search_patterns(void) {
if (--save_level == 0) {
vim_free(spats[0].pat);
spats[0] = saved_spats[0];
@ -279,7 +277,7 @@ void restore_search_patterns() {
}
#if defined(EXITFREE) || defined(PROTO)
void free_search_patterns() {
void free_search_patterns(void) {
vim_free(spats[0].pat);
vim_free(spats[1].pat);
@ -296,8 +294,7 @@ void free_search_patterns() {
* Return TRUE when case should be ignored for search pattern "pat".
* Uses the 'ignorecase' and 'smartcase' options.
*/
int ignorecase(pat)
char_u *pat;
int ignorecase(char_u *pat)
{
int ic = p_ic;
@ -313,8 +310,7 @@ char_u *pat;
/*
* Return TRUE if patter "pat" has an uppercase character.
*/
int pat_has_uppercase(pat)
char_u *pat;
int pat_has_uppercase(char_u *pat)
{
char_u *p = pat;
@ -342,14 +338,14 @@ char_u *pat;
return FALSE;
}
char_u * last_search_pat() {
char_u *last_search_pat(void) {
return spats[last_idx].pat;
}
/*
* Reset search direction to forward. For "gd" and "gD" commands.
*/
void reset_search_dir() {
void reset_search_dir(void) {
spats[0].off.dir = '/';
set_vv_searchforward();
}
@ -358,11 +354,7 @@ void reset_search_dir() {
* Set the last search pattern. For ":let @/ =" and viminfo.
* Also set the saved search pattern, so that this works in an autocommand.
*/
void set_last_search_pat(s, idx, magic, setlast)
char_u *s;
int idx;
int magic;
int setlast;
void set_last_search_pat(char_u *s, int idx, int magic, int setlast)
{
vim_free(spats[idx].pat);
/* An empty string means that nothing should be matched. */
@ -398,8 +390,7 @@ int setlast;
* This is used for highlighting all matches in a window.
* Values returned in regmatch->regprog and regmatch->rmm_ic.
*/
void last_pat_prog(regmatch)
regmmatch_T *regmatch;
void last_pat_prog(regmmatch_T *regmatch)
{
if (spats[last_idx].pat == NULL) {
regmatch->regprog = NULL;
@ -440,7 +431,7 @@ long count;
int options;
int pat_use; /* which pattern to use when "pat" is empty */
linenr_T stop_lnum; /* stop after this line number when != 0 */
proftime_T *tm UNUSED; /* timeout limit or NULL */
proftime_T *tm; /* timeout limit or NULL */
{
int found;
linenr_T lnum; /* no init to shut up Apollo cc */
@ -827,21 +818,19 @@ proftime_T *tm UNUSED; /* timeout limit or NULL */
return submatch + 1;
}
void set_search_direction(cdir)
int cdir;
void set_search_direction(int cdir)
{
spats[0].off.dir = cdir;
}
static void set_vv_searchforward() {
static void set_vv_searchforward(void) {
set_vim_var_nr(VV_SEARCHFORWARD, (long)(spats[0].off.dir == '/'));
}
/*
* Return the number of the first subpat that matched.
*/
static int first_submatch(rp)
regmmatch_T *rp;
static int first_submatch(regmmatch_T *rp)
{
int submatch;
@ -1208,11 +1197,7 @@ end_do_search:
* ADDING is set. if p_ic is set then the pattern must be in lowercase.
* Return OK for success, or FAIL if no line found.
*/
int search_for_exact_line(buf, pos, dir, pat)
buf_T *buf;
pos_T *pos;
int dir;
char_u *pat;
int search_for_exact_line(buf_T *buf, pos_T *pos, int dir, char_u *pat)
{
linenr_T start = 0;
char_u *ptr;
@ -1275,9 +1260,7 @@ char_u *pat;
* Do this "cap->count1" times.
* Return FAIL or OK.
*/
int searchc(cap, t_cmd)
cmdarg_T *cap;
int t_cmd;
int searchc(cmdarg_T *cap, int t_cmd)
{
int c = cap->nchar; /* char to search for */
int dir = cap->arg; /* TRUE for searching forward */
@ -1389,9 +1372,7 @@ int t_cmd;
*
* Improvement over vi: Braces inside quotes are ignored.
*/
pos_T * findmatch(oap, initc)
oparg_T *oap;
int initc;
pos_T *findmatch(oparg_T *oap, int initc)
{
return findmatchlimit(oap, initc, 0, 0);
}
@ -1403,11 +1384,7 @@ int initc;
* is NULL.
* Handles multibyte string correctly.
*/
static int check_prevcol(linep, col, ch, prevcol)
char_u *linep;
int col;
int ch;
int *prevcol;
static int check_prevcol(char_u *linep, int col, int ch, int *prevcol)
{
--col;
if (col > 0 && has_mbyte)
@ -1434,11 +1411,7 @@ int *prevcol;
* NULL
*/
pos_T * findmatchlimit(oap, initc, flags, maxtravel)
oparg_T *oap;
int initc;
int flags;
int maxtravel;
pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int maxtravel)
{
static pos_T pos; /* current search position */
int findc = 0; /* matching brace */
@ -1945,8 +1918,7 @@ int maxtravel;
* Return MAXCOL if not, otherwise return the column.
* TODO: skip strings.
*/
static int check_linecomment(line)
char_u *line;
static int check_linecomment(char_u *line)
{
char_u *p;
@ -1993,8 +1965,10 @@ char_u *line;
* Show the match only if it is visible on the screen.
* If there isn't a match, then beep.
*/
void showmatch(c)
int c; /* char to show match for */
void
showmatch (
int c /* char to show match for */
)
{
pos_T *lpos, save_cursor;
pos_T mpos;
@ -2085,9 +2059,7 @@ int c; /* char to show match for */
* space or a line break. Also stop at an empty line.
* Return OK if the next sentence was found.
*/
int findsent(dir, count)
int dir;
long count;
int findsent(int dir, long count)
{
pos_T pos, tpos;
int c;
@ -2201,12 +2173,14 @@ found:
* If 'both' is TRUE also stop at '}'.
* Return TRUE if the next paragraph or section was found.
*/
int findpar(pincl, dir, count, what, both)
int *pincl; /* Return: TRUE if last char is to be included */
int dir;
long count;
int what;
int both;
int
findpar (
int *pincl, /* Return: TRUE if last char is to be included */
int dir,
long count,
int what,
int both
)
{
linenr_T curr;
int did_skip; /* TRUE after separating lines have been skipped */
@ -2267,9 +2241,7 @@ int both;
/*
* check if the string 's' is a nroff macro that is in option 'opt'
*/
static int inmacro(opt, s)
char_u *opt;
char_u *s;
static int inmacro(char_u *opt, char_u *s)
{
char_u *macro;
@ -2296,10 +2268,7 @@ char_u *s;
* If 'para' is '{' or '}' only check for sections.
* If 'both' is TRUE also stop at '}'
*/
int startPS(lnum, para, both)
linenr_T lnum;
int para;
int both;
int startPS(linenr_T lnum, int para, int both)
{
char_u *s;
@ -2337,7 +2306,7 @@ static int cls_bigword; /* TRUE for "W", "B" or "E" */
* from class 2 and higher are reported as class 1 since only white space
* boundaries are of interest.
*/
static int cls() {
static int cls(void) {
int c;
c = gchar_cursor();
@ -2375,10 +2344,12 @@ static int cls() {
* Returns FAIL if the cursor was already at the end of the file.
* If eol is TRUE, last word stops at end of line (for operators).
*/
int fwd_word(count, bigword, eol)
long count;
int bigword; /* "W", "E" or "B" */
int eol;
int
fwd_word (
long count,
int bigword, /* "W", "E" or "B" */
int eol
)
{
int sclass; /* starting class */
int i;
@ -2439,10 +2410,7 @@ int eol;
*
* Returns FAIL if top of the file was reached.
*/
int bck_word(count, bigword, stop)
long count;
int bigword;
int stop;
int bck_word(long count, int bigword, int stop)
{
int sclass; /* starting class */
@ -2499,11 +2467,7 @@ finished:
* If stop is TRUE and we are already on the end of a word, move one less.
* If empty is TRUE stop on an empty line.
*/
int end_word(count, bigword, stop, empty)
long count;
int bigword;
int stop;
int empty;
int end_word(long count, int bigword, int stop, int empty)
{
int sclass; /* starting class */
@ -2559,10 +2523,12 @@ finished:
*
* Returns FAIL if start of the file was reached.
*/
int bckend_word(count, bigword, eol)
long count;
int bigword; /* TRUE for "B" */
int eol; /* TRUE: stop at end of line. */
int
bckend_word (
long count,
int bigword, /* TRUE for "B" */
int eol /* TRUE: stop at end of line. */
)
{
int sclass; /* starting class */
int i;
@ -2602,9 +2568,7 @@ int eol; /* TRUE: stop at end of line. */
* Skip a row of characters of the same class.
* Return TRUE when end-of-file reached, FALSE otherwise.
*/
static int skip_chars(cclass, dir)
int cclass;
int dir;
static int skip_chars(int cclass, int dir)
{
while (cls() == cclass)
if ((dir == FORWARD ? inc_cursor() : dec_cursor()) == -1)
@ -2615,7 +2579,7 @@ int dir;
/*
* Go back to the start of the word or the start of white space
*/
static void back_in_line() {
static void back_in_line(void) {
int sclass; /* starting class */
sclass = cls();
@ -2630,8 +2594,7 @@ static void back_in_line() {
}
}
static void find_first_blank(posp)
pos_T *posp;
static void find_first_blank(pos_T *posp)
{
int c;
@ -2647,9 +2610,11 @@ pos_T *posp;
/*
* Skip count/2 sentences and count/2 separating white spaces.
*/
static void findsent_forward(count, at_start_sent)
long count;
int at_start_sent; /* cursor is at start of sentence */
static void
findsent_forward (
long count,
int at_start_sent /* cursor is at start of sentence */
)
{
while (count--) {
findsent(FORWARD, 1L);
@ -2665,11 +2630,13 @@ int at_start_sent; /* cursor is at start of sentence */
* Find word under cursor, cursor at end.
* Used while an operator is pending, and in Visual mode.
*/
int current_word(oap, count, include, bigword)
oparg_T *oap;
long count;
int include; /* TRUE: include word and white space */
int bigword; /* FALSE == word, TRUE == WORD */
int
current_word (
oparg_T *oap,
long count,
int include, /* TRUE: include word and white space */
int bigword /* FALSE == word, TRUE == WORD */
)
{
pos_T start_pos;
pos_T pos;
@ -2815,10 +2782,7 @@ int bigword; /* FALSE == word, TRUE == WORD */
* Find sentence(s) under the cursor, cursor at end.
* When Visual active, extend it by one or more sentences.
*/
int current_sent(oap, count, include)
oparg_T *oap;
long count;
int include;
int current_sent(oparg_T *oap, long count, int include)
{
pos_T start_pos;
pos_T pos;
@ -2973,12 +2937,14 @@ extend:
* Find block under the cursor, cursor at end.
* "what" and "other" are two matching parenthesis/brace/etc.
*/
int current_block(oap, count, include, what, other)
oparg_T *oap;
long count;
int include; /* TRUE == include white space */
int what; /* '(', '{', etc. */
int other; /* ')', '}', etc. */
int
current_block (
oparg_T *oap,
long count,
int include, /* TRUE == include white space */
int what, /* '(', '{', etc. */
int other /* ')', '}', etc. */
)
{
pos_T old_pos;
pos_T *pos = NULL;
@ -3106,8 +3072,7 @@ static int in_html_tag __ARGS((int));
* Return TRUE if the cursor is on a "<aaa>" tag. Ignore "<aaa/>".
* When "end_tag" is TRUE return TRUE if the cursor is on "</aaa>".
*/
static int in_html_tag(end_tag)
int end_tag;
static int in_html_tag(int end_tag)
{
char_u *line = ml_get_curline();
char_u *p;
@ -3169,10 +3134,12 @@ int end_tag;
/*
* Find tag block under the cursor, cursor at end.
*/
int current_tagblock(oap, count_arg, include)
oparg_T *oap;
long count_arg;
int include; /* TRUE == include white space */
int
current_tagblock (
oparg_T *oap,
long count_arg,
int include /* TRUE == include white space */
)
{
long count = count_arg;
long n;
@ -3344,11 +3311,13 @@ theend:
return retval;
}
int current_par(oap, count, include, type)
oparg_T *oap;
long count;
int include; /* TRUE == include white space */
int type; /* 'p' for paragraph, 'S' for section */
int
current_par (
oparg_T *oap,
long count,
int include, /* TRUE == include white space */
int type /* 'p' for paragraph, 'S' for section */
)
{
linenr_T start_lnum;
linenr_T end_lnum;
@ -3509,11 +3478,13 @@ static int find_prev_quote __ARGS((char_u *line, int col_start, int quotechar,
* as a quote.
* Returns column number of "quotechar" or -1 when not found.
*/
static int find_next_quote(line, col, quotechar, escape)
char_u *line;
int col;
int quotechar;
char_u *escape; /* escape characters, can be NULL */
static int
find_next_quote (
char_u *line,
int col,
int quotechar,
char_u *escape /* escape characters, can be NULL */
)
{
int c;
@ -3539,11 +3510,13 @@ char_u *escape; /* escape characters, can be NULL */
* as a quote.
* Return the found column or zero.
*/
static int find_prev_quote(line, col_start, quotechar, escape)
char_u *line;
int col_start;
int quotechar;
char_u *escape; /* escape characters, can be NULL */
static int
find_prev_quote (
char_u *line,
int col_start,
int quotechar,
char_u *escape /* escape characters, can be NULL */
)
{
int n;
@ -3567,11 +3540,13 @@ char_u *escape; /* escape characters, can be NULL */
* Find quote under the cursor, cursor at end.
* Returns TRUE if found, else FALSE.
*/
int current_quote(oap, count, include, quotechar)
oparg_T *oap;
long count;
int include; /* TRUE == include quote char */
int quotechar; /* Quote character */
int
current_quote (
oparg_T *oap,
long count,
int include, /* TRUE == include quote char */
int quotechar /* Quote character */
)
{
char_u *line = ml_get_curline();
int col_end;
@ -3779,9 +3754,11 @@ static int is_one_char __ARGS((char_u *pattern));
* Used while an operator is pending, and in Visual mode.
* TODO: redo only works when used in operator pending mode
*/
int current_search(count, forward)
long count;
int forward; /* move forward or backwards */
int
current_search (
long count,
int forward /* move forward or backwards */
)
{
pos_T start_pos; /* position before the pattern */
pos_T orig_pos; /* position of the cursor at beginning */
@ -3909,8 +3886,7 @@ int forward; /* move forward or backwards */
* Check if the pattern is one character or zero-width.
* Returns TRUE, FALSE or -1 for failure.
*/
static int is_one_char(pattern)
char_u *pattern;
static int is_one_char(char_u *pattern)
{
regmmatch_T regmatch;
int nmatched = 0;
@ -3951,8 +3927,7 @@ char_u *pattern;
/*
* return TRUE if line 'lnum' is empty or has white chars only.
*/
int linewhite(lnum)
linenr_T lnum;
int linewhite(linenr_T lnum)
{
char_u *p;
@ -3965,19 +3940,20 @@ linenr_T lnum;
* Find identifiers or defines in included files.
* If p_ic && (compl_cont_status & CONT_SOL) then ptr must be in lowercase.
*/
void find_pattern_in_path(ptr, dir, len, whole, skip_comments,
type, count, action, start_lnum, end_lnum)
char_u *ptr; /* pointer to search pattern */
int dir UNUSED; /* direction of expansion */
int len; /* length of search pattern */
int whole; /* match whole words only */
int skip_comments; /* don't match inside comments */
int type; /* Type of search; are we looking for a type?
void
find_pattern_in_path (
char_u *ptr, /* pointer to search pattern */
int dir, /* direction of expansion */
int len, /* length of search pattern */
int whole, /* match whole words only */
int skip_comments, /* don't match inside comments */
int type, /* Type of search; are we looking for a type?
a macro? */
long count;
int action; /* What to do when we find it */
linenr_T start_lnum; /* first line to start searching */
linenr_T end_lnum; /* last line for searching */
long count,
int action, /* What to do when we find it */
linenr_T start_lnum, /* first line to start searching */
linenr_T end_lnum /* last line for searching */
)
{
SearchedFile *files; /* Stack of included files */
SearchedFile *bigger; /* When we need more space */
@ -4554,14 +4530,7 @@ fpip_end:
vim_regfree(def_regmatch.regprog);
}
static void show_pat_in_path(line, type, did_show, action, fp, lnum, count)
char_u *line;
int type;
int did_show;
int action;
FILE *fp;
linenr_T *lnum;
long count;
static void show_pat_in_path(char_u *line, int type, int did_show, int action, FILE *fp, linenr_T *lnum, long count)
{
char_u *p;
@ -4609,9 +4578,7 @@ long count;
}
}
int read_viminfo_search_pattern(virp, force)
vir_T *virp;
int force;
int read_viminfo_search_pattern(vir_T *virp, int force)
{
char_u *lp;
int idx = -1;
@ -4684,8 +4651,7 @@ int force;
return viminfo_readline(virp);
}
void write_viminfo_search_pattern(fp)
FILE *fp;
void write_viminfo_search_pattern(FILE *fp)
{
if (get_viminfo_parameter('/') != 0) {
fprintf(fp, "\n# hlsearch on (H) or off (h):\n~%c",
@ -4695,11 +4661,13 @@ FILE *fp;
}
}
static void wvsp_one(fp, idx, s, sc)
FILE *fp; /* file to write to */
int idx; /* spats[] index */
char *s; /* search pat */
int sc; /* dir char */
static void
wvsp_one (
FILE *fp, /* file to write to */
int idx, /* spats[] index */
char *s, /* search pat */
int sc /* dir char */
)
{
if (spats[idx].pat != NULL) {
fprintf(fp, _("\n# Last %sSearch Pattern:\n~"), s);

View File

@ -41,8 +41,7 @@ static void sha256_process __ARGS((context_sha256_T *ctx, char_u data[64]));
(b)[(i) + 3] = (char_u)((n) ); \
}
void sha256_start(ctx)
context_sha256_T *ctx;
void sha256_start(context_sha256_T *ctx)
{
ctx->total[0] = 0;
ctx->total[1] = 0;
@ -57,9 +56,7 @@ context_sha256_T *ctx;
ctx->state[7] = 0x5BE0CD19;
}
static void sha256_process(ctx, data)
context_sha256_T *ctx;
char_u data[64];
static void sha256_process(context_sha256_T *ctx, char_u data[64])
{
UINT32_T temp1, temp2, W[64];
UINT32_T A, B, C, D, E, F, G, H;
@ -190,10 +187,7 @@ char_u data[64];
ctx->state[7] += H;
}
void sha256_update(ctx, input, length)
context_sha256_T *ctx;
char_u *input;
UINT32_T length;
void sha256_update(context_sha256_T *ctx, char_u *input, UINT32_T length)
{
UINT32_T left, fill;
@ -234,9 +228,7 @@ static char_u sha256_padding[64] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
void sha256_finish(ctx, digest)
context_sha256_T *ctx;
char_u digest[32];
void sha256_finish(context_sha256_T *ctx, char_u digest[32])
{
UINT32_T last, padn;
UINT32_T high, low;
@ -270,11 +262,7 @@ static unsigned int get_some_time __ARGS((void));
* Returns hex digest of "buf[buf_len]" in a static array.
* if "salt" is not NULL also do "salt[salt_len]".
*/
char_u * sha256_bytes(buf, buf_len, salt, salt_len)
char_u *buf;
int buf_len;
char_u *salt;
int salt_len;
char_u *sha256_bytes(char_u *buf, int buf_len, char_u *salt, int salt_len)
{
char_u sha256sum[32];
static char_u hexit[65];
@ -297,10 +285,7 @@ int salt_len;
/*
* Returns sha256(buf) as 64 hex chars in static array.
*/
char_u * sha256_key(buf, salt, salt_len)
char_u *buf;
char_u *salt;
int salt_len;
char_u *sha256_key(char_u *buf, char_u *salt, int salt_len)
{
/* No passwd means don't encrypt */
if (buf == NULL || *buf == NUL)
@ -332,7 +317,7 @@ static char *sha_self_test_vector[] = {
* Perform a test on the SHA256 algorithm.
* Return FAIL or OK.
*/
int sha256_self_test() {
int sha256_self_test(void) {
int i, j;
char output[65];
context_sha256_T ctx;
@ -370,7 +355,7 @@ int sha256_self_test() {
return failures > 0 ? FAIL : OK;
}
static unsigned int get_some_time() {
static unsigned int get_some_time(void) {
# ifdef HAVE_GETTIMEOFDAY
struct timeval tv;
@ -386,11 +371,7 @@ static unsigned int get_some_time() {
* Fill "header[header_len]" with random_data.
* Also "salt[salt_len]" when "salt" is not NULL.
*/
void sha2_seed(header, header_len, salt, salt_len)
char_u *header;
int header_len;
char_u *salt;
int salt_len;
void sha2_seed(char_u *header, int header_len, char_u *salt, int salt_len)
{
int i;
static char_u random_data[1000];

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

144
src/tag.c
View File

@ -107,12 +107,14 @@ static taggy_T ptag_entry = {NULL, {INIT_POS_T(0, 0, 0), 0}, 0, 0};
*
* for cscope, returns TRUE if we jumped to tag or aborted, FALSE otherwise
*/
int do_tag(tag, type, count, forceit, verbose)
char_u *tag; /* tag (pattern) to jump to */
int type;
int count;
int forceit; /* :ta with ! */
int verbose; /* print "tag not found" message */
int
do_tag (
char_u *tag, /* tag (pattern) to jump to */
int type,
int count,
int forceit, /* :ta with ! */
int verbose /* print "tag not found" message */
)
{
taggy_T *tagstack = curwin->w_tagstack;
int tagstackidx = curwin->w_tagstackidx;
@ -910,13 +912,12 @@ end_do_tag:
/*
* Free cached tags.
*/
void tag_freematch() {
void tag_freematch(void) {
vim_free(tagmatchname);
tagmatchname = NULL;
}
static void taglen_advance(l)
int l;
static void taglen_advance(int l)
{
if (l == MAXCOL) {
msg_putchar('\n');
@ -928,8 +929,7 @@ int l;
/*
* Print the tag stack
*/
void do_tags(eap)
exarg_T *eap UNUSED;
void do_tags(exarg_T *eap)
{
int i;
char_u *name;
@ -978,10 +978,7 @@ static int tag_strnicmp __ARGS((char_u *s1, char_u *s2, size_t len));
* return 0 for match, < 0 for smaller, > 0 for bigger
* Make sure case is folded to uppercase in comparison (like for 'sort -f')
*/
static int tag_strnicmp(s1, s2, len)
char_u *s1;
char_u *s2;
size_t len;
static int tag_strnicmp(char_u *s1, char_u *s2, size_t len)
{
int i;
@ -1014,9 +1011,7 @@ static void prepare_pats __ARGS((pat_T *pats, int has_re));
/*
* Extract info from the tag search pattern "pats->pat".
*/
static void prepare_pats(pats, has_re)
pat_T *pats;
int has_re;
static void prepare_pats(pat_T *pats, int has_re)
{
pats->head = pats->pat;
pats->headlen = pats->len;
@ -1070,14 +1065,16 @@ int has_re;
* TAG_NOIC don't always ignore case
* TAG_KEEP_LANG keep language
*/
int find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname)
char_u *pat; /* pattern to search for */
int *num_matches; /* return: number of matches found */
char_u ***matchesp; /* return: array of matches found */
int flags;
int mincount; /* MAXCOL: find all matches
int
find_tags (
char_u *pat, /* pattern to search for */
int *num_matches, /* return: number of matches found */
char_u ***matchesp, /* return: array of matches found */
int flags,
int mincount, /* MAXCOL: find all matches
other: minimal number of matches */
char_u *buf_ffname; /* name of buffer for priority */
char_u *buf_ffname /* name of buffer for priority */
)
{
FILE *fp;
char_u *lbuf; /* line buffer */
@ -2020,9 +2017,7 @@ static void found_tagfile_cb __ARGS((char_u *fname, void *cookie));
* Callback function for finding all "tags" and "tags-??" files in
* 'runtimepath' doc directories.
*/
static void found_tagfile_cb(fname, cookie)
char_u *fname;
void *cookie UNUSED;
static void found_tagfile_cb(char_u *fname, void *cookie)
{
if (ga_grow(&tag_fnames, 1) == OK)
((char_u **)(tag_fnames.ga_data))[tag_fnames.ga_len++] =
@ -2030,7 +2025,7 @@ void *cookie UNUSED;
}
#if defined(EXITFREE) || defined(PROTO)
void free_tag_stuff() {
void free_tag_stuff(void) {
ga_clear_strings(&tag_fnames);
do_tag(NULL, DT_FREE, 0, 0, 0);
tag_freematch();
@ -2049,10 +2044,12 @@ void free_tag_stuff() {
*
* Return FAIL if no more tag file names, OK otherwise.
*/
int get_tagfname(tnp, first, buf)
tagname_T *tnp; /* holds status info */
int first; /* TRUE when first file name is wanted */
char_u *buf; /* pointer to buffer of MAXPATHL chars */
int
get_tagfname (
tagname_T *tnp, /* holds status info */
int first, /* TRUE when first file name is wanted */
char_u *buf /* pointer to buffer of MAXPATHL chars */
)
{
char_u *fname = NULL;
char_u *r_ptr;
@ -2152,8 +2149,7 @@ char_u *buf; /* pointer to buffer of MAXPATHL chars */
/*
* Free the contents of a tagname_T that was filled by get_tagfname().
*/
void tagname_free(tnp)
tagname_T *tnp;
void tagname_free(tagname_T *tnp)
{
vim_free(tnp->tn_tags);
vim_findfile_cleanup(tnp->tn_search_ctx);
@ -2169,10 +2165,11 @@ tagname_T *tnp;
*
* Return FAIL if there is a format error in this line, OK otherwise.
*/
static int parse_tag_line(lbuf,
tagp)
char_u *lbuf; /* line to be parsed */
tagptrs_T *tagp;
static int
parse_tag_line (
char_u *lbuf, /* line to be parsed */
tagptrs_T *tagp
)
{
char_u *p;
@ -2232,8 +2229,7 @@ tagptrs_T *tagp;
* Return TRUE if it is a static tag and adjust *tagname to the real tag.
* Return FALSE if it is not a static tag.
*/
static int test_for_static(tagp)
tagptrs_T *tagp;
static int test_for_static(tagptrs_T *tagp)
{
char_u *p;
@ -2274,9 +2270,11 @@ tagptrs_T *tagp;
*
* Return OK or FAIL.
*/
static int parse_match(lbuf, tagp)
char_u *lbuf; /* input: matching line */
tagptrs_T *tagp; /* output: pointers into the line */
static int
parse_match (
char_u *lbuf, /* input: matching line */
tagptrs_T *tagp /* output: pointers into the line */
)
{
int retval;
char_u *p;
@ -2330,8 +2328,7 @@ tagptrs_T *tagp; /* output: pointers into the line */
* with the matching tag file name.
* Returns an allocated string or NULL (out of memory).
*/
static char_u * tag_full_fname(tagp)
tagptrs_T *tagp;
static char_u *tag_full_fname(tagptrs_T *tagp)
{
char_u *fullname;
int c;
@ -2352,10 +2349,12 @@ tagptrs_T *tagp;
*
* returns OK for success, NOTAGFILE when file not found, FAIL otherwise.
*/
static int jumpto_tag(lbuf, forceit, keep_help)
char_u *lbuf; /* line from the tags file for this tag */
int forceit; /* :ta with ! */
int keep_help; /* keep help flag (FALSE for cscope) */
static int
jumpto_tag (
char_u *lbuf, /* line from the tags file for this tag */
int forceit, /* :ta with ! */
int keep_help /* keep help flag (FALSE for cscope) */
)
{
int save_secure;
int save_magic;
@ -2647,10 +2646,7 @@ erret:
* according to tag_fname (name of tag file containing fname).
* Returns a pointer to allocated memory (or NULL when out of memory).
*/
static char_u * expand_tag_fname(fname, tag_fname, expand)
char_u *fname;
char_u *tag_fname;
int expand;
static char_u *expand_tag_fname(char_u *fname, char_u *tag_fname, int expand)
{
char_u *p;
char_u *retval;
@ -2696,8 +2692,7 @@ int expand;
* resulting file name is simplified in place and will either be the same
* length as that supplied, or shorter.
*/
void simplify_filename(filename)
char_u *filename;
void simplify_filename(char_u *filename)
{
int components = 0;
char_u *p, *tail, *start;
@ -2866,11 +2861,7 @@ char_u *filename;
* Return TRUE if tag for file "fname" if tag file "tag_fname" is for current
* file.
*/
static int test_for_current(fname, fname_end, tag_fname, buf_ffname)
char_u *fname;
char_u *fname_end;
char_u *tag_fname;
char_u *buf_ffname;
static int test_for_current(char_u *fname, char_u *fname_end, char_u *tag_fname, char_u *buf_ffname)
{
int c;
int retval = FALSE;
@ -2896,8 +2887,7 @@ char_u *buf_ffname;
* Find the end of the tagaddress.
* Return OK if ";\"" is following, FAIL otherwise.
*/
static int find_extra(pp)
char_u **pp;
static int find_extra(char_u **pp)
{
char_u *str = *pp;
@ -2926,11 +2916,13 @@ char_u **pp;
return FAIL;
}
int expand_tags(tagnames, pat, num_file, file)
int tagnames; /* expand tag names */
char_u *pat;
int *num_file;
char_u ***file;
int
expand_tags (
int tagnames, /* expand tag names */
char_u *pat,
int *num_file,
char_u ***file
)
{
int i;
int c;
@ -2978,11 +2970,13 @@ static int add_tag_field __ARGS((dict_T *dict, char *field_name, char_u *start,
* Add a tag field to the dictionary "dict".
* Return OK or FAIL.
*/
static int add_tag_field(dict, field_name, start, end)
dict_T *dict;
char *field_name;
char_u *start; /* start of the value */
char_u *end; /* after the value; can be NULL */
static int
add_tag_field (
dict_T *dict,
char *field_name,
char_u *start, /* start of the value */
char_u *end /* after the value; can be NULL */
)
{
char_u *buf;
int len = 0;
@ -3021,9 +3015,7 @@ char_u *end; /* after the value; can be NULL */
* Add the tags matching the specified pattern to the list "list"
* as a dictionary
*/
int get_tags(list, pat)
list_T *list;
char_u *pat;
int get_tags(list_T *list, char_u *pat)
{
int num_matches, i, ret;
char_u **matches, *p;

View File

@ -1143,8 +1143,7 @@ static int need_gather = FALSE; /* need to fill termleader[] */
static char_u termleader[256 + 1]; /* for check_termcode() */
static int check_for_codes = FALSE; /* check for key code response */
static struct builtin_term * find_builtin_term(term)
char_u *term;
static struct builtin_term *find_builtin_term(char_u *term)
{
struct builtin_term *p;
@ -1171,8 +1170,7 @@ char_u *term;
* Caller should check if 'name' is a valid builtin term.
* The terminal's name is not set, as this is already done in termcapinit().
*/
static void parse_builtin_tcap(term)
char_u *term;
static void parse_builtin_tcap(char_u *term)
{
struct builtin_term *p;
char_u name[2];
@ -1222,8 +1220,7 @@ static void set_color_count __ARGS((int nr));
* Store it as a number in t_colors.
* Store it as a string in T_CCO (using nr_colors[]).
*/
static void set_color_count(nr)
int nr;
static void set_color_count(int nr)
{
char_u nr_colors[20]; /* string for number of colors */
@ -1259,8 +1256,7 @@ static char *(key_names[]) =
*
* While doing this, until ttest(), some options may be NULL, be careful.
*/
int set_termname(term)
char_u *term;
int set_termname(char_u *term)
{
struct builtin_term *termp;
#ifdef HAVE_TGETENT
@ -1655,9 +1651,11 @@ char_u *term;
# define HMT_SGR 64
static int has_mouse_termcode = 0;
void set_mouse_termcode(n, s)
int n; /* KS_MOUSE, KS_NETTERM_MOUSE or KS_DEC_MOUSE */
char_u *s;
void
set_mouse_termcode (
int n, /* KS_MOUSE, KS_NETTERM_MOUSE or KS_DEC_MOUSE */
char_u *s
)
{
char_u name[2];
@ -1683,8 +1681,10 @@ char_u *s;
# if ((defined(UNIX) || defined(VMS) || defined(OS2)) \
&& defined(FEAT_MOUSE_TTY)) || defined(PROTO)
void del_mouse_termcode(n)
int n; /* KS_MOUSE, KS_NETTERM_MOUSE or KS_DEC_MOUSE */
void
del_mouse_termcode (
int n /* KS_MOUSE, KS_NETTERM_MOUSE or KS_DEC_MOUSE */
)
{
char_u name[2];
@ -1714,9 +1714,7 @@ int n; /* KS_MOUSE, KS_NETTERM_MOUSE or KS_DEC_MOUSE */
* Call tgetent()
* Return error message if it fails, NULL if it's OK.
*/
static char_u * tgetent_error(tbuf, term)
char_u *tbuf;
char_u *term;
static char_u *tgetent_error(char_u *tbuf, char_u *term)
{
int i;
@ -1749,9 +1747,7 @@ char_u *term;
* Some versions of tgetstr() have been reported to return -1 instead of NULL.
* Fix that here.
*/
static char_u * vim_tgetstr(s, pp)
char *s;
char_u **pp;
static char_u *vim_tgetstr(char *s, char_u **pp)
{
char *p;
@ -1770,9 +1766,11 @@ char_u **pp;
* and "li" entries never change. But on some systems this works.
* Errors while getting the entries are ignored.
*/
void getlinecol(cp, rp)
long *cp; /* pointer to columns */
long *rp; /* pointer to rows */
void
getlinecol (
long *cp, /* pointer to columns */
long *rp /* pointer to rows */
)
{
char_u tbuf[TBUFSZ];
@ -1793,9 +1791,7 @@ long *rp; /* pointer to rows */
* If force given, replace an existing entry.
* Return FAIL if the entry was not found, OK if the entry was added.
*/
int add_termcap_entry(name, force)
char_u *name;
int force;
int add_termcap_entry(char_u *name, int force)
{
char_u *term;
int key;
@ -1888,8 +1884,7 @@ int force;
return FAIL;
}
static int term_is_builtin(name)
char_u *name;
static int term_is_builtin(char_u *name)
{
return STRNCMP(name, "builtin_", (size_t)8) == 0;
}
@ -1899,8 +1894,7 @@ char_u *name;
* Assume that the terminal is using 8-bit controls when the name contains
* "8bit", like in "xterm-8bit".
*/
int term_is_8bit(name)
char_u *name;
int term_is_8bit(char_u *name)
{
return detected_8bit || strstr((char *)name, "8bit") != NULL;
}
@ -1911,8 +1905,7 @@ char_u *name;
* <Esc>] -> <M-C-]>
* <Esc>O -> <M-C-O>
*/
static int term_7to8bit(p)
char_u *p;
static int term_7to8bit(char_u *p)
{
if (*p == ESC) {
if (p[1] == '[')
@ -1928,8 +1921,7 @@ char_u *p;
#if !defined(HAVE_TGETENT) || defined(AMIGA) || defined(PROTO)
char_u * tltoa(i)
unsigned long i;
char_u *tltoa(unsigned long i)
{
static char_u buf[16];
char_u *p;
@ -1953,9 +1945,7 @@ unsigned long i;
*/
static char *tgoto __ARGS((char *, int, int));
static char * tgoto(cm, x, y)
char *cm;
int x, y;
static char *tgoto(char *cm, int x, int y)
{
static char buf[30];
char *p, *s, *e;
@ -2001,8 +1991,7 @@ int x, y;
* If "name" is NULL or empty, get the terminal name from the environment.
* If that fails, use the default terminal name.
*/
void termcapinit(name)
char_u *name;
void termcapinit(char_u *name)
{
char_u *term;
@ -2037,7 +2026,7 @@ static int out_pos = 0; /* number of chars in out_buf */
/*
* out_flush(): flush the output buffer
*/
void out_flush() {
void out_flush(void) {
int len;
if (out_pos != 0) {
@ -2052,7 +2041,7 @@ void out_flush() {
* Sometimes a byte out of a multi-byte character is written with out_char().
* To avoid flushing half of the character, call this function first.
*/
void out_flush_check() {
void out_flush_check(void) {
if (enc_dbcs != 0 && out_pos >= OUT_SIZE - MB_MAXBYTES)
out_flush();
}
@ -2063,8 +2052,7 @@ void out_flush_check() {
* This should not be used for outputting text on the screen (use functions
* like msg_puts() and screen_putchar() for that).
*/
void out_char(c)
unsigned c;
void out_char(unsigned c)
{
#if defined(UNIX) || defined(VMS) || defined(AMIGA) || defined(MACOS_X_UNIX)
if (c == '\n') /* turn LF into CR-LF (CRMOD doesn't seem to do this) */
@ -2083,8 +2071,7 @@ static void out_char_nf __ARGS((unsigned));
/*
* out_char_nf(c): like out_char(), but don't flush when p_wd is set
*/
static void out_char_nf(c)
unsigned c;
static void out_char_nf(unsigned c)
{
#if defined(UNIX) || defined(VMS) || defined(AMIGA) || defined(MACOS_X_UNIX)
if (c == '\n') /* turn LF into CR-LF (CRMOD doesn't seem to do this) */
@ -2108,8 +2095,7 @@ unsigned c;
* This should only be used for writing terminal codes, not for outputting
* normal text (use functions like msg_puts() and screen_putchar() for that).
*/
void out_str_nf(s)
char_u *s;
void out_str_nf(char_u *s)
{
if (out_pos > OUT_SIZE - 20) /* avoid terminal strings being split up */
out_flush();
@ -2128,8 +2114,7 @@ char_u *s;
* This should only be used for writing terminal codes, not for outputting
* normal text (use functions like msg_puts() and screen_putchar() for that).
*/
void out_str(s)
char_u *s;
void out_str(char_u *s)
{
if (s != NULL && *s) {
/* avoid terminal strings being split up */
@ -2151,35 +2136,28 @@ char_u *s;
/*
* cursor positioning using termcap parser. (jw)
*/
void term_windgoto(row, col)
int row;
int col;
void term_windgoto(int row, int col)
{
OUT_STR(tgoto((char *)T_CM, col, row));
}
void term_cursor_right(i)
int i;
void term_cursor_right(int i)
{
OUT_STR(tgoto((char *)T_CRI, 0, i));
}
void term_append_lines(line_count)
int line_count;
void term_append_lines(int line_count)
{
OUT_STR(tgoto((char *)T_CAL, 0, line_count));
}
void term_delete_lines(line_count)
int line_count;
void term_delete_lines(int line_count)
{
OUT_STR(tgoto((char *)T_CDL, 0, line_count));
}
#if defined(HAVE_TGETENT) || defined(PROTO)
void term_set_winpos(x, y)
int x;
int y;
void term_set_winpos(int x, int y)
{
/* Can't handle a negative value here */
if (x < 0)
@ -2189,16 +2167,13 @@ int y;
OUT_STR(tgoto((char *)T_CWP, y, x));
}
void term_set_winsize(width, height)
int width;
int height;
void term_set_winsize(int width, int height)
{
OUT_STR(tgoto((char *)T_CWS, height, width));
}
#endif
void term_fg_color(n)
int n;
void term_fg_color(int n)
{
/* Use "AF" termcap entry if present, "Sf" entry otherwise */
if (*T_CAF)
@ -2207,8 +2182,7 @@ int n;
term_color(T_CSF, n);
}
void term_bg_color(n)
int n;
void term_bg_color(int n)
{
/* Use "AB" termcap entry if present, "Sb" entry otherwise */
if (*T_CAB)
@ -2217,9 +2191,7 @@ int n;
term_color(T_CSB, n);
}
static void term_color(s, n)
char_u *s;
int n;
static void term_color(char_u *s, int n)
{
char buf[20];
int i = 2; /* index in s[] just after <Esc>[ or CSI */
@ -2252,8 +2224,7 @@ int n;
/*
* Generic function to set window title, using t_ts and t_fs.
*/
void term_settitle(title)
char_u *title;
void term_settitle(char_u *title)
{
/* t_ts takes one argument: column in status line */
OUT_STR(tgoto((char *)T_TS, 0, 0)); /* set title start */
@ -2267,8 +2238,7 @@ char_u *title;
* Make sure we have a valid set or terminal options.
* Replace all entries that are NULL by empty_option
*/
void ttest(pairs)
int pairs;
void ttest(int pairs)
{
check_options(); /* make sure no options are NULL */
@ -2360,9 +2330,7 @@ int pairs;
* Represent the given long_u as individual bytes, with the most significant
* byte first, and store them in dst.
*/
void add_long_to_buf(val, dst)
long_u val;
char_u *dst;
void add_long_to_buf(long_u val, char_u *dst)
{
int i;
int shift;
@ -2383,9 +2351,7 @@ static int get_long_from_buf __ARGS((char_u *buf, long_u *val));
* (between sizeof(long_u) and 2 * sizeof(long_u)), or -1 if not enough bytes
* were present.
*/
static int get_long_from_buf(buf, val)
char_u *buf;
long_u *val;
static int get_long_from_buf(char_u *buf, long_u *val)
{
int len;
char_u bytes[sizeof(long_u)];
@ -2413,10 +2379,7 @@ long_u *val;
* from buf (between num_bytes and num_bytes*2), or -1 if not enough bytes were
* available.
*/
static int get_bytes_from_buf(buf, bytes, num_bytes)
char_u *buf;
char_u *bytes;
int num_bytes;
static int get_bytes_from_buf(char_u *buf, char_u *bytes, int num_bytes)
{
int len = 0;
int i;
@ -2449,7 +2412,7 @@ int num_bytes;
* Check if the new shell size is valid, correct it if it's too small or way
* too big.
*/
void check_shellsize() {
void check_shellsize(void) {
if (Rows < min_rows()) /* need room for one window and command line */
Rows = min_rows();
limit_screen_size();
@ -2458,7 +2421,7 @@ void check_shellsize() {
/*
* Limit Rows and Columns to avoid an overflow in Rows * Columns.
*/
void limit_screen_size() {
void limit_screen_size(void) {
if (Columns < MIN_COLUMNS)
Columns = MIN_COLUMNS;
else if (Columns > 10000)
@ -2470,7 +2433,7 @@ void limit_screen_size() {
/*
* Invoked just before the screen structures are going to be (re)allocated.
*/
void win_new_shellsize() {
void win_new_shellsize(void) {
static int old_Rows = 0;
static int old_Columns = 0;
@ -2493,7 +2456,7 @@ void win_new_shellsize() {
* Call this function when the Vim shell has been resized in any way.
* Will obtain the current size and redraw (also when size didn't change).
*/
void shell_resized() {
void shell_resized(void) {
set_shellsize(0, 0, FALSE);
}
@ -2501,7 +2464,7 @@ void shell_resized() {
* Check if the shell size changed. Handle a resize.
* When the size didn't change, nothing happens.
*/
void shell_resized_check() {
void shell_resized_check(void) {
int old_Rows = Rows;
int old_Columns = Columns;
@ -2521,9 +2484,7 @@ void shell_resized_check() {
* If 'mustset' is FALSE, we may try to get the real window size and if
* it fails use 'width' and 'height'.
*/
void set_shellsize(width, height, mustset)
int width, height;
int mustset;
void set_shellsize(int width, int height, int mustset)
{
static int busy = FALSE;
@ -2616,8 +2577,7 @@ int mustset;
* Set the terminal to TMODE_RAW (for Normal mode) or TMODE_COOK (for external
* commands and Ex mode).
*/
void settmode(tmode)
int tmode;
void settmode(int tmode)
{
if (full_screen) {
@ -2652,7 +2612,7 @@ int tmode;
}
}
void starttermcap() {
void starttermcap(void) {
if (full_screen && !termcap_active) {
out_str(T_TI); /* start termcap mode */
out_str(T_KS); /* start "keypad transmit" mode */
@ -2669,7 +2629,7 @@ void starttermcap() {
}
}
void stoptermcap() {
void stoptermcap(void) {
screen_stop_highlight();
reset_cterm_colors();
if (termcap_active) {
@ -2714,7 +2674,7 @@ void stoptermcap() {
* request to terminal while reading from a file).
* The result is caught in check_termcode().
*/
void may_req_termresponse() {
void may_req_termresponse(void) {
if (crv_status == CRV_GET
&& cur_tmode == TMODE_RAW
&& starting == 0
@ -2744,7 +2704,7 @@ void may_req_termresponse() {
* This function has the side effect that changes cursor position, so
* it must be called immediately after entering termcap mode.
*/
void may_req_ambiguous_char_width() {
void may_req_ambiguous_char_width(void) {
if (u7_status == U7_GET
&& cur_tmode == TMODE_RAW
&& termcap_active
@ -2799,14 +2759,14 @@ static void log_tr(char *msg) {
/*
* Return TRUE when saving and restoring the screen.
*/
int swapping_screen() {
int swapping_screen(void) {
return full_screen && *T_TI != NUL;
}
/*
* setmouse() - switch mouse on/off depending on current mode and 'mouse'
*/
void setmouse() {
void setmouse(void) {
int checkfor;
@ -2846,8 +2806,7 @@ void setmouse() {
* - the current buffer is a help file and 'h' is in 'mouse' and we are in a
* normal editing mode (not at hit-return message).
*/
int mouse_has(c)
int c;
int mouse_has(int c)
{
char_u *p;
@ -2867,7 +2826,7 @@ int c;
/*
* Return TRUE when 'mousemodel' is set to "popup" or "popup_setpos".
*/
int mouse_model_popup() {
int mouse_model_popup(void) {
return p_mousem[0] == 'p';
}
@ -2876,7 +2835,7 @@ int mouse_model_popup() {
* terminals this makes the screen scrolled to the correct position.
* Used when starting Vim or returning from a shell.
*/
void scroll_start() {
void scroll_start(void) {
if (*T_VS != NUL) {
out_str(T_VS);
out_str(T_VE);
@ -2889,7 +2848,7 @@ static int cursor_is_off = FALSE;
/*
* Enable the cursor.
*/
void cursor_on() {
void cursor_on(void) {
if (cursor_is_off) {
out_str(T_VE);
cursor_is_off = FALSE;
@ -2899,7 +2858,7 @@ void cursor_on() {
/*
* Disable the cursor.
*/
void cursor_off() {
void cursor_off(void) {
if (full_screen) {
if (!cursor_is_off)
out_str(T_VI); /* disable cursor */
@ -2911,7 +2870,7 @@ void cursor_off() {
/*
* Set cursor shape to match Insert mode.
*/
void term_cursor_shape() {
void term_cursor_shape(void) {
static int showing_insert_mode = MAYBE;
if (!full_screen || *T_CSI == NUL || *T_CEI == NUL)
@ -2936,9 +2895,7 @@ void term_cursor_shape() {
* Also set the vertical scroll region for a vertically split window. Always
* the full width of the window, excluding the vertical separator.
*/
void scroll_region_set(wp, off)
win_T *wp;
int off;
void scroll_region_set(win_T *wp, int off)
{
OUT_STR(tgoto((char *)T_CS, W_WINROW(wp) + wp->w_height - 1,
W_WINROW(wp) + off));
@ -2951,7 +2908,7 @@ int off;
/*
* Reset scrolling region to the whole screen.
*/
void scroll_region_reset() {
void scroll_region_reset(void) {
OUT_STR(tgoto((char *)T_CS, (int)Rows - 1, 0));
if (*T_CSV != NUL)
OUT_STR(tgoto((char *)T_CSV, (int)Columns - 1, 0));
@ -2974,7 +2931,7 @@ static int tc_len = 0; /* current number of entries in termcodes[] */
static int termcode_star __ARGS((char_u *code, int len));
void clear_termcodes() {
void clear_termcodes(void) {
while (tc_len > 0)
vim_free(termcodes[--tc_len].code);
vim_free(termcodes);
@ -2999,10 +2956,7 @@ void clear_termcodes() {
* "flags" is TRUE when replacing 7-bit by 8-bit controls is desired.
* "flags" can also be ATC_FROM_TERM for got_code_from_term().
*/
void add_termcode(name, string, flags)
char_u *name;
char_u *string;
int flags;
void add_termcode(char_u *name, char_u *string, int flags)
{
struct termcode *new_tc;
int i, j;
@ -3107,9 +3061,7 @@ int flags;
* The "X" can be any character.
* Return 0 if not found, 2 for ;*X and 1 for O*X and <M-O>*X.
*/
static int termcode_star(code, len)
char_u *code;
int len;
static int termcode_star(char_u *code, int len)
{
/* Shortest is <M-O>*X. With ; shortest is <CSI>1;*X */
if (len >= 3 && code[len - 2] == '*') {
@ -3121,8 +3073,7 @@ int len;
return 0;
}
char_u * find_termcode(name)
char_u *name;
char_u *find_termcode(char_u *name)
{
int i;
@ -3132,16 +3083,14 @@ char_u *name;
return NULL;
}
char_u * get_termcode(i)
int i;
char_u *get_termcode(int i)
{
if (i >= tc_len)
return NULL;
return &termcodes[i].name[0];
}
void del_termcode(name)
char_u *name;
void del_termcode(char_u *name)
{
int i;
@ -3158,8 +3107,7 @@ char_u *name;
/* not found. Give error message? */
}
static void del_termcode_idx(idx)
int idx;
static void del_termcode_idx(int idx)
{
int i;
@ -3173,7 +3121,7 @@ int idx;
* Called when detected that the terminal sends 8-bit codes.
* Convert all 7-bit codes to their 8-bit equivalent.
*/
static void switch_to_8bit() {
static void switch_to_8bit(void) {
int i;
int c;
@ -3206,8 +3154,7 @@ static int orig_topfill = 0;
* Set orig_topline. Used when jumping to another window, so that a double
* click still works.
*/
void set_mouse_topline(wp)
win_T *wp;
void set_mouse_topline(win_T *wp)
{
orig_topline = wp->w_topline;
orig_topfill = wp->w_topfill;
@ -3227,11 +3174,7 @@ win_T *wp;
* "buflen" is then the length of the string in buf[] and is updated for
* inserts and deletes.
*/
int check_termcode(max_offset, buf, bufsize, buflen)
int max_offset;
char_u *buf;
int bufsize;
int *buflen;
int check_termcode(int max_offset, char_u *buf, int bufsize, int *buflen)
{
char_u *tp;
char_u *p;
@ -4196,12 +4139,14 @@ int *buflen;
* nothing). When 'cpoptions' does not contain 'B', a backslash can be used
* instead of a CTRL-V.
*/
char_u * replace_termcodes(from, bufp, from_part, do_lt, special)
char_u *from;
char_u **bufp;
int from_part;
int do_lt; /* also translate <lt> */
int special; /* always accept <key> notation */
char_u *
replace_termcodes (
char_u *from,
char_u **bufp,
int from_part,
int do_lt, /* also translate <lt> */
int special /* always accept <key> notation */
)
{
int i;
int slen;
@ -4374,8 +4319,7 @@ int special; /* always accept <key> notation */
* Find a termcode with keys 'src' (must be NUL terminated).
* Return the index in termcodes[], or -1 if not found.
*/
int find_term_bykeys(src)
char_u *src;
int find_term_bykeys(char_u *src)
{
int i;
int slen = (int)STRLEN(src);
@ -4392,7 +4336,7 @@ char_u *src;
* Gather the first characters in the terminal key codes into a string.
* Used to speed up check_termcode().
*/
static void gather_termleader() {
static void gather_termleader(void) {
int i;
int len = 0;
@ -4414,7 +4358,7 @@ static void gather_termleader() {
* Show all termcodes (for ":set termcap")
* This code looks a lot like showoptions(), but is different.
*/
void show_termcodes() {
void show_termcodes(void) {
int col;
int *items;
int item_count;
@ -4492,10 +4436,7 @@ void show_termcodes() {
* Show one termcode entry.
* Output goes into IObuff[]
*/
int show_one_termcode(name, code, printit)
char_u *name;
char_u *code;
int printit;
int show_one_termcode(char_u *name, char_u *code, int printit)
{
char_u *p;
int len;
@ -4546,13 +4487,13 @@ int printit;
static int xt_index_in = 0;
static int xt_index_out = 0;
static void req_codes_from_term() {
static void req_codes_from_term(void) {
xt_index_out = 0;
xt_index_in = 0;
req_more_codes_from_term();
}
static void req_more_codes_from_term() {
static void req_more_codes_from_term(void) {
char buf[11];
int old_idx = xt_index_out;
@ -4587,9 +4528,7 @@ static void req_more_codes_from_term() {
* Both <name> and <string> are encoded in hex.
* "code" points to the "0" or "1".
*/
static void got_code_from_term(code, len)
char_u *code;
int len;
static void got_code_from_term(char_u *code, int len)
{
#define XT_LEN 100
char_u name[3];
@ -4668,7 +4607,7 @@ int len;
* keyboard input. We don't want responses to be send to that program or
* handled as typed text.
*/
static void check_for_codes_from_term() {
static void check_for_codes_from_term(void) {
int c;
/* If no codes requested or all are answered, no need to wait. */
@ -4714,9 +4653,11 @@ static void check_for_codes_from_term() {
*
* Returns NULL when there is a problem.
*/
char_u * translate_mapping(str, expmap)
char_u *str;
int expmap; /* TRUE when expanding mappings on command-line */
char_u *
translate_mapping (
char_u *str,
int expmap /* TRUE when expanding mappings on command-line */
)
{
garray_T ga;
int c;

115
src/ui.c
View File

@ -19,9 +19,7 @@
#include "vim.h"
void ui_write(s, len)
char_u *s;
int len;
void ui_write(char_u *s, int len)
{
#ifndef NO_CONSOLE
/* Don't output anything in silent mode ("ex -s") unless 'verbose' set */
@ -53,9 +51,7 @@ static char_u *ta_str = NULL;
static int ta_off; /* offset for next char to use when ta_str != NULL */
static int ta_len; /* length of ta_str when it's not NULL*/
void ui_inchar_undo(s, len)
char_u *s;
int len;
void ui_inchar_undo(char_u *s, int len)
{
char_u *new;
int newlen;
@ -91,11 +87,13 @@ int len;
* from a remote client) "buf" can no longer be used. "tb_change_cnt" is NULL
* otherwise.
*/
int ui_inchar(buf, maxlen, wtime, tb_change_cnt)
char_u *buf;
int maxlen;
long wtime; /* don't use "time", MIPS cannot handle it */
int tb_change_cnt;
int
ui_inchar (
char_u *buf,
int maxlen,
long wtime, /* don't use "time", MIPS cannot handle it */
int tb_change_cnt
)
{
int retval = 0;
@ -159,7 +157,7 @@ theend:
/*
* return non-zero if a character is available
*/
int ui_char_avail() {
int ui_char_avail(void) {
#ifndef NO_CONSOLE
# ifdef NO_CONSOLE_INPUT
if (no_console_input())
@ -175,9 +173,7 @@ int ui_char_avail() {
* Delay for the given number of milliseconds. If ignoreinput is FALSE then we
* cancel the delay if a key is hit.
*/
void ui_delay(msec, ignoreinput)
long msec;
int ignoreinput;
void ui_delay(long msec, int ignoreinput)
{
mch_delay(msec, ignoreinput);
}
@ -187,7 +183,7 @@ int ignoreinput;
* otherwise fake it by starting a new shell.
* When running the GUI iconify the window.
*/
void ui_suspend() {
void ui_suspend(void) {
mch_suspend();
}
@ -196,7 +192,7 @@ void ui_suspend() {
* When the OS can't really suspend, call this function to start a shell.
* This is never called in the GUI.
*/
void suspend_shell() {
void suspend_shell(void) {
if (*p_sh == NUL)
EMSG(_(e_shellempty));
else {
@ -212,7 +208,7 @@ void suspend_shell() {
* Use the new sizes as defaults for 'columns' and 'lines'.
* Return OK when size could be determined, FAIL otherwise.
*/
int ui_get_shellsize() {
int ui_get_shellsize(void) {
int retval;
retval = mch_get_shellsize();
@ -232,8 +228,10 @@ int ui_get_shellsize() {
* The gui_set_shellsize() or mch_set_shellsize() function will try to set the
* new size. If this is not possible, it will adjust Rows and Columns.
*/
void ui_set_shellsize(mustset)
int mustset UNUSED; /* set by the user */
void
ui_set_shellsize (
int mustset /* set by the user */
)
{
mch_set_shellsize();
}
@ -242,13 +240,13 @@ int mustset UNUSED; /* set by the user */
* Called when Rows and/or Columns changed. Adjust scroll region and mouse
* region.
*/
void ui_new_shellsize() {
void ui_new_shellsize(void) {
if (full_screen && !exiting) {
mch_new_shellsize();
}
}
void ui_breakcheck() {
void ui_breakcheck(void) {
mch_breakcheck();
}
@ -305,16 +303,16 @@ static int inbufcount = 0; /* number of chars in inbuf[] */
* are used by the gui_* calls when a GUI is used to handle keyboard input.
*/
int vim_is_input_buf_full() {
int vim_is_input_buf_full(void) {
return inbufcount >= INBUFLEN;
}
int vim_is_input_buf_empty() {
int vim_is_input_buf_empty(void) {
return inbufcount == 0;
}
#if defined(FEAT_OLE) || defined(PROTO)
int vim_free_in_input_buf() {
int vim_free_in_input_buf(void) {
return INBUFLEN - inbufcount;
}
@ -325,7 +323,7 @@ int vim_free_in_input_buf() {
* Return the current contents of the input buffer and make it empty.
* The returned pointer must be passed to set_input_buf() later.
*/
char_u * get_input_buf() {
char_u *get_input_buf(void) {
garray_T *gap;
/* We use a growarray to store the data pointer and the length. */
@ -345,8 +343,7 @@ char_u * get_input_buf() {
* Restore the input buffer with a pointer returned from get_input_buf().
* The allocated memory is freed, this only works once!
*/
void set_input_buf(p)
char_u *p;
void set_input_buf(char_u *p)
{
garray_T *gap = (garray_T *)p;
@ -370,9 +367,7 @@ char_u *p;
* Special keys start with CSI. A real CSI must have been translated to
* CSI KS_EXTRA KE_CSI. K_SPECIAL doesn't require translation.
*/
void add_to_input_buf(s, len)
char_u *s;
int len;
void add_to_input_buf(char_u *s, int len)
{
if (inbufcount + len > INBUFLEN + MAX_KEY_CODE_LEN)
return; /* Shouldn't ever happen! */
@ -413,9 +408,7 @@ void add_to_input_buf_csi(char_u *str, int len) {
#endif
void push_raw_key(s, len)
char_u *s;
int len;
void push_raw_key(char_u *s, int len)
{
while (len--)
inbuf[inbufcount++] = *s++;
@ -424,7 +417,7 @@ int len;
#if defined(FEAT_GUI) || defined(FEAT_EVAL) || defined(FEAT_EX_EXTRA) \
|| defined(PROTO)
/* Remove everything from the input buffer. Called when ^C is found */
void trash_input_buf() {
void trash_input_buf(void) {
inbufcount = 0;
}
@ -435,9 +428,7 @@ void trash_input_buf() {
* it in buf.
* Note: this function used to be Read() in unix.c
*/
int read_from_input_buf(buf, maxlen)
char_u *buf;
long maxlen;
int read_from_input_buf(char_u *buf, long maxlen)
{
if (inbufcount == 0) /* if the buffer is empty, fill it */
fill_input_buf(TRUE);
@ -450,8 +441,7 @@ long maxlen;
return (int)maxlen;
}
void fill_input_buf(exit_on_error)
int exit_on_error UNUSED;
void fill_input_buf(int exit_on_error)
{
#if defined(UNIX) || defined(OS2) || defined(VMS) || defined(MACOS_X_UNIX)
int len;
@ -567,7 +557,7 @@ int exit_on_error UNUSED;
/*
* Exit because of an input read error.
*/
void read_error_exit() {
void read_error_exit(void) {
if (silent_mode) /* Normal way to exit for "ex -s" */
getout(0);
STRCPY(IObuff, _("Vim: Error reading input, exiting...\n"));
@ -578,7 +568,7 @@ void read_error_exit() {
/*
* May update the shape of the cursor.
*/
void ui_cursor_shape() {
void ui_cursor_shape(void) {
term_cursor_shape();
@ -592,8 +582,7 @@ void ui_cursor_shape() {
/*
* Check bounds for column number
*/
int check_col(col)
int col;
int check_col(int col)
{
if (col < 0)
return 0;
@ -605,8 +594,7 @@ int col;
/*
* Check bounds for row number
*/
int check_row(row)
int row;
int check_row(int row)
{
if (row < 0)
return 0;
@ -626,9 +614,7 @@ int row;
/*
* Get the contents of the X CUT_BUFFER0 and put it in "cbd".
*/
void yank_cut_buffer0(dpy, cbd)
Display *dpy;
VimClipboard *cbd;
void yank_cut_buffer0(Display *dpy, VimClipboard *cbd)
{
int nbytes = 0;
char_u *buffer = (char_u *)XFetchBuffer(dpy, &nbytes, 0);
@ -694,10 +680,12 @@ VimClipboard *cbd;
* If flags has MOUSE_SETPOS, nothing is done, only the current position is
* remembered.
*/
int jump_to_mouse(flags, inclusive, which_button)
int flags;
int *inclusive; /* used for inclusive operator, can be NULL */
int which_button; /* MOUSE_LEFT, MOUSE_RIGHT, MOUSE_MIDDLE */
int
jump_to_mouse (
int flags,
int *inclusive, /* used for inclusive operator, can be NULL */
int which_button /* MOUSE_LEFT, MOUSE_RIGHT, MOUSE_MIDDLE */
)
{
static int on_status_line = 0; /* #lines below bottom of window */
static int on_sep_line = 0; /* on separator right of window */
@ -986,11 +974,7 @@ retnomove:
* window "win".
* Returns TRUE if the position is below the last line.
*/
int mouse_comp_pos(win, rowp, colp, lnump)
win_T *win;
int *rowp;
int *colp;
linenr_T *lnump;
int mouse_comp_pos(win_T *win, int *rowp, int *colp, linenr_T *lnump)
{
int col = *colp;
int row = *rowp;
@ -1056,9 +1040,7 @@ linenr_T *lnump;
* Find the window at screen position "*rowp" and "*colp". The positions are
* updated to become relative to the top-left of the window.
*/
win_T * mouse_find_win(rowp, colp)
int *rowp;
int *colp UNUSED;
win_T *mouse_find_win(int *rowp, int *colp)
{
frame_T *fp;
@ -1090,8 +1072,7 @@ int *colp UNUSED;
/*
* Translate window coordinates to buffer position without any side effects
*/
int get_fpos_of_mouse(mpos)
pos_T *mpos;
int get_fpos_of_mouse(pos_T *mpos)
{
win_T *wp;
int row = mouse_row;
@ -1129,10 +1110,7 @@ pos_T *mpos;
* Convert a virtual (screen) column to a character column.
* The first column is one.
*/
int vcol2col(wp, lnum, vcol)
win_T *wp;
linenr_T lnum;
int vcol;
int vcol2col(win_T *wp, linenr_T lnum, int vcol)
{
/* try to advance to the specified column */
int count = 0;
@ -1154,8 +1132,7 @@ int vcol;
/*
* Save current Input Method status to specified place.
*/
void im_save_status(psave)
long *psave;
void im_save_status(long *psave)
{
/* Don't save when 'imdisable' is set or "xic" is NULL, IM is always
* disabled then (but might start later).

View File

@ -98,9 +98,9 @@ static void u_freeentries __ARGS((buf_T *buf, u_header_T *uhp,
static void u_freeentry __ARGS((u_entry_T *, long));
static void corruption_error __ARGS((char *mesg, char_u *file_name));
static void u_free_uhp __ARGS((u_header_T *uhp));
static size_t fwrite_crypt __ARGS((buf_T *buf UNUSED, char_u *ptr, size_t len,
static size_t fwrite_crypt __ARGS((buf_T *buf, char_u *ptr, size_t len,
FILE *fp));
static char_u *read_string_decrypt __ARGS((buf_T *buf UNUSED, FILE *fd, int len));
static char_u *read_string_decrypt __ARGS((buf_T *buf, FILE *fd, int len));
static int serialize_header __ARGS((FILE *fp, buf_T *buf, char_u *hash));
static int serialize_uhp __ARGS((FILE *fp, buf_T *buf, u_header_T *uhp));
static u_header_T *unserialize_uhp __ARGS((FILE *fp, char_u *file_name));
@ -210,7 +210,7 @@ static void u_check(int newhead_may_be_NULL) {
* Careful: may trigger autocommands that reload the buffer.
* Returns OK or FAIL.
*/
int u_save_cursor() {
int u_save_cursor(void) {
return u_save((linenr_T)(curwin->w_cursor.lnum - 1),
(linenr_T)(curwin->w_cursor.lnum + 1));
}
@ -221,8 +221,7 @@ int u_save_cursor() {
* Careful: may trigger autocommands that reload the buffer.
* Returns FAIL when lines could not be saved, OK otherwise.
*/
int u_save(top, bot)
linenr_T top, bot;
int u_save(linenr_T top, linenr_T bot)
{
if (undo_off)
return OK;
@ -244,8 +243,7 @@ linenr_T top, bot;
* Careful: may trigger autocommands that reload the buffer.
* Returns FAIL when lines could not be saved, OK otherwise.
*/
int u_savesub(lnum)
linenr_T lnum;
int u_savesub(linenr_T lnum)
{
if (undo_off)
return OK;
@ -259,8 +257,7 @@ linenr_T lnum;
* Careful: may trigger autocommands that reload the buffer.
* Returns FAIL when lines could not be saved, OK otherwise.
*/
int u_inssub(lnum)
linenr_T lnum;
int u_inssub(linenr_T lnum)
{
if (undo_off)
return OK;
@ -275,9 +272,7 @@ linenr_T lnum;
* Careful: may trigger autocommands that reload the buffer.
* Returns FAIL when lines could not be saved, OK otherwise.
*/
int u_savedel(lnum, nlines)
linenr_T lnum;
long nlines;
int u_savedel(linenr_T lnum, long nlines)
{
if (undo_off)
return OK;
@ -290,7 +285,7 @@ long nlines;
* Return TRUE when undo is allowed. Otherwise give an error message and
* return FALSE.
*/
int undo_allowed() {
int undo_allowed(void) {
/* Don't allow changes when 'modifiable' is off. */
if (!curbuf->b_p_ma) {
EMSG(_(e_modifiable));
@ -318,7 +313,7 @@ int undo_allowed() {
/*
* Get the undolevle value for the current buffer.
*/
static long get_undolevel() {
static long get_undolevel(void) {
if (curbuf->b_p_ul == NO_LOCAL_UNDOLEVEL)
return p_ul;
return curbuf->b_p_ul;
@ -333,10 +328,7 @@ static long get_undolevel() {
* Careful: may trigger autocommands that reload the buffer.
* Returns FAIL when lines could not be saved, OK otherwise.
*/
int u_savecommon(top, bot, newbot, reload)
linenr_T top, bot;
linenr_T newbot;
int reload;
int u_savecommon(linenr_T top, linenr_T bot, linenr_T newbot, int reload)
{
linenr_T lnum;
long i;
@ -647,8 +639,7 @@ static char_u e_not_open[] = N_("E828: Cannot open undo file for writing: %s");
/*
* Compute the hash for the current buffer text into hash[UNDO_HASH_SIZE].
*/
void u_compute_hash(hash)
char_u *hash;
void u_compute_hash(char_u *hash)
{
context_sha256_T ctx;
linenr_T lnum;
@ -669,9 +660,7 @@ char_u *hash;
* When "reading" is FALSE use the first name where the directory exists.
* Returns NULL when there is no place to write or no file to read.
*/
char_u * u_get_undo_file_name(buf_ffname, reading)
char_u *buf_ffname;
int reading;
char_u *u_get_undo_file_name(char_u *buf_ffname, int reading)
{
char_u *dirp;
char_u dir_name[IOSIZE + 1];
@ -738,15 +727,12 @@ int reading;
return undo_file_name;
}
static void corruption_error(mesg, file_name)
char *mesg;
char_u *file_name;
static void corruption_error(char *mesg, char_u *file_name)
{
EMSG3(_("E825: Corrupted undo file (%s): %s"), mesg, file_name);
}
static void u_free_uhp(uhp)
u_header_T *uhp;
static void u_free_uhp(u_header_T *uhp)
{
u_entry_T *nuep;
u_entry_T *uep;
@ -764,11 +750,7 @@ u_header_T *uhp;
* Like fwrite() but crypt the bytes when 'key' is set.
* Returns 1 if successful.
*/
static size_t fwrite_crypt(buf, ptr, len, fp)
buf_T *buf UNUSED;
char_u *ptr;
size_t len;
FILE *fp;
static size_t fwrite_crypt(buf_T *buf, char_u *ptr, size_t len, FILE *fp)
{
char_u *copy;
char_u small_buf[100];
@ -794,10 +776,7 @@ FILE *fp;
* Read a string of length "len" from "fd".
* When 'key' is set decrypt the bytes.
*/
static char_u * read_string_decrypt(buf, fd, len)
buf_T *buf UNUSED;
FILE *fd;
int len;
static char_u *read_string_decrypt(buf_T *buf, FILE *fd, int len)
{
char_u *ptr;
@ -807,10 +786,7 @@ int len;
return ptr;
}
static int serialize_header(fp, buf, hash)
FILE *fp;
buf_T *buf;
char_u *hash;
static int serialize_header(FILE *fp, buf_T *buf, char_u *hash)
{
int len;
@ -872,10 +848,7 @@ char_u *hash;
return OK;
}
static int serialize_uhp(fp, buf, uhp)
FILE *fp;
buf_T *buf;
u_header_T *uhp;
static int serialize_uhp(FILE *fp, buf_T *buf, u_header_T *uhp)
{
int i;
u_entry_T *uep;
@ -914,9 +887,7 @@ u_header_T *uhp;
return OK;
}
static u_header_T * unserialize_uhp(fp, file_name)
FILE *fp;
char_u *file_name;
static u_header_T *unserialize_uhp(FILE *fp, char_u *file_name)
{
u_header_T *uhp;
int i;
@ -995,10 +966,7 @@ char_u *file_name;
/*
* Serialize "uep" to "fp".
*/
static int serialize_uep(fp, buf, uep)
FILE *fp;
buf_T *buf;
u_entry_T *uep;
static int serialize_uep(FILE *fp, buf_T *buf, u_entry_T *uep)
{
int i;
size_t len;
@ -1017,10 +985,7 @@ u_entry_T *uep;
return OK;
}
static u_entry_T * unserialize_uep(fp, error, file_name)
FILE *fp;
int *error;
char_u *file_name;
static u_entry_T *unserialize_uep(FILE *fp, int *error, char_u *file_name)
{
int i;
u_entry_T *uep;
@ -1070,9 +1035,7 @@ char_u *file_name;
/*
* Serialize "pos" to "fp".
*/
static void serialize_pos(pos, fp)
pos_T pos;
FILE *fp;
static void serialize_pos(pos_T pos, FILE *fp)
{
put_bytes(fp, (long_u)pos.lnum, 4);
put_bytes(fp, (long_u)pos.col, 4);
@ -1082,9 +1045,7 @@ FILE *fp;
/*
* Unserialize the pos_T at the current position in fp.
*/
static void unserialize_pos(pos, fp)
pos_T *pos;
FILE *fp;
static void unserialize_pos(pos_T *pos, FILE *fp)
{
pos->lnum = get4c(fp);
if (pos->lnum < 0)
@ -1100,9 +1061,7 @@ FILE *fp;
/*
* Serialize "info" to "fp".
*/
static void serialize_visualinfo(info, fp)
visualinfo_T *info;
FILE *fp;
static void serialize_visualinfo(visualinfo_T *info, FILE *fp)
{
serialize_pos(info->vi_start, fp);
serialize_pos(info->vi_end, fp);
@ -1113,9 +1072,7 @@ FILE *fp;
/*
* Unserialize the visualinfo_T at the current position in fp.
*/
static void unserialize_visualinfo(info, fp)
visualinfo_T *info;
FILE *fp;
static void unserialize_visualinfo(visualinfo_T *info, FILE *fp)
{
unserialize_pos(&info->vi_start, fp);
unserialize_pos(&info->vi_end, fp);
@ -1127,9 +1084,7 @@ FILE *fp;
* Write the pointer to an undo header. Instead of writing the pointer itself
* we use the sequence number of the header. This is converted back to
* pointers when reading. */
static void put_header_ptr(fp, uhp)
FILE *fp;
u_header_T *uhp;
static void put_header_ptr(FILE *fp, u_header_T *uhp)
{
put_bytes(fp, (long_u)(uhp != NULL ? uhp->uh_seq : 0), 4);
}
@ -1143,11 +1098,7 @@ u_header_T *uhp;
* "forceit" is TRUE for ":wundo!", FALSE otherwise.
* "hash[UNDO_HASH_SIZE]" must be the hash value of the buffer text.
*/
void u_write_undo(name, forceit, buf, hash)
char_u *name;
int forceit;
buf_T *buf;
char_u *hash;
void u_write_undo(char_u *name, int forceit, buf_T *buf, char_u *hash)
{
u_header_T *uhp;
char_u *file_name;
@ -1378,10 +1329,7 @@ theend:
* Otherwise use curbuf->b_ffname to generate the undo file name.
* "hash[UNDO_HASH_SIZE]" must be the hash value of the buffer text.
*/
void u_read_undo(name, hash, orig_name)
char_u *name;
char_u *hash;
char_u *orig_name;
void u_read_undo(char_u *name, char_u *hash, char_u *orig_name)
{
char_u *file_name;
FILE *fp;
@ -1684,8 +1632,7 @@ theend:
* If 'cpoptions' contains 'u': Undo the previous undo or redo (vi compatible).
* If 'cpoptions' does not contain 'u': Always undo.
*/
void u_undo(count)
int count;
void u_undo(int count)
{
/*
* If we get an undo command while executing a macro, we behave like the
@ -1708,8 +1655,7 @@ int count;
* If 'cpoptions' contains 'u': Repeat the previous undo or redo.
* If 'cpoptions' does not contain 'u': Always redo.
*/
void u_redo(count)
int count;
void u_redo(int count)
{
if (vim_strchr(p_cpo, CPO_UNDO) == NULL)
undo_undoes = FALSE;
@ -1719,8 +1665,7 @@ int count;
/*
* Undo or redo, depending on 'undo_undoes', 'count' times.
*/
static void u_doit(startcount)
int startcount;
static void u_doit(int startcount)
{
int count = startcount;
@ -1788,11 +1733,7 @@ int startcount;
* When "absolute" is TRUE use "step" as the sequence number to jump to.
* "sec" must be FALSE then.
*/
void undo_time(step, sec, file, absolute)
long step;
int sec;
int file;
int absolute;
void undo_time(long step, int sec, int file, int absolute)
{
long target;
long closest;
@ -2099,8 +2040,7 @@ int absolute;
*
* When "undo" is TRUE we go up in the tree, when FALSE we go down.
*/
static void u_undoredo(undo)
int undo;
static void u_undoredo(int undo)
{
char_u **newarray = NULL;
linenr_T oldsize;
@ -2344,9 +2284,11 @@ int undo;
* Otherwise, report the number of changes (this may be incorrect
* in some cases, but it's better than nothing).
*/
static void u_undo_end(did_undo, absolute)
int did_undo; /* just did an undo */
int absolute; /* used ":undo N" */
static void
u_undo_end (
int did_undo, /* just did an undo */
int absolute /* used ":undo N" */
)
{
char *msgstr;
u_header_T *uhp;
@ -2417,8 +2359,10 @@ int absolute; /* used ":undo N" */
/*
* u_sync: stop adding to the current entry list
*/
void u_sync(force)
int force; /* Also sync when no_u_sync is set. */
void
u_sync (
int force /* Also sync when no_u_sync is set. */
)
{
/* Skip it when already synced or syncing is disabled. */
if (curbuf->b_u_synced || (!force && no_u_sync > 0))
@ -2434,8 +2378,7 @@ int force; /* Also sync when no_u_sync is set. */
/*
* ":undolist": List the leafs of the undo tree
*/
void ex_undolist(eap)
exarg_T *eap UNUSED;
void ex_undolist(exarg_T *eap)
{
garray_T ga;
u_header_T *uhp;
@ -2528,10 +2471,7 @@ exarg_T *eap UNUSED;
/*
* Put the timestamp of an undo header in "buf[buflen]" in a nice format.
*/
static void u_add_time(buf, buflen, tt)
char_u *buf;
size_t buflen;
time_t tt;
static void u_add_time(char_u *buf, size_t buflen, time_t tt)
{
#ifdef HAVE_STRFTIME
struct tm *curtime;
@ -2553,8 +2493,7 @@ time_t tt;
/*
* ":undojoin": continue adding to the last entry list
*/
void ex_undojoin(eap)
exarg_T *eap UNUSED;
void ex_undojoin(exarg_T *eap)
{
if (curbuf->b_u_newhead == NULL)
return; /* nothing changed before */
@ -2577,8 +2516,7 @@ exarg_T *eap UNUSED;
* Called after writing or reloading the file and setting b_changed to FALSE.
* Now an undo means that the buffer is modified.
*/
void u_unchanged(buf)
buf_T *buf;
void u_unchanged(buf_T *buf)
{
u_unch_branch(buf->b_u_oldhead);
buf->b_did_warn = FALSE;
@ -2588,7 +2526,7 @@ buf_T *buf;
* After reloading a buffer which was saved for 'undoreload': Find the first
* line that was changed and set the cursor there.
*/
void u_find_first_changed() {
void u_find_first_changed(void) {
u_header_T *uhp = curbuf->b_u_newhead;
u_entry_T *uep;
linenr_T lnum;
@ -2620,8 +2558,7 @@ void u_find_first_changed() {
* Increase the write count, store it in the last undo header, what would be
* used for "u".
*/
void u_update_save_nr(buf)
buf_T *buf;
void u_update_save_nr(buf_T *buf)
{
u_header_T *uhp;
@ -2636,8 +2573,7 @@ buf_T *buf;
uhp->uh_save_nr = buf->b_u_save_nr_last;
}
static void u_unch_branch(uhp)
u_header_T *uhp;
static void u_unch_branch(u_header_T *uhp)
{
u_header_T *uh;
@ -2652,7 +2588,7 @@ u_header_T *uhp;
* Get pointer to last added entry.
* If it's not valid, give an error message and return NULL.
*/
static u_entry_T * u_get_headentry() {
static u_entry_T *u_get_headentry(void) {
if (curbuf->b_u_newhead == NULL || curbuf->b_u_newhead->uh_entry == NULL) {
EMSG(_("E439: undo list corrupt"));
return NULL;
@ -2664,7 +2600,7 @@ static u_entry_T * u_get_headentry() {
* u_getbot(): compute the line number of the previous u_save
* It is called only when b_u_synced is FALSE.
*/
static void u_getbot() {
static void u_getbot(void) {
u_entry_T *uep;
linenr_T extra;
@ -2698,10 +2634,12 @@ static void u_getbot() {
/*
* Free one header "uhp" and its entry list and adjust the pointers.
*/
static void u_freeheader(buf, uhp, uhpp)
buf_T *buf;
u_header_T *uhp;
u_header_T **uhpp; /* if not NULL reset when freeing this header */
static void
u_freeheader (
buf_T *buf,
u_header_T *uhp,
u_header_T **uhpp /* if not NULL reset when freeing this header */
)
{
u_header_T *uhap;
@ -2732,10 +2670,12 @@ u_header_T **uhpp; /* if not NULL reset when freeing this header */
/*
* Free an alternate branch and any following alternate branches.
*/
static void u_freebranch(buf, uhp, uhpp)
buf_T *buf;
u_header_T *uhp;
u_header_T **uhpp; /* if not NULL reset when freeing this header */
static void
u_freebranch (
buf_T *buf,
u_header_T *uhp,
u_header_T **uhpp /* if not NULL reset when freeing this header */
)
{
u_header_T *tofree, *next;
@ -2764,10 +2704,12 @@ u_header_T **uhpp; /* if not NULL reset when freeing this header */
* Free all the undo entries for one header and the header itself.
* This means that "uhp" is invalid when returning.
*/
static void u_freeentries(buf, uhp, uhpp)
buf_T *buf;
u_header_T *uhp;
u_header_T **uhpp; /* if not NULL reset when freeing this header */
static void
u_freeentries (
buf_T *buf,
u_header_T *uhp,
u_header_T **uhpp /* if not NULL reset when freeing this header */
)
{
u_entry_T *uep, *nuep;
@ -2794,9 +2736,7 @@ u_header_T **uhpp; /* if not NULL reset when freeing this header */
/*
* free entry 'uep' and 'n' lines in uep->ue_array[]
*/
static void u_freeentry(uep, n)
u_entry_T *uep;
long n;
static void u_freeentry(u_entry_T *uep, long n)
{
while (n > 0)
vim_free(uep->ue_array[--n]);
@ -2810,8 +2750,7 @@ long n;
/*
* invalidate the undo buffer; called when storage has already been released
*/
void u_clearall(buf)
buf_T *buf;
void u_clearall(buf_T *buf)
{
buf->b_u_newhead = buf->b_u_oldhead = buf->b_u_curhead = NULL;
buf->b_u_synced = TRUE;
@ -2823,8 +2762,7 @@ buf_T *buf;
/*
* save the line "lnum" for the "U" command
*/
void u_saveline(lnum)
linenr_T lnum;
void u_saveline(linenr_T lnum)
{
if (lnum == curbuf->b_u_line_lnum) /* line is already saved */
return;
@ -2844,7 +2782,7 @@ linenr_T lnum;
* clear the line saved for the "U" command
* (this is used externally for crossing a line while in insert mode)
*/
void u_clearline() {
void u_clearline(void) {
if (curbuf->b_u_line_ptr != NULL) {
vim_free(curbuf->b_u_line_ptr);
curbuf->b_u_line_ptr = NULL;
@ -2858,7 +2796,7 @@ void u_clearline() {
* We also allow the cursor to be in another line.
* Careful: may trigger autocommands that reload the buffer.
*/
void u_undoline() {
void u_undoline(void) {
colnr_T t;
char_u *oldp;
@ -2896,8 +2834,7 @@ void u_undoline() {
/*
* Free all allocated memory blocks for the buffer 'buf'.
*/
void u_blockfree(buf)
buf_T *buf;
void u_blockfree(buf_T *buf)
{
while (buf->b_u_oldhead != NULL)
u_freeheader(buf, buf->b_u_oldhead, NULL);
@ -2908,8 +2845,7 @@ buf_T *buf;
* u_save_line(): allocate memory and copy line 'lnum' into it.
* Returns NULL when out of memory.
*/
static char_u * u_save_line(lnum)
linenr_T lnum;
static char_u *u_save_line(linenr_T lnum)
{
return vim_strsave(ml_get(lnum));
}
@ -2919,15 +2855,14 @@ linenr_T lnum;
* check the first character, because it can only be "dos", "unix" or "mac").
* "nofile" and "scratch" type buffers are considered to always be unchanged.
*/
int bufIsChanged(buf)
buf_T *buf;
int bufIsChanged(buf_T *buf)
{
return
!bt_dontwrite(buf) &&
(buf->b_changed || file_ff_differs(buf, TRUE));
}
int curbufIsChanged() {
int curbufIsChanged(void) {
return
!bt_dontwrite(curbuf) &&
(curbuf->b_changed || file_ff_differs(curbuf, TRUE));
@ -2937,9 +2872,7 @@ int curbufIsChanged() {
* For undotree(): Append the list of undo blocks at "first_uhp" to "list".
* Recursive.
*/
void u_eval_tree(first_uhp, list)
u_header_T *first_uhp;
list_T *list;
void u_eval_tree(u_header_T *first_uhp, list_T *list)
{
u_header_T *uhp = first_uhp;
dict_T *dict;

View File

@ -568,7 +568,7 @@ static char *(extra_patches[]) =
NULL
};
int highest_patch() {
int highest_patch(void) {
int i;
int h = 0;
@ -581,8 +581,7 @@ int highest_patch() {
/*
* Return TRUE if patch "n" has been included.
*/
int has_patch(n)
int n;
int has_patch(int n)
{
int i;
@ -592,8 +591,7 @@ int n;
return FALSE;
}
void ex_version(eap)
exarg_T *eap;
void ex_version(exarg_T *eap)
{
/*
* Ignore a ":version 9.99" command.
@ -607,7 +605,7 @@ exarg_T *eap;
/*
* List all features aligned in columns, dictionary style.
*/
static void list_features() {
static void list_features(void) {
int i;
int ncol;
int nrow;
@ -662,7 +660,7 @@ static void list_features() {
}
}
void list_version() {
void list_version(void) {
int i;
int first;
char *s = "";
@ -792,8 +790,7 @@ void list_version() {
* Output a string for the version message. If it's going to wrap, output a
* newline, unless the message is too long to fit on the screen anyway.
*/
static void version_msg(s)
char *s;
static void version_msg(char *s)
{
int len = (int)STRLEN(s);
@ -810,7 +807,7 @@ static void do_intro_line __ARGS((int row, char_u *mesg, int add_version,
/*
* Show the intro message when not editing a file.
*/
void maybe_intro_message() {
void maybe_intro_message(void) {
if (bufempty()
&& curbuf->b_fname == NULL
&& firstwin->w_next == NULL
@ -823,8 +820,10 @@ void maybe_intro_message() {
* Only used when starting Vim on an empty file, without a file name.
* Or with the ":intro" command (for Sven :-).
*/
void intro_message(colon)
int colon; /* TRUE for ":intro" */
void
intro_message (
int colon /* TRUE for ":intro" */
)
{
int i;
int row;
@ -904,11 +903,7 @@ int colon; /* TRUE for ":intro" */
msg_row = row;
}
static void do_intro_line(row, mesg, add_version, attr)
int row;
char_u *mesg;
int add_version;
int attr;
static void do_intro_line(int row, char_u *mesg, int add_version, int attr)
{
char_u vers[20];
int col;
@ -969,8 +964,7 @@ int attr;
/*
* ":intro": clear screen, display intro screen and wait for return.
*/
void ex_intro(eap)
exarg_T *eap UNUSED;
void ex_intro(exarg_T *eap)
{
screenclear();
intro_message(TRUE);

View File

@ -72,14 +72,6 @@ Error: configure did not run properly.Check auto/config.log.
# endif
#endif
/* Mark unused function arguments with UNUSED, so that gcc -Wunused-parameter
* can be used to check for mistakes. */
#ifdef HAVE_ATTRIBUTE_UNUSED
# define UNUSED __attribute__((unused))
#else
# define UNUSED
#endif
# ifdef HAVE_LOCALE_H
# include <locale.h>
# endif

File diff suppressed because it is too large Load Diff