Replaced most TRUE/FALSE macros in arabic, mbyte and spell. #645

This commit is contained in:
Klemen Košir 2014-04-29 10:52:10 +02:00 committed by Justin M. Keyes
parent ef34a0ab13
commit a568e8b644
24 changed files with 501 additions and 495 deletions

View File

@ -9,7 +9,6 @@
/// Medial - unicode form-B middle char denoted with a_m_*
/// Final - unicode form-B final char denoted with a_f_*
/// Stand-Alone - unicode form-B isolated char denoted with a_s_* (NOT USED)
///
#include "nvim/vim.h"
#include "nvim/arabic.h"
@ -245,7 +244,7 @@
# include "arabic.c.generated.h"
#endif
// Returns True if c is an ISO-8859-6 shaped ARABIC letter (user entered).
static int A_is_a(int cur_c)
static bool A_is_a(int cur_c)
{
switch (cur_c) {
case a_HAMZA:
@ -285,14 +284,14 @@ static int A_is_a(int cur_c)
case a_WAW:
case a_ALEF_MAKSURA:
case a_YEH:
return TRUE;
return true;
}
return FALSE;
return false;
}
// Returns True if c is an Isolated Form-B ARABIC letter
static int A_is_s(int cur_c)
static bool A_is_s(int cur_c)
{
switch (cur_c) {
case a_s_HAMZA:
@ -331,14 +330,14 @@ static int A_is_s(int cur_c)
case a_s_WAW:
case a_s_ALEF_MAKSURA:
case a_s_YEH:
return TRUE;
return true;
}
return FALSE;
return false;
}
// Returns True if c is a Final shape of an ARABIC letter
static int A_is_f(int cur_c)
static bool A_is_f(int cur_c)
{
switch (cur_c) {
case a_f_ALEF_MADDA:
@ -380,9 +379,9 @@ static int A_is_f(int cur_c)
case a_f_LAM_ALEF_HAMZA_ABOVE:
case a_f_LAM_ALEF_HAMZA_BELOW:
case a_f_LAM_ALEF:
return TRUE;
return true;
}
return FALSE;
return false;
}
// Change shape - from ISO-8859-6/Isolated to Form-B Isolated
@ -1423,17 +1422,17 @@ int arabic_shape(int c, int *ccp, int *c1p, int prev_c, int prev_c1,
///
/// @param one First character.
/// @param two Character just after "one".
int arabic_combine(int one, int two)
bool arabic_combine(int one, int two)
{
if (one == a_LAM) {
return arabic_maycombine(two);
}
return FALSE;
return false;
}
/// Check whether we are dealing with a character that could be regarded as an
/// Arabic combining character, need to check the character before this.
int arabic_maycombine(int two)
bool arabic_maycombine(int two)
{
if (p_arshape && !p_tbidi) {
return two == a_ALEF_MADDA
@ -1441,7 +1440,7 @@ int arabic_maycombine(int two)
|| two == a_ALEF_HAMZA_BELOW
|| two == a_ALEF;
}
return FALSE;
return false;
}
/*
@ -1461,7 +1460,7 @@ static int A_firstc_laa(int c, int c1)
* A_is_harakat returns TRUE if 'c' is an Arabic Harakat character
* (harakat/tanween)
*/
static int A_is_harakat(int c)
static bool A_is_harakat(int c)
{
return c >= a_FATHATAN && c <= a_SUKUN;
}
@ -1470,7 +1469,7 @@ static int A_is_harakat(int c)
* A_is_iso returns TRUE if 'c' is an Arabic ISO-8859-6 character
* (alphabet/number/punctuation)
*/
static int A_is_iso(int c)
static bool A_is_iso(int c)
{
return (c >= a_HAMZA && c <= a_GHAIN) ||
(c >= a_TATWEEL && c <= a_HAMZA_BELOW) ||
@ -1481,7 +1480,7 @@ static int A_is_iso(int c)
* A_is_formb returns TRUE if 'c' is an Arabic 10646-1 FormB character
* (alphabet/number/punctuation)
*/
static int A_is_formb(int c)
static bool A_is_formb(int c)
{
return (c >= a_s_FATHATAN && c <= a_s_DAMMATAN) ||
c == a_s_KASRATAN ||
@ -1492,7 +1491,7 @@ static int A_is_formb(int c)
/*
* A_is_ok returns TRUE if 'c' is an Arabic 10646 (8859-6 or Form-B)
*/
static int A_is_ok(int c)
static bool A_is_ok(int c)
{
return A_is_iso(c) || A_is_formb(c);
}
@ -1501,7 +1500,7 @@ static int A_is_ok(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(int c)
static bool A_is_valid(int c)
{
return A_is_ok(c) && !A_is_special(c);
}
@ -1510,7 +1509,7 @@ static int A_is_valid(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(int c)
static bool A_is_special(int c)
{
return c == a_HAMZA || c == a_s_HAMZA;
}

View File

@ -2,7 +2,7 @@
#define NVIM_ARABIC_H
/// Whether c belongs to the range of Arabic characters that might be shaped.
static inline int arabic_char(int c)
static inline bool arabic_char(int c)
{
// return c >= a_HAMZA && c <= a_MINI_ALEF;
return c >= 0x0621 && c <= 0x0670;

View File

@ -314,7 +314,7 @@ typedef struct {
# ifdef USE_ICONV
iconv_t vc_fd; /* for CONV_ICONV */
# endif
int vc_fail; /* fail for invalid char, don't use '?' */
bool vc_fail; /* fail for invalid char, don't use '?' */
} vimconv_T;
/*
@ -432,7 +432,7 @@ typedef struct {
/* for spell checking */
garray_T b_langp; /* list of pointers to slang_T, see spell.c */
char_u b_spell_ismw[256]; /* flags: is midword char */
bool b_spell_ismw[256]; /* flags: is midword char */
char_u *b_spell_ismw_mb; /* multi-byte midword chars */
char_u *b_p_spc; /* 'spellcapcheck' */
regprog_T *b_cap_prog; /* program for 'spellcapcheck' */
@ -645,9 +645,9 @@ struct file_buffer {
long b_p_sw; /* 'shiftwidth' */
int b_p_si; /* 'smartindent' */
long b_p_sts; /* 'softtabstop' */
long b_p_sts_nopaste; /* b_p_sts saved for paste mode */
long b_p_sts_nopaste; /* b_p_sts saved for paste mode */
char_u *b_p_sua; /* 'suffixesadd' */
int b_p_swf; /* 'swapfile' */
bool b_p_swf; /* 'swapfile' */
long b_p_smc; /* 'synmaxcol' */
char_u *b_p_syn; /* 'syntax' */
long b_p_ts; /* 'tabstop' */
@ -738,7 +738,7 @@ struct file_buffer {
*/
int b_help; /* TRUE for help file buffer (when set b_p_bt
is "help") */
int b_spell; /* TRUE for a spell file buffer, most fields
bool b_spell; /* True for a spell file buffer, most fields
are not used! Use the B_SPELL macro to
access b_spell without #ifdef. */

View File

@ -1523,7 +1523,7 @@ static int getexactdigraph(int char1, int char2, int meta_char)
vc.vc_type = CONV_NONE;
if (convert_setup(&vc, (char_u *)"utf-8", p_enc) == OK) {
vc.vc_fail = TRUE;
vc.vc_fail = true;
to = string_convert(&vc, buf, &i);
if (to != NULL) {

View File

@ -3415,7 +3415,7 @@ static int ins_compl_get_exp(pos_T *ini)
pos_T *pos;
char_u **matches;
int save_p_scs;
int save_p_ws;
bool save_p_ws;
int save_p_ic;
int i;
int num_matches;
@ -3613,9 +3613,9 @@ static int ins_compl_get_exp(pos_T *ini)
* wrapscan for curbuf to avoid missing matches -- Acevedo,Webb */
save_p_ws = p_ws;
if (ins_buf != curbuf)
p_ws = FALSE;
p_ws = false;
else if (*e_cpt == '.')
p_ws = TRUE;
p_ws = true;
for (;; ) {
int flags = 0;

View File

@ -9779,7 +9779,7 @@ static void f_has(typval_T *argvars, typval_T *rettv)
n = has_mbyte;
#if defined(USE_ICONV) && defined(DYNAMIC_ICONV)
} else if (STRICMP(name, "iconv") == 0) {
n = iconv_enabled(FALSE);
n = iconv_enabled(false);
#endif
} else if (STRICMP(name, "syntax_items") == 0) {
n = syntax_present(curwin);
@ -12054,8 +12054,8 @@ static int get_search_arg(typval_T *varp, int *flagsp)
while (*flags != NUL) {
switch (*flags) {
case 'b': dir = BACKWARD; break;
case 'w': p_ws = TRUE; break;
case 'W': p_ws = FALSE; break;
case 'w': p_ws = true; break;
case 'W': p_ws = false; break;
default: mask = 0;
if (flagsp != NULL)
switch (*flags) {
@ -12090,7 +12090,7 @@ static int search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp)
char_u *pat;
pos_T pos;
pos_T save_cursor;
int save_p_ws = p_ws;
bool save_p_ws = p_ws;
int dir;
int retval = 0; /* default: FAIL */
long lnum_stop = 0;
@ -12293,7 +12293,7 @@ static int searchpair_cmn(typval_T *argvars, pos_T *match_pos)
{
char_u *spat, *mpat, *epat;
char_u *skip;
int save_p_ws = p_ws;
bool save_p_ws = p_ws;
int dir;
int flags = 0;
char_u nbuf1[NUMBUFLEN];
@ -12326,7 +12326,7 @@ static int searchpair_cmn(typval_T *argvars, pos_T *match_pos)
/* Using 'r' implies 'W', otherwise it doesn't work. */
if (flags & SP_REPEAT)
p_ws = FALSE;
p_ws = false;
/* Optional fifth argument: skip expression */
if (argvars[3].v_type == VAR_UNKNOWN
@ -13343,7 +13343,7 @@ static void f_spellbadword(typval_T *argvars, typval_T *rettv)
if (str != NULL) {
/* Check the argument for spelling. */
while (*str != NUL) {
len = spell_check(curwin, str, &attr, &capcol, FALSE);
len = spell_check(curwin, str, &attr, &capcol, false);
if (attr != HLF_COUNT) {
word = str;
break;
@ -13372,7 +13372,7 @@ static void f_spellsuggest(typval_T *argvars, typval_T *rettv)
int maxcount;
garray_T ga;
listitem_T *li;
int need_capital = FALSE;
bool need_capital = false;
rettv_list_alloc(rettv);
@ -13390,7 +13390,7 @@ static void f_spellsuggest(typval_T *argvars, typval_T *rettv)
} else
maxcount = 25;
spell_suggest_list(&ga, str, maxcount, need_capital, FALSE);
spell_suggest_list(&ga, str, maxcount, need_capital, false);
for (int i = 0; i < ga.ga_len; ++i) {
str = ((char_u **)ga.ga_data)[i];

View File

@ -3445,7 +3445,7 @@ void do_sub(exarg_T *eap)
regmmatch_T regmatch;
static int do_all = FALSE; /* do multiple substitutions per line */
static int do_ask = FALSE; /* ask for confirmation */
static int do_count = FALSE; /* count only */
static bool do_count = false; /* count only */
static int do_error = TRUE; /* if false, ignore errors */
static int do_print = FALSE; /* print last line with subs. */
static int do_list = FALSE; /* list last line with subs. */
@ -3584,7 +3584,7 @@ void do_sub(exarg_T *eap)
do_join(eap->line2 - eap->line1 + 1, FALSE, TRUE, FALSE, true);
sub_nlines = sub_nsubs = eap->line2 - eap->line1 + 1;
do_sub_msg(FALSE);
do_sub_msg(false);
ex_may_print(eap);
return;
@ -3605,7 +3605,7 @@ void do_sub(exarg_T *eap)
}
do_error = TRUE;
do_print = FALSE;
do_count = FALSE;
do_count = false;
do_number = FALSE;
do_ic = 0;
}
@ -3619,7 +3619,7 @@ void do_sub(exarg_T *eap)
else if (*cmd == 'c')
do_ask = !do_ask;
else if (*cmd == 'n')
do_count = TRUE;
do_count = true;
else if (*cmd == 'e')
do_error = !do_error;
else if (*cmd == 'r') /* use last used regexp */
@ -4355,9 +4355,9 @@ skip:
* Can also be used after a ":global" command.
* Return TRUE if a message was given.
*/
int
bool
do_sub_msg (
int count_only /* used 'n' flag for ":s" */
bool count_only /* used 'n' flag for ":s" */
)
{
/*
@ -4390,13 +4390,13 @@ do_sub_msg (
if (msg(msg_buf))
/* save message to display it after redraw */
set_keep_msg(msg_buf, 0);
return TRUE;
return true;
}
if (got_int) {
EMSG(_(e_interr));
return TRUE;
return true;
}
return FALSE;
return false;
}
/*
@ -4562,7 +4562,7 @@ void global_exe(char_u *cmd)
* number of extra or deleted lines.
* Don't report extra or deleted lines in the edge case where the buffer
* we are in after execution is different from the buffer we started in. */
if (!do_sub_msg(FALSE) && curbuf == old_buf)
if (!do_sub_msg(false) && curbuf == old_buf)
msgmore(curbuf->b_ml.ml_line_count - old_lcount);
}

View File

@ -1534,17 +1534,17 @@ void get_arglist(garray_T *gap, char_u *str)
/*
* Parse a list of arguments (file names), expand them and return in
* "fnames[fcountp]". When "wig" is TRUE, removes files matching 'wildignore'.
* "fnames[fcountp]". When "wig" is true, removes files matching 'wildignore'.
* Return FAIL or OK.
*/
int get_arglist_exp(char_u *str, int *fcountp, char_u ***fnamesp, int wig)
int get_arglist_exp(char_u *str, int *fcountp, char_u ***fnamesp, bool wig)
{
garray_T ga;
int i;
get_arglist(&ga, str);
if (wig == TRUE)
if (wig)
i = expand_wildcards(ga.ga_len, (char_u **)ga.ga_data,
fcountp, fnamesp, EW_FILE|EW_NOTFOUND);
else

View File

@ -618,7 +618,7 @@ EXTERN int vr_lines_changed INIT(= 0); /* #Lines changed by "gR" so far */
EXTERN int enc_dbcs INIT(= 0); /* One of DBCS_xxx values if
DBCS encoding */
EXTERN int enc_unicode INIT(= 0); /* 2: UCS-2 or UTF-16, 4: UCS-4 */
EXTERN int enc_utf8 INIT(= FALSE); /* UTF-8 encoded Unicode */
EXTERN bool enc_utf8 INIT(= false); /* UTF-8 encoded Unicode */
EXTERN int enc_latin1like INIT(= TRUE); /* 'encoding' is latin1 comp. */
EXTERN int has_mbyte INIT(= 0); /* any multi-byte encoding */
@ -1117,4 +1117,12 @@ EXTERN char *ignoredp;
* os_unix.c */
EXTERN int curr_tmode INIT(= TMODE_COOK); /* contains current terminal mode */
/// Used to track the status of external functions.
/// Currently only used for iconv().
typedef enum {
kUnknown,
kWorking,
kBroken
} WorkingStatus;
#endif /* NVIM_GLOBALS_H */

View File

@ -288,7 +288,7 @@ int main(int argc, char **argv)
cmdline_row = Rows - p_ch;
msg_row = cmdline_row;
screenalloc(FALSE); /* allocate screen buffers */
screenalloc(false); /* allocate screen buffers */
set_init_2();
TIME_MSG("inits 2");

View File

@ -433,7 +433,7 @@ char_u * mb_init()
|| STRNCMP(p_enc, "iso-8859-", 9) == 0) {
/* Accept any "8bit-" or "iso-8859-" name. */
enc_unicode = 0;
enc_utf8 = FALSE;
enc_utf8 = false;
} else if (STRNCMP(p_enc, "2byte-", 6) == 0) {
/* Unix: accept any "2byte-" name, assume current locale. */
enc_dbcs_new = DBCS_2BYTE;
@ -441,7 +441,7 @@ char_u * mb_init()
i = enc_canon_table[idx].prop;
if (i & ENC_UNICODE) {
/* Unicode */
enc_utf8 = TRUE;
enc_utf8 = true;
if (i & (ENC_2BYTE | ENC_2WORD))
enc_unicode = 2;
else if (i & ENC_4BYTE)
@ -454,14 +454,14 @@ char_u * mb_init()
} else {
/* Must be 8-bit. */
enc_unicode = 0;
enc_utf8 = FALSE;
enc_utf8 = false;
}
} else /* Don't know what encoding this is, reject it. */
return e_invarg;
if (enc_dbcs_new != 0) {
enc_unicode = 0;
enc_utf8 = FALSE;
enc_utf8 = false;
}
enc_dbcs = enc_dbcs_new;
has_mbyte = (enc_dbcs != 0 || enc_utf8);
@ -520,7 +520,7 @@ char_u * mb_init()
p = enc_locale();
if (p == NULL || STRCMP(p, p_enc) != 0) {
convert_setup(&vimconv, p_enc, (char_u *)"utf-8");
vimconv.vc_fail = TRUE;
vimconv.vc_fail = true;
}
free(p);
}
@ -580,7 +580,7 @@ char_u * mb_init()
(void)init_chartab();
/* When enc_utf8 is set or reset, (de)allocate ScreenLinesUC[] */
screenalloc(FALSE);
screenalloc(false);
/* When using Unicode, set default for 'fileencodings'. */
if (enc_utf8 && !option_was_set((char_u *)"fencs"))
@ -917,15 +917,15 @@ static int dbcs_ptr2len_len(const char_u *p, int size)
}
/*
* Return TRUE if "c" is in "table[size / sizeof(struct interval)]".
* Return true if "c" is in "table[size / sizeof(struct interval)]".
*/
static int intable(struct interval *table, size_t size, int c)
static bool intable(struct interval *table, size_t size, int c)
{
int mid, bot, top;
/* first quick check for Latin1 etc. characters */
if (c < table[0].first)
return FALSE;
return false;
/* binary search in table */
bot = 0;
@ -937,9 +937,9 @@ static int intable(struct interval *table, size_t size, int c)
else if (table[mid].first > c)
top = mid - 1;
else
return TRUE;
return true;
}
return FALSE;
return false;
}
/*
@ -1496,15 +1496,15 @@ int mb_cptr2char_adv(char_u **pp)
* comes after "p1". For Arabic sometimes "ab" is replaced with "c", which
* behaves like a composing character.
*/
int utf_composinglike(const char_u *p1, const char_u *p2)
bool utf_composinglike(const char_u *p1, const char_u *p2)
{
int c2;
c2 = utf_ptr2char(p2);
if (utf_iscomposing(c2))
return TRUE;
return true;
if (!arabic_maycombine(c2))
return FALSE;
return false;
return arabic_combine(utf_ptr2char(p1), c2);
}
@ -1818,11 +1818,11 @@ int utf_char2bytes(int c, char_u *buf)
}
/*
* Return TRUE if "c" is a composing UTF-8 character. This means it will be
* Return true if "c" is a composing UTF-8 character. This means it will be
* drawn on top of the preceding character.
* Based on code from Markus Kuhn.
*/
int utf_iscomposing(int c)
bool utf_iscomposing(int c)
{
/* Sorted list of non-overlapping intervals.
* Generated by ../runtime/tools/unicode.vim. */
@ -2022,10 +2022,10 @@ int utf_iscomposing(int c)
}
/*
* Return TRUE for characters that can be displayed in a normal way.
* Return true for characters that can be displayed in a normal way.
* Only for characters of 0x100 and above!
*/
int utf_printable(int c)
bool utf_printable(int c)
{
#ifdef USE_WCHAR_FUNCTIONS
/*
@ -2696,7 +2696,7 @@ int utf_toupper(int a)
return utf_convert(a, toUpper, (int)sizeof(toUpper));
}
int utf_islower(int a)
bool utf_islower(int a)
{
/* German sharp s is lower case but has no upper case equivalent. */
return (utf_toupper(a) != a) || a == 0xdf;
@ -2726,7 +2726,7 @@ int utf_tolower(int a)
return utf_convert(a, toLower, (int)sizeof(toLower));
}
int utf_isupper(int a)
bool utf_isupper(int a)
{
return utf_tolower(a) != a;
}
@ -3138,7 +3138,6 @@ theend:
/*
* If the cursor moves on an trail byte, set the cursor on the lead byte.
* Thus it moves left if necessary.
* Return TRUE when the cursor was adjusted.
*/
void mb_adjust_cursor()
{
@ -3264,11 +3263,11 @@ char_u * mb_unescape(char_u **pp)
}
/*
* Return TRUE if the character at "row"/"col" on the screen is the left side
* Return true if the character at "row"/"col" on the screen is the left side
* of a double-width character.
* Caller must make sure "row" and "col" are not invalid!
*/
int mb_lefthalve(int row, int col)
bool mb_lefthalve(int row, int col)
{
return (*mb_off2cells)(LineOffset[row] + col,
LineOffset[row] + screen_Columns) > 1;
@ -3462,20 +3461,20 @@ void * my_iconv_open(char_u *to, char_u *from)
char_u tobuf[ICONV_TESTLEN];
char *p;
size_t tolen;
static int iconv_ok = -1;
static WorkingStatus iconv_working = kUnknown;
if (iconv_ok == FALSE)
if (iconv_working == kBroken)
return (void *)-1; /* detected a broken iconv() previously */
#ifdef DYNAMIC_ICONV
/* Check if the iconv.dll can be found. */
if (!iconv_enabled(TRUE))
if (!iconv_enabled(true))
return (void *)-1;
#endif
fd = iconv_open((char *)enc_skip(to), (char *)enc_skip(from));
if (fd != (iconv_t)-1 && iconv_ok == -1) {
if (fd != (iconv_t)-1 && iconv_working == kUnknown) {
/*
* Do a dummy iconv() call to check if it actually works. There is a
* version of iconv() on Linux that is broken. We can't ignore it,
@ -3487,11 +3486,11 @@ void * my_iconv_open(char_u *to, char_u *from)
tolen = ICONV_TESTLEN;
(void)iconv(fd, NULL, NULL, &p, &tolen);
if (p == NULL) {
iconv_ok = FALSE;
iconv_working = kBroken;
iconv_close(fd);
fd = (iconv_t)-1;
} else
iconv_ok = TRUE;
iconv_working = kWorking;
}
return (void *)fd;
@ -3647,10 +3646,10 @@ static void * get_iconv_import_func(HINSTANCE hInst,
/*
* Try opening the iconv.dll and return TRUE if iconv() can be used.
*/
int iconv_enabled(int verbose)
bool iconv_enabled(bool verbose)
{
if (hIconvDLL != 0 && hMsvcrtDLL != 0)
return TRUE;
return true;
hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL);
if (hIconvDLL == 0) /* sometimes it's called libiconv.dll */
hIconvDLL = vimLoadLib(DYNAMIC_ICONV_DLL_ALT);
@ -3666,7 +3665,7 @@ int iconv_enabled(int verbose)
verbose_leave();
}
iconv_end();
return FALSE;
return false;
}
iconv = (void *)GetProcAddress(hIconvDLL, "libiconv");
@ -3684,9 +3683,9 @@ int iconv_enabled(int verbose)
EMSG2(_(e_loadfunc), "for libiconv");
verbose_leave();
}
return FALSE;
return false;
}
return TRUE;
return true;
}
void iconv_end()
@ -3722,15 +3721,15 @@ void iconv_end()
*/
int convert_setup(vimconv_T *vcp, char_u *from, char_u *to)
{
return convert_setup_ext(vcp, from, TRUE, to, TRUE);
return convert_setup_ext(vcp, from, true, to, true);
}
/*
* As convert_setup(), but only when from_unicode_is_utf8 is TRUE will all
* "from" unicode charsets be considered utf-8. Same for "to".
*/
int convert_setup_ext(vimconv_T *vcp, char_u *from, int from_unicode_is_utf8,
char_u *to, int to_unicode_is_utf8)
int convert_setup_ext(vimconv_T *vcp, char_u *from, bool from_unicode_is_utf8,
char_u *to, bool to_unicode_is_utf8)
{
int from_prop;
int to_prop;
@ -3744,7 +3743,7 @@ int convert_setup_ext(vimconv_T *vcp, char_u *from, int from_unicode_is_utf8,
# endif
vcp->vc_type = CONV_NONE;
vcp->vc_factor = 1;
vcp->vc_fail = FALSE;
vcp->vc_fail = false;
/* No conversion when one of the names is empty or they are equal. */
if (from == NULL || *from == NUL || to == NULL || *to == NUL

View File

@ -264,7 +264,7 @@ int ml_open(buf_T *buf)
buf->b_ml.ml_chunksize = NULL;
if (cmdmod.noswapfile) {
buf->b_p_swf = FALSE;
buf->b_p_swf = false;
}
/*

View File

@ -777,7 +777,7 @@ void wait_return(int redraw)
} else {
/* Make sure the hit-return prompt is on screen when 'guioptions' was
* just changed. */
screenalloc(FALSE);
screenalloc(false);
State = HITRETURN;
setmouse();
@ -2612,7 +2612,7 @@ int verbose_open(void)
* Give a warning message (for searching).
* Use 'w' highlighting and may repeat the message after redrawing
*/
void give_warning(char_u *message, int hl)
void give_warning(char_u *message, bool hl)
{
/* Don't do this for ":silent". */
if (msg_silent != 0)

View File

@ -3273,7 +3273,7 @@ find_decl (
pos_T par_pos;
pos_T found_pos;
int t;
int save_p_ws;
bool save_p_ws;
int save_p_scs;
int retval = OK;
int incll;
@ -3287,7 +3287,7 @@ find_decl (
old_pos = curwin->w_cursor;
save_p_ws = p_ws;
save_p_scs = p_scs;
p_ws = FALSE; /* don't wrap around end of file now */
p_ws = false; /* don't wrap around end of file now */
p_scs = FALSE; /* don't switch ignorecase off now */
/*

View File

@ -5012,7 +5012,7 @@ set_bool_option (
NULL, NULL, TRUE, curbuf);
}
/* when 'swf' is set, create swapfile, when reset remove swapfile */
else if ((int *)varp == &curbuf->b_p_swf) {
else if ((int *)varp == (int *)&curbuf->b_p_swf) {
if (curbuf->b_p_swf && p_uc)
ml_open_file(curbuf); /* create the swap file */
else

View File

@ -623,7 +623,7 @@ EXTERN long p_wh; /* 'winheight' */
EXTERN long p_wmh; /* 'winminheight' */
EXTERN long p_wmw; /* 'winminwidth' */
EXTERN long p_wiw; /* 'winwidth' */
EXTERN int p_ws; /* 'wrapscan' */
EXTERN bool p_ws; /* 'wrapscan' */
EXTERN int p_write; /* 'write' */
EXTERN int p_wa; /* 'writeany' */
EXTERN int p_wb; /* 'writebackup' */

View File

@ -2793,7 +2793,7 @@ void ex_vimgrep(exarg_T *eap)
;
/* parse the list of arguments */
if (get_arglist_exp(p, &fcount, &fnames, TRUE) == FAIL)
if (get_arglist_exp(p, &fcount, &fnames, true) == FAIL)
goto theend;
if (fcount == 0) {
EMSG(_(e_nomatch));

View File

@ -620,7 +620,7 @@ void update_single_line(win_T *wp, linenr_T lnum)
init_search_hl(wp);
start_search_hl();
prepare_search_hl(wp, lnum);
win_line(wp, lnum, row, row + wp->w_lines[j].wl_size, FALSE);
win_line(wp, lnum, row, row + wp->w_lines[j].wl_size, false);
end_search_hl();
break;
}
@ -2176,7 +2176,7 @@ win_line (
linenr_T lnum,
int startrow,
int endrow,
int nochange /* not updating for changed text */
bool nochange /* not updating for changed text */
)
{
int col; /* visual column on screen */
@ -2234,7 +2234,7 @@ win_line (
int eol_hl_off = 0; /* 1 if highlighted char after EOL */
int draw_color_col = FALSE; /* highlight colorcolumn */
int *color_cols = NULL; /* pointer to according columns array */
int has_spell = FALSE; /* this buffer has spell checking */
bool has_spell = false; /* this buffer has spell checking */
# define SPWORDLEN 150
char_u nextline[SPWORDLEN * 2]; /* text with start of the next line */
int nextlinecol = 0; /* column where nextline[] starts */
@ -2338,7 +2338,7 @@ win_line (
&& !GA_EMPTY(&wp->w_s->b_langp)
&& *(char **)(wp->w_s->b_langp.ga_data) != NULL) {
/* Prepare for spell checking. */
has_spell = TRUE;
has_spell = true;
extra_check = TRUE;
/* Get the start of the next line, so that words that wrap to the next
@ -3258,7 +3258,7 @@ win_line (
}
if (extra_check) {
int can_spell = TRUE;
bool can_spell = true;
/* Get syntax attribute, unless still at the start of the line
* (double-wide char that doesn't fit). */
@ -6109,7 +6109,7 @@ int screen_valid(int doclear)
* in ScreenLines[]. Use Rows and Columns for positioning text etc. where the
* final size of the shell is needed.
*/
void screenalloc(int doclear)
void screenalloc(bool doclear)
{
int new_row, old_row;
win_T *wp;
@ -6366,7 +6366,7 @@ void free_screenlines(void)
void screenclear(void)
{
check_for_delay(FALSE);
screenalloc(FALSE); /* allocate screen buffers if size changed */
screenalloc(false); /* allocate screen buffers if size changed */
screenclear2(); /* clear the screen */
}

View File

@ -795,7 +795,7 @@ int searchit(
lnum = 1;
if (!shortmess(SHM_SEARCH) && (options & SEARCH_MSG))
give_warning((char_u *)_(dir == BACKWARD
? top_bot_msg : bot_top_msg), TRUE);
? top_bot_msg : bot_top_msg), true);
}
if (got_int || called_emsg
|| break_loop
@ -1225,7 +1225,7 @@ int search_for_exact_line(buf_T *buf, pos_T *pos, int dir, char_u *pat)
if (p_ws) {
pos->lnum = buf->b_ml.ml_line_count;
if (!shortmess(SHM_SEARCH))
give_warning((char_u *)_(top_bot_msg), TRUE);
give_warning((char_u *)_(top_bot_msg), true);
} else {
pos->lnum = 1;
break;
@ -1234,7 +1234,7 @@ int search_for_exact_line(buf_T *buf, pos_T *pos, int dir, char_u *pat)
if (p_ws) {
pos->lnum = 1;
if (!shortmess(SHM_SEARCH))
give_warning((char_u *)_(bot_top_msg), TRUE);
give_warning((char_u *)_(bot_top_msg), true);
} else {
pos->lnum = 1;
break;
@ -3162,10 +3162,10 @@ current_tagblock (
int len;
int r;
int do_include = include;
int save_p_ws = p_ws;
bool save_p_ws = p_ws;
int retval = FAIL;
p_ws = FALSE;
p_ws = false;
old_pos = curwin->w_cursor;
old_end = curwin->w_cursor; /* remember where we started */
@ -3764,13 +3764,13 @@ current_search (
int i;
int dir;
int result; /* result of various function calls */
char_u old_p_ws = p_ws;
bool old_p_ws = p_ws;
int flags = 0;
pos_T save_VIsual = VIsual;
int one_char;
/* wrapping should not occur */
p_ws = FALSE;
p_ws = false;
/* Correct cursor when 'selection' is exclusive */
if (VIsual_active && *p_sel == 'e' && lt(VIsual, curwin->w_cursor))

File diff suppressed because it is too large Load Diff

View File

@ -1557,7 +1557,7 @@ syn_finish_line (
int
get_syntax_attr (
colnr_T col,
int *can_spell,
bool *can_spell,
int keep_state /* keep state of char at "col" */
)
{
@ -1604,9 +1604,9 @@ get_syntax_attr (
*/
static int
syn_current_attr (
int syncing, /* When 1: called for syncing */
int displaying, /* result will be displayed */
int *can_spell, /* return: do spell checking */
int syncing, /* When 1: called for syncing */
int displaying, /* result will be displayed */
bool *can_spell, /* return: do spell checking */
int keep_state /* keep syntax stack afterwards */
)
{
@ -2069,7 +2069,7 @@ syn_current_attr (
if (syn_block->b_nospell_cluster_id != 0) {
sps.id = syn_block->b_nospell_cluster_id;
if (in_id_list(sip, sip->si_cont_list, &sps, 0))
*can_spell = FALSE;
*can_spell = false;
}
}
}
@ -5527,8 +5527,8 @@ syn_get_id (
win_T *wp,
long lnum,
colnr_T col,
int trans, /* remove transparency */
int *spellp, /* return: can do spell checking */
int trans, /* remove transparency */
bool *spellp, /* return: can do spell checking */
int keep_state /* keep state of char at "col" */
)
{

View File

@ -2325,7 +2325,8 @@ jumpto_tag (
{
int save_secure;
int save_magic;
int save_p_ws, save_p_scs, save_p_ic;
bool save_p_ws;
int save_p_scs, save_p_ic;
linenr_T save_lnum;
int csave = 0;
char_u *str;
@ -2476,7 +2477,7 @@ jumpto_tag (
save_p_ws = p_ws;
save_p_ic = p_ic;
save_p_scs = p_scs;
p_ws = TRUE; /* need 'wrapscan' for backward searches */
p_ws = true; /* need 'wrapscan' for backward searches */
p_ic = FALSE; /* don't ignore case now */
p_scs = FALSE;
save_lnum = curwin->w_cursor.lnum;

View File

@ -2516,7 +2516,7 @@ void set_shellsize(int width, int height, int mustset)
*/
if (State == ASKMORE || State == EXTERNCMD || State == CONFIRM
|| exmode_active) {
screenalloc(FALSE);
screenalloc(false);
repeat_message();
} else {
if (curwin->w_p_scb)

View File

@ -1301,7 +1301,7 @@ void u_read_undo(char_u *name, char_u *hash, char_u *orig_name)
if (name == NULL)
verbose_enter();
give_warning((char_u *)
_("File contents changed, cannot use undo info"), TRUE);
_("File contents changed, cannot use undo info"), true);
if (name == NULL)
verbose_leave();
}