patch 8.1.2395: using old C style comments
Problem: Using old C style comments.
Solution: Use // comments where appropriate.
diff --git a/src/spell.c b/src/spell.c
index 4620907..572f7fb 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -60,17 +60,17 @@
#if defined(FEAT_SPELL) || defined(PROTO)
-#ifndef UNIX /* it's in os_unix.h for Unix */
-# include <time.h> /* for time_t */
+#ifndef UNIX // it's in os_unix.h for Unix
+# include <time.h> // for time_t
#endif
-#define REGION_ALL 0xff /* word valid in all regions */
+#define REGION_ALL 0xff // word valid in all regions
-#define VIMSUGMAGIC "VIMsug" /* string at start of Vim .sug file */
+#define VIMSUGMAGIC "VIMsug" // string at start of Vim .sug file
#define VIMSUGMAGICL 6
#define VIMSUGVERSION 1
-/* Result values. Lower number is accepted over higher one. */
+// Result values. Lower number is accepted over higher one.
#define SP_BANNED -1
#define SP_OK 0
#define SP_RARE 1
@@ -82,52 +82,52 @@
*/
typedef struct matchinf_S
{
- langp_T *mi_lp; /* info for language and region */
+ langp_T *mi_lp; // info for language and region
- /* pointers to original text to be checked */
- char_u *mi_word; /* start of word being checked */
- char_u *mi_end; /* end of matching word so far */
- char_u *mi_fend; /* next char to be added to mi_fword */
- char_u *mi_cend; /* char after what was used for
- mi_capflags */
+ // pointers to original text to be checked
+ char_u *mi_word; // start of word being checked
+ char_u *mi_end; // end of matching word so far
+ char_u *mi_fend; // next char to be added to mi_fword
+ char_u *mi_cend; // char after what was used for
+ // mi_capflags
- /* case-folded text */
- char_u mi_fword[MAXWLEN + 1]; /* mi_word case-folded */
- int mi_fwordlen; /* nr of valid bytes in mi_fword */
+ // case-folded text
+ char_u mi_fword[MAXWLEN + 1]; // mi_word case-folded
+ int mi_fwordlen; // nr of valid bytes in mi_fword
- /* for when checking word after a prefix */
- int mi_prefarridx; /* index in sl_pidxs with list of
- affixID/condition */
- int mi_prefcnt; /* number of entries at mi_prefarridx */
- int mi_prefixlen; /* byte length of prefix */
- int mi_cprefixlen; /* byte length of prefix in original
- case */
+ // for when checking word after a prefix
+ int mi_prefarridx; // index in sl_pidxs with list of
+ // affixID/condition
+ int mi_prefcnt; // number of entries at mi_prefarridx
+ int mi_prefixlen; // byte length of prefix
+ int mi_cprefixlen; // byte length of prefix in original
+ // case
- /* for when checking a compound word */
- int mi_compoff; /* start of following word offset */
- char_u mi_compflags[MAXWLEN]; /* flags for compound words used */
- int mi_complen; /* nr of compound words used */
- int mi_compextra; /* nr of COMPOUNDROOT words */
+ // for when checking a compound word
+ int mi_compoff; // start of following word offset
+ char_u mi_compflags[MAXWLEN]; // flags for compound words used
+ int mi_complen; // nr of compound words used
+ int mi_compextra; // nr of COMPOUNDROOT words
- /* others */
- int mi_result; /* result so far: SP_BAD, SP_OK, etc. */
- int mi_capflags; /* WF_ONECAP WF_ALLCAP WF_KEEPCAP */
- win_T *mi_win; /* buffer being checked */
+ // others
+ int mi_result; // result so far: SP_BAD, SP_OK, etc.
+ int mi_capflags; // WF_ONECAP WF_ALLCAP WF_KEEPCAP
+ win_T *mi_win; // buffer being checked
- /* for NOBREAK */
- int mi_result2; /* "mi_resul" without following word */
- char_u *mi_end2; /* "mi_end" without following word */
+ // for NOBREAK
+ int mi_result2; // "mi_resul" without following word
+ char_u *mi_end2; // "mi_end" without following word
} matchinf_T;
static int spell_mb_isword_class(int cl, win_T *wp);
-/* mode values for find_word */
-#define FIND_FOLDWORD 0 /* find word case-folded */
-#define FIND_KEEPWORD 1 /* find keep-case word */
-#define FIND_PREFIX 2 /* find word after prefix */
-#define FIND_COMPOUND 3 /* find case-folded compound word */
-#define FIND_KEEPCOMPOUND 4 /* find keep-case compound word */
+// mode values for find_word
+#define FIND_FOLDWORD 0 // find word case-folded
+#define FIND_KEEPWORD 1 // find keep-case word
+#define FIND_PREFIX 2 // find word after prefix
+#define FIND_COMPOUND 3 // find case-folded compound word
+#define FIND_KEEPCOMPOUND 4 // find keep-case compound word
static void find_word(matchinf_T *mip, int mode);
static void find_prefix(matchinf_T *mip, int mode);
@@ -160,34 +160,34 @@
*/
int
spell_check(
- win_T *wp, /* current window */
+ win_T *wp, // current window
char_u *ptr,
hlf_T *attrp,
- int *capcol, /* column to check for Capital */
- int docount) /* count good words */
+ int *capcol, // column to check for Capital
+ int docount) // count good words
{
- matchinf_T mi; /* Most things are put in "mi" so that it can
- be passed to functions quickly. */
- int nrlen = 0; /* found a number first */
+ matchinf_T mi; // Most things are put in "mi" so that it can
+ // be passed to functions quickly.
+ int nrlen = 0; // found a number first
int c;
int wrongcaplen = 0;
int lpi;
int count_word = docount;
- /* A word never starts at a space or a control character. Return quickly
- * then, skipping over the character. */
+ // A word never starts at a space or a control character. Return quickly
+ // then, skipping over the character.
if (*ptr <= ' ')
return 1;
- /* Return here when loading language files failed. */
+ // Return here when loading language files failed.
if (wp->w_s->b_langp.ga_len == 0)
return 1;
vim_memset(&mi, 0, sizeof(matchinf_T));
- /* A number is always OK. Also skip hexadecimal numbers 0xFF99 and
- * 0X99FF. But always do check spelling to find "3GPP" and "11
- * julifeest". */
+ // A number is always OK. Also skip hexadecimal numbers 0xFF99 and
+ // 0X99FF. But always do check spelling to find "3GPP" and "11
+ // julifeest".
if (*ptr >= '0' && *ptr <= '9')
{
if (*ptr == '0' && (ptr[1] == 'b' || ptr[1] == 'B'))
@@ -199,7 +199,7 @@
nrlen = (int)(mi.mi_end - ptr);
}
- /* Find the normal end of the word (until the next non-word character). */
+ // Find the normal end of the word (until the next non-word character).
mi.mi_word = ptr;
mi.mi_fend = ptr;
if (spell_iswordp(mi.mi_fend, wp))
@@ -210,7 +210,7 @@
if (capcol != NULL && *capcol == 0 && wp->w_s->b_cap_prog != NULL)
{
- /* Check word starting with capital letter. */
+ // Check word starting with capital letter.
c = PTR2CHAR(ptr);
if (!SPELL_ISUPPER(c))
wrongcaplen = (int)(mi.mi_fend - ptr);
@@ -219,17 +219,17 @@
if (capcol != NULL)
*capcol = -1;
- /* We always use the characters up to the next non-word character,
- * also for bad words. */
+ // We always use the characters up to the next non-word character,
+ // also for bad words.
mi.mi_end = mi.mi_fend;
- /* Check caps type later. */
+ // Check caps type later.
mi.mi_capflags = 0;
mi.mi_cend = NULL;
mi.mi_win = wp;
- /* case-fold the word with one non-word character, so that we can check
- * for the word end. */
+ // case-fold the word with one non-word character, so that we can check
+ // for the word end.
if (*mi.mi_fend != NUL)
MB_PTR_ADV(mi.mi_fend);
@@ -237,7 +237,7 @@
MAXWLEN + 1);
mi.mi_fwordlen = (int)STRLEN(mi.mi_fword);
- /* The word is bad unless we recognize it. */
+ // The word is bad unless we recognize it.
mi.mi_result = SP_BAD;
mi.mi_result2 = SP_BAD;
@@ -250,22 +250,22 @@
{
mi.mi_lp = LANGP_ENTRY(wp->w_s->b_langp, lpi);
- /* If reloading fails the language is still in the list but everything
- * has been cleared. */
+ // If reloading fails the language is still in the list but everything
+ // has been cleared.
if (mi.mi_lp->lp_slang->sl_fidxs == NULL)
continue;
- /* Check for a matching word in case-folded words. */
+ // Check for a matching word in case-folded words.
find_word(&mi, FIND_FOLDWORD);
- /* Check for a matching word in keep-case words. */
+ // Check for a matching word in keep-case words.
find_word(&mi, FIND_KEEPWORD);
- /* Check for matching prefixes. */
+ // Check for matching prefixes.
find_prefix(&mi, FIND_FOLDWORD);
- /* For a NOBREAK language, may want to use a word without a following
- * word as a backup. */
+ // For a NOBREAK language, may want to use a word without a following
+ // word as a backup.
if (mi.mi_lp->lp_slang->sl_nobreak && mi.mi_result == SP_BAD
&& mi.mi_result2 != SP_BAD)
{
@@ -273,7 +273,7 @@
mi.mi_end = mi.mi_end2;
}
- /* Count the word in the first language where it's found to be OK. */
+ // Count the word in the first language where it's found to be OK.
if (count_word && mi.mi_result == SP_OK)
{
count_common_word(mi.mi_lp->lp_slang, ptr,
@@ -284,16 +284,16 @@
if (mi.mi_result != SP_OK)
{
- /* If we found a number skip over it. Allows for "42nd". Do flag
- * rare and local words, e.g., "3GPP". */
+ // If we found a number skip over it. Allows for "42nd". Do flag
+ // rare and local words, e.g., "3GPP".
if (nrlen > 0)
{
if (mi.mi_result == SP_BAD || mi.mi_result == SP_BANNED)
return nrlen;
}
- /* When we are at a non-word character there is no error, just
- * skip over the character (try looking for a word after it). */
+ // When we are at a non-word character there is no error, just
+ // skip over the character (try looking for a word after it).
else if (!spell_iswordp_nmw(ptr, wp))
{
if (capcol != NULL && wp->w_s->b_cap_prog != NULL)
@@ -301,7 +301,7 @@
regmatch_T regmatch;
int r;
- /* Check for end of sentence. */
+ // Check for end of sentence.
regmatch.regprog = wp->w_s->b_cap_prog;
regmatch.rm_ic = FALSE;
r = vim_regexec(®match, ptr, 0);
@@ -315,8 +315,8 @@
return 1;
}
else if (mi.mi_end == ptr)
- /* Always include at least one character. Required for when there
- * is a mixup in "midword". */
+ // Always include at least one character. Required for when there
+ // is a mixup in "midword".
MB_PTR_ADV(mi.mi_end);
else if (mi.mi_result == SP_BAD
&& LANGP_ENTRY(wp->w_s->b_langp, 0)->lp_slang->sl_nobreak)
@@ -324,8 +324,8 @@
char_u *p, *fp;
int save_result = mi.mi_result;
- /* First language in 'spelllang' is NOBREAK. Find first position
- * at which any word would be valid. */
+ // First language in 'spelllang' is NOBREAK. Find first position
+ // at which any word would be valid.
mi.mi_lp = LANGP_ENTRY(wp->w_s->b_langp, 0);
if (mi.mi_lp->lp_slang->sl_fidxs != NULL)
{
@@ -359,7 +359,7 @@
if (wrongcaplen > 0 && (mi.mi_result == SP_OK || mi.mi_result == SP_RARE))
{
- /* Report SpellCap only when the word isn't badly spelled. */
+ // Report SpellCap only when the word isn't badly spelled.
*attrp = HLF_SPC;
return wrongcaplen;
}
@@ -380,8 +380,8 @@
find_word(matchinf_T *mip, int mode)
{
idx_T arridx = 0;
- int endlen[MAXWLEN]; /* length at possible word endings */
- idx_T endidx[MAXWLEN]; /* possible word endings */
+ int endlen[MAXWLEN]; // length at possible word endings
+ idx_T endidx[MAXWLEN]; // possible word endings
int endidxcnt = 0;
int len;
int wlen = 0;
@@ -402,33 +402,33 @@
if (mode == FIND_KEEPWORD || mode == FIND_KEEPCOMPOUND)
{
- /* Check for word with matching case in keep-case tree. */
+ // Check for word with matching case in keep-case tree.
ptr = mip->mi_word;
- flen = 9999; /* no case folding, always enough bytes */
+ flen = 9999; // no case folding, always enough bytes
byts = slang->sl_kbyts;
idxs = slang->sl_kidxs;
if (mode == FIND_KEEPCOMPOUND)
- /* Skip over the previously found word(s). */
+ // Skip over the previously found word(s).
wlen += mip->mi_compoff;
}
else
{
- /* Check for case-folded in case-folded tree. */
+ // Check for case-folded in case-folded tree.
ptr = mip->mi_fword;
- flen = mip->mi_fwordlen; /* available case-folded bytes */
+ flen = mip->mi_fwordlen; // available case-folded bytes
byts = slang->sl_fbyts;
idxs = slang->sl_fidxs;
if (mode == FIND_PREFIX)
{
- /* Skip over the prefix. */
+ // Skip over the prefix.
wlen = mip->mi_prefixlen;
flen -= mip->mi_prefixlen;
}
else if (mode == FIND_COMPOUND)
{
- /* Skip over the previously found word(s). */
+ // Skip over the previously found word(s).
wlen = mip->mi_compoff;
flen -= mip->mi_compoff;
}
@@ -436,7 +436,7 @@
}
if (byts == NULL)
- return; /* array is empty */
+ return; // array is empty
/*
* Repeat advancing in the tree until:
@@ -451,13 +451,13 @@
len = byts[arridx++];
- /* If the first possible byte is a zero the word could end here.
- * Remember this index, we first check for the longest word. */
+ // If the first possible byte is a zero the word could end here.
+ // Remember this index, we first check for the longest word.
if (byts[arridx] == 0)
{
if (endidxcnt == MAXWLEN)
{
- /* Must be a corrupted spell file. */
+ // Must be a corrupted spell file.
emsg(_(e_format));
return;
}
@@ -465,24 +465,24 @@
endidx[endidxcnt++] = arridx++;
--len;
- /* Skip over the zeros, there can be several flag/region
- * combinations. */
+ // Skip over the zeros, there can be several flag/region
+ // combinations.
while (len > 0 && byts[arridx] == 0)
{
++arridx;
--len;
}
if (len == 0)
- break; /* no children, word must end here */
+ break; // no children, word must end here
}
- /* Stop looking at end of the line. */
+ // Stop looking at end of the line.
if (ptr[wlen] == NUL)
break;
- /* Perform a binary search in the list of accepted bytes. */
+ // Perform a binary search in the list of accepted bytes.
c = ptr[wlen];
- if (c == TAB) /* <Tab> is handled like <Space> */
+ if (c == TAB) // <Tab> is handled like <Space>
c = ' ';
lo = arridx;
hi = arridx + len - 1;
@@ -500,17 +500,17 @@
}
}
- /* Stop if there is no matching byte. */
+ // Stop if there is no matching byte.
if (hi < lo || byts[lo] != c)
break;
- /* Continue at the child (if there is one). */
+ // Continue at the child (if there is one).
arridx = idxs[lo];
++wlen;
--flen;
- /* One space in the good word may stand for several spaces in the
- * checked word. */
+ // One space in the good word may stand for several spaces in the
+ // checked word.
if (c == ' ')
{
for (;;)
@@ -536,24 +536,24 @@
wlen = endlen[endidxcnt];
if ((*mb_head_off)(ptr, ptr + wlen) > 0)
- continue; /* not at first byte of character */
+ continue; // not at first byte of character
if (spell_iswordp(ptr + wlen, mip->mi_win))
{
if (slang->sl_compprog == NULL && !slang->sl_nobreak)
- continue; /* next char is a word character */
+ continue; // next char is a word character
word_ends = FALSE;
}
else
word_ends = TRUE;
- /* The prefix flag is before compound flags. Once a valid prefix flag
- * has been found we try compound flags. */
+ // The prefix flag is before compound flags. Once a valid prefix flag
+ // has been found we try compound flags.
prefix_found = FALSE;
if (mode != FIND_KEEPWORD && has_mbyte)
{
- /* Compute byte length in original word, length may change
- * when folding case. This can be slow, take a shortcut when the
- * case-folded word is equal to the keep-case word. */
+ // Compute byte length in original word, length may change
+ // when folding case. This can be slow, take a shortcut when the
+ // case-folded word is equal to the keep-case word.
p = mip->mi_word;
if (STRNCMP(ptr, p, wlen) != 0)
{
@@ -563,26 +563,26 @@
}
}
- /* Check flags and region. For FIND_PREFIX check the condition and
- * prefix ID.
- * Repeat this if there are more flags/region alternatives until there
- * is a match. */
+ // Check flags and region. For FIND_PREFIX check the condition and
+ // prefix ID.
+ // Repeat this if there are more flags/region alternatives until there
+ // is a match.
res = SP_BAD;
for (len = byts[arridx - 1]; len > 0 && byts[arridx] == 0;
--len, ++arridx)
{
flags = idxs[arridx];
- /* For the fold-case tree check that the case of the checked word
- * matches with what the word in the tree requires.
- * For keep-case tree the case is always right. For prefixes we
- * don't bother to check. */
+ // For the fold-case tree check that the case of the checked word
+ // matches with what the word in the tree requires.
+ // For keep-case tree the case is always right. For prefixes we
+ // don't bother to check.
if (mode == FIND_FOLDWORD)
{
if (mip->mi_cend != mip->mi_word + wlen)
{
- /* mi_capflags was set for a different word length, need
- * to do it again. */
+ // mi_capflags was set for a different word length, need
+ // to do it again.
mip->mi_cend = mip->mi_word + wlen;
mip->mi_capflags = captype(mip->mi_word, mip->mi_cend);
}
@@ -592,9 +592,9 @@
continue;
}
- /* When mode is FIND_PREFIX the word must support the prefix:
- * check the prefix ID and the condition. Do that for the list at
- * mip->mi_prefarridx that find_prefix() filled. */
+ // When mode is FIND_PREFIX the word must support the prefix:
+ // check the prefix ID and the condition. Do that for the list at
+ // mip->mi_prefarridx that find_prefix() filled.
else if (mode == FIND_PREFIX && !prefix_found)
{
c = valid_word_prefix(mip->mi_prefcnt, mip->mi_prefarridx,
@@ -604,7 +604,7 @@
if (c == 0)
continue;
- /* Use the WF_RARE flag for a rare prefix. */
+ // Use the WF_RARE flag for a rare prefix.
if (c & WF_RAREPFX)
flags |= WF_RARE;
prefix_found = TRUE;
@@ -615,8 +615,8 @@
if ((mode == FIND_COMPOUND || mode == FIND_KEEPCOMPOUND)
&& (flags & WF_BANNED) == 0)
{
- /* NOBREAK: found a valid following word. That's all we
- * need to know, so return. */
+ // NOBREAK: found a valid following word. That's all we
+ // need to know, so return.
mip->mi_result = SP_OK;
break;
}
@@ -625,45 +625,45 @@
else if ((mode == FIND_COMPOUND || mode == FIND_KEEPCOMPOUND
|| !word_ends))
{
- /* If there is no compound flag or the word is shorter than
- * COMPOUNDMIN reject it quickly.
- * Makes you wonder why someone puts a compound flag on a word
- * that's too short... Myspell compatibility requires this
- * anyway. */
+ // If there is no compound flag or the word is shorter than
+ // COMPOUNDMIN reject it quickly.
+ // Makes you wonder why someone puts a compound flag on a word
+ // that's too short... Myspell compatibility requires this
+ // anyway.
if (((unsigned)flags >> 24) == 0
|| wlen - mip->mi_compoff < slang->sl_compminlen)
continue;
- /* For multi-byte chars check character length against
- * COMPOUNDMIN. */
+ // For multi-byte chars check character length against
+ // COMPOUNDMIN.
if (has_mbyte
&& slang->sl_compminlen > 0
&& mb_charlen_len(mip->mi_word + mip->mi_compoff,
wlen - mip->mi_compoff) < slang->sl_compminlen)
continue;
- /* Limit the number of compound words to COMPOUNDWORDMAX if no
- * maximum for syllables is specified. */
+ // Limit the number of compound words to COMPOUNDWORDMAX if no
+ // maximum for syllables is specified.
if (!word_ends && mip->mi_complen + mip->mi_compextra + 2
> slang->sl_compmax
&& slang->sl_compsylmax == MAXWLEN)
continue;
- /* Don't allow compounding on a side where an affix was added,
- * unless COMPOUNDPERMITFLAG was used. */
+ // Don't allow compounding on a side where an affix was added,
+ // unless COMPOUNDPERMITFLAG was used.
if (mip->mi_complen > 0 && (flags & WF_NOCOMPBEF))
continue;
if (!word_ends && (flags & WF_NOCOMPAFT))
continue;
- /* Quickly check if compounding is possible with this flag. */
+ // Quickly check if compounding is possible with this flag.
if (!byte_in_str(mip->mi_complen == 0
? slang->sl_compstartflags
: slang->sl_compallflags,
((unsigned)flags >> 24)))
continue;
- /* If there is a match with a CHECKCOMPOUNDPATTERN rule
- * discard the compound word. */
+ // If there is a match with a CHECKCOMPOUNDPATTERN rule
+ // discard the compound word.
if (match_checkcompoundpattern(ptr, wlen, &slang->sl_comppat))
continue;
@@ -671,12 +671,12 @@
{
int capflags;
- /* Need to check the caps type of the appended compound
- * word. */
+ // Need to check the caps type of the appended compound
+ // word.
if (has_mbyte && STRNCMP(ptr, mip->mi_word,
mip->mi_compoff) != 0)
{
- /* case folding may have changed the length */
+ // case folding may have changed the length
p = mip->mi_word;
for (s = ptr; s < ptr + mip->mi_compoff; MB_PTR_ADV(s))
MB_PTR_ADV(p);
@@ -690,10 +690,10 @@
if (capflags != WF_ALLCAP)
{
- /* When the character before the word is a word
- * character we do not accept a Onecap word. We do
- * accept a no-caps word, even when the dictionary
- * word specifies ONECAP. */
+ // When the character before the word is a word
+ // character we do not accept a Onecap word. We do
+ // accept a no-caps word, even when the dictionary
+ // word specifies ONECAP.
MB_PTR_BACK(mip->mi_word, p);
if (spell_iswordp_nmw(p, mip->mi_win)
? capflags == WF_ONECAP
@@ -703,9 +703,9 @@
}
}
- /* If the word ends the sequence of compound flags of the
- * words must match with one of the COMPOUNDRULE items and
- * the number of syllables must not be too large. */
+ // If the word ends the sequence of compound flags of the
+ // words must match with one of the COMPOUNDRULE items and
+ // the number of syllables must not be too large.
mip->mi_compflags[mip->mi_complen] = ((unsigned)flags >> 24);
mip->mi_compflags[mip->mi_complen + 1] = NUL;
if (word_ends)
@@ -714,7 +714,7 @@
if (slang->sl_compsylmax < MAXWLEN)
{
- /* "fword" is only needed for checking syllables. */
+ // "fword" is only needed for checking syllables.
if (ptr == mip->mi_word)
(void)spell_casefold(ptr, wlen, fword, MAXWLEN);
else
@@ -725,12 +725,12 @@
}
else if (slang->sl_comprules != NULL
&& !match_compoundrule(slang, mip->mi_compflags))
- /* The compound flags collected so far do not match any
- * COMPOUNDRULE, discard the compounded word. */
+ // The compound flags collected so far do not match any
+ // COMPOUNDRULE, discard the compounded word.
continue;
}
- /* Check NEEDCOMPOUND: can't use word without compounding. */
+ // Check NEEDCOMPOUND: can't use word without compounding.
else if (flags & WF_NEEDCOMP)
continue;
@@ -743,22 +743,22 @@
langp_T *save_lp = mip->mi_lp;
int lpi;
- /* Check that a valid word follows. If there is one and we
- * are compounding, it will set "mi_result", thus we are
- * always finished here. For NOBREAK we only check that a
- * valid word follows.
- * Recursive! */
+ // Check that a valid word follows. If there is one and we
+ // are compounding, it will set "mi_result", thus we are
+ // always finished here. For NOBREAK we only check that a
+ // valid word follows.
+ // Recursive!
if (slang->sl_nobreak)
mip->mi_result = SP_BAD;
- /* Find following word in case-folded tree. */
+ // Find following word in case-folded tree.
mip->mi_compoff = endlen[endidxcnt];
if (has_mbyte && mode == FIND_KEEPWORD)
{
- /* Compute byte length in case-folded word from "wlen":
- * byte length in keep-case word. Length may change when
- * folding case. This can be slow, take a shortcut when
- * the case-folded word is equal to the keep-case word. */
+ // Compute byte length in case-folded word from "wlen":
+ // byte length in keep-case word. Length may change when
+ // folding case. This can be slow, take a shortcut when
+ // the case-folded word is equal to the keep-case word.
p = mip->mi_fword;
if (STRNCMP(ptr, p, wlen) != 0)
{
@@ -767,15 +767,15 @@
mip->mi_compoff = (int)(p - mip->mi_fword);
}
}
-#if 0 /* Disabled, see below */
+#if 0 // Disabled, see below
c = mip->mi_compoff;
#endif
++mip->mi_complen;
if (flags & WF_COMPROOT)
++mip->mi_compextra;
- /* For NOBREAK we need to try all NOBREAK languages, at least
- * to find the ".add" file(s). */
+ // For NOBREAK we need to try all NOBREAK languages, at least
+ // to find the ".add" file(s).
for (lpi = 0; lpi < mip->mi_win->w_s->b_langp.ga_len; ++lpi)
{
if (slang->sl_nobreak)
@@ -788,21 +788,21 @@
find_word(mip, FIND_COMPOUND);
- /* When NOBREAK any word that matches is OK. Otherwise we
- * need to find the longest match, thus try with keep-case
- * and prefix too. */
+ // When NOBREAK any word that matches is OK. Otherwise we
+ // need to find the longest match, thus try with keep-case
+ // and prefix too.
if (!slang->sl_nobreak || mip->mi_result == SP_BAD)
{
- /* Find following word in keep-case tree. */
+ // Find following word in keep-case tree.
mip->mi_compoff = wlen;
find_word(mip, FIND_KEEPCOMPOUND);
-#if 0 /* Disabled, a prefix must not appear halfway a compound word,
- unless the COMPOUNDPERMITFLAG is used and then it can't be a
- postponed prefix. */
+#if 0 // Disabled, a prefix must not appear halfway a compound word,
+ // unless the COMPOUNDPERMITFLAG is used and then it can't be a
+ // postponed prefix.
if (!slang->sl_nobreak || mip->mi_result == SP_BAD)
{
- /* Check for following word with prefix. */
+ // Check for following word with prefix.
mip->mi_compoff = c;
find_prefix(mip, FIND_COMPOUND);
}
@@ -835,7 +835,7 @@
res = SP_BANNED;
else if (flags & WF_REGION)
{
- /* Check region. */
+ // Check region.
if ((mip->mi_lp->lp_region & (flags >> 16)) != 0)
res = SP_OK;
else
@@ -846,9 +846,9 @@
else
res = SP_OK;
- /* Always use the longest match and the best result. For NOBREAK
- * we separately keep the longest match without a following good
- * word as a fall-back. */
+ // Always use the longest match and the best result. For NOBREAK
+ // we separately keep the longest match without a following good
+ // word as a fall-back.
if (nobreak_result == SP_BAD)
{
if (mip->mi_result2 > res)
@@ -888,7 +888,7 @@
match_checkcompoundpattern(
char_u *ptr,
int wlen,
- garray_T *gap) /* &sl_comppat */
+ garray_T *gap) // &sl_comppat
{
int i;
char_u *p;
@@ -899,8 +899,8 @@
p = ((char_u **)gap->ga_data)[i + 1];
if (STRNCMP(ptr + wlen, p, STRLEN(p)) == 0)
{
- /* Second part matches at start of following compound word, now
- * check if first part matches at end of previous word. */
+ // Second part matches at start of following compound word, now
+ // check if first part matches at end of previous word.
p = ((char_u **)gap->ga_data)[i];
len = (int)STRLEN(p);
if (len <= wlen && STRNCMP(ptr + wlen - len, p, len) == 0)
@@ -925,7 +925,7 @@
return FALSE;
if (enc_utf8)
{
- /* Need to convert the single byte flags to utf8 characters. */
+ // Need to convert the single byte flags to utf8 characters.
p = uflags;
for (i = 0; flags[i] != NUL; ++i)
p += utf_char2bytes(flags[i], p);
@@ -937,9 +937,9 @@
if (!vim_regexec_prog(&slang->sl_compprog, FALSE, p, 0))
return FALSE;
- /* Count the number of syllables. This may be slow, do it last. If there
- * are too many syllables AND the number of compound words is above
- * COMPOUNDWORDMAX then compounding is not allowed. */
+ // Count the number of syllables. This may be slow, do it last. If there
+ // are too many syllables AND the number of compound words is above
+ // COMPOUNDWORDMAX then compounding is not allowed.
if (slang->sl_compsylmax < MAXWLEN
&& count_syllables(slang, word) > slang->sl_compsylmax)
return (int)STRLEN(flags) < slang->sl_compmax;
@@ -959,44 +959,44 @@
int i;
int c;
- /* loop over all the COMPOUNDRULE entries */
+ // loop over all the COMPOUNDRULE entries
for (p = slang->sl_comprules; *p != NUL; ++p)
{
- /* loop over the flags in the compound word we have made, match
- * them against the current rule entry */
+ // loop over the flags in the compound word we have made, match
+ // them against the current rule entry
for (i = 0; ; ++i)
{
c = compflags[i];
if (c == NUL)
- /* found a rule that matches for the flags we have so far */
+ // found a rule that matches for the flags we have so far
return TRUE;
if (*p == '/' || *p == NUL)
- break; /* end of rule, it's too short */
+ break; // end of rule, it's too short
if (*p == '[')
{
int match = FALSE;
- /* compare against all the flags in [] */
+ // compare against all the flags in []
++p;
while (*p != ']' && *p != NUL)
if (*p++ == c)
match = TRUE;
if (!match)
- break; /* none matches */
+ break; // none matches
}
else if (*p != c)
- break; /* flag of word doesn't match flag in pattern */
+ break; // flag of word doesn't match flag in pattern
++p;
}
- /* Skip to the next "/", where the next pattern starts. */
+ // Skip to the next "/", where the next pattern starts.
p = vim_strchr(p, '/');
if (p == NULL)
break;
}
- /* Checked all the rules and none of them match the flags, so there
- * can't possibly be a compound starting with these flags. */
+ // Checked all the rules and none of them match the flags, so there
+ // can't possibly be a compound starting with these flags.
return FALSE;
}
@@ -1007,12 +1007,12 @@
*/
int
valid_word_prefix(
- int totprefcnt, /* nr of prefix IDs */
- int arridx, /* idx in sl_pidxs[] */
+ int totprefcnt, // nr of prefix IDs
+ int arridx, // idx in sl_pidxs[]
int flags,
char_u *word,
slang_T *slang,
- int cond_req) /* only use prefixes with a condition */
+ int cond_req) // only use prefixes with a condition
{
int prefcnt;
int pidx;
@@ -1024,17 +1024,17 @@
{
pidx = slang->sl_pidxs[arridx + prefcnt];
- /* Check the prefix ID. */
+ // Check the prefix ID.
if (prefid != (pidx & 0xff))
continue;
- /* Check if the prefix doesn't combine and the word already has a
- * suffix. */
+ // Check if the prefix doesn't combine and the word already has a
+ // suffix.
if ((flags & WF_HAS_AFF) && (pidx & WF_PFX_NC))
continue;
- /* Check the condition, if there is one. The condition index is
- * stored in the two bytes above the prefix ID byte. */
+ // Check the condition, if there is one. The condition index is
+ // stored in the two bytes above the prefix ID byte.
rp = &slang->sl_prefprog[((unsigned)pidx >> 8) & 0xffff];
if (*rp != NULL)
{
@@ -1044,7 +1044,7 @@
else if (cond_req)
continue;
- /* It's a match! Return the WF_ flags. */
+ // It's a match! Return the WF_ flags.
return pidx;
}
return 0;
@@ -1075,15 +1075,15 @@
byts = slang->sl_pbyts;
if (byts == NULL)
- return; /* array is empty */
+ return; // array is empty
- /* We use the case-folded word here, since prefixes are always
- * case-folded. */
+ // We use the case-folded word here, since prefixes are always
+ // case-folded.
ptr = mip->mi_fword;
- flen = mip->mi_fwordlen; /* available case-folded bytes */
+ flen = mip->mi_fwordlen; // available case-folded bytes
if (mode == FIND_COMPOUND)
{
- /* Skip over the previously found word(s). */
+ // Skip over the previously found word(s).
ptr += mip->mi_compoff;
flen -= mip->mi_compoff;
}
@@ -1102,14 +1102,14 @@
len = byts[arridx++];
- /* If the first possible byte is a zero the prefix could end here.
- * Check if the following word matches and supports the prefix. */
+ // If the first possible byte is a zero the prefix could end here.
+ // Check if the following word matches and supports the prefix.
if (byts[arridx] == 0)
{
- /* There can be several prefixes with different conditions. We
- * try them all, since we don't know which one will give the
- * longest match. The word is the same each time, pass the list
- * of possible prefixes to find_word(). */
+ // There can be several prefixes with different conditions. We
+ // try them all, since we don't know which one will give the
+ // longest match. The word is the same each time, pass the list
+ // of possible prefixes to find_word().
mip->mi_prefarridx = arridx;
mip->mi_prefcnt = len;
while (len > 0 && byts[arridx] == 0)
@@ -1119,15 +1119,15 @@
}
mip->mi_prefcnt -= len;
- /* Find the word that comes after the prefix. */
+ // Find the word that comes after the prefix.
mip->mi_prefixlen = wlen;
if (mode == FIND_COMPOUND)
- /* Skip over the previously found word(s). */
+ // Skip over the previously found word(s).
mip->mi_prefixlen += mip->mi_compoff;
if (has_mbyte)
{
- /* Case-folded length may differ from original length. */
+ // Case-folded length may differ from original length.
mip->mi_cprefixlen = nofold_len(mip->mi_fword,
mip->mi_prefixlen, mip->mi_word);
}
@@ -1137,14 +1137,14 @@
if (len == 0)
- break; /* no children, word must end here */
+ break; // no children, word must end here
}
- /* Stop looking at end of the line. */
+ // Stop looking at end of the line.
if (ptr[wlen] == NUL)
break;
- /* Perform a binary search in the list of accepted bytes. */
+ // Perform a binary search in the list of accepted bytes.
c = ptr[wlen];
lo = arridx;
hi = arridx + len - 1;
@@ -1162,11 +1162,11 @@
}
}
- /* Stop if there is no matching byte. */
+ // Stop if there is no matching byte.
if (hi < lo || byts[lo] != c)
break;
- /* Continue at the child (if there is one). */
+ // Continue at the child (if there is one).
arridx = idxs[lo];
++wlen;
--flen;
@@ -1189,7 +1189,7 @@
MB_PTR_ADV(mip->mi_fend);
while (*mip->mi_fend != NUL && spell_iswordp(mip->mi_fend, mip->mi_win));
- /* Include the non-word character so that we can check for the word end. */
+ // Include the non-word character so that we can check for the word end.
if (*mip->mi_fend != NUL)
MB_PTR_ADV(mip->mi_fend);
@@ -1207,8 +1207,8 @@
*/
int
spell_valid_case(
- int wordflags, /* flags for the checked word. */
- int treeflags) /* flags for the word in the spell tree */
+ int wordflags, // flags for the checked word.
+ int treeflags) // flags for the word in the spell tree
{
return ((wordflags == WF_ALLCAP && (treeflags & WF_FIXCAP) == 0)
|| ((treeflags & (WF_ALLCAP | WF_KEEPCAP)) == 0
@@ -1242,11 +1242,11 @@
int
spell_move_to(
win_T *wp,
- int dir, /* FORWARD or BACKWARD */
- int allwords, /* TRUE for "[s"/"]s", FALSE for "[S"/"]S" */
+ int dir, // FORWARD or BACKWARD
+ int allwords, // TRUE for "[s"/"]s", FALSE for "[S"/"]S"
int curline,
- hlf_T *attrp) /* return: attributes of bad word or NULL
- (only when "dir" is FORWARD) */
+ hlf_T *attrp) // return: attributes of bad word or NULL
+ // (only when "dir" is FORWARD)
{
linenr_T lnum;
pos_T found_pos;
@@ -1299,27 +1299,27 @@
break;
}
- /* In first line check first word for Capital. */
+ // In first line check first word for Capital.
if (lnum == 1)
capcol = 0;
- /* For checking first word with a capital skip white space. */
+ // For checking first word with a capital skip white space.
if (capcol == 0)
capcol = getwhitecols(line);
else if (curline && wp == curwin)
{
- /* For spellbadword(): check if first word needs a capital. */
+ // For spellbadword(): check if first word needs a capital.
col = getwhitecols(line);
if (check_need_cap(lnum, col))
capcol = col;
- /* Need to get the line again, may have looked at the previous
- * one. */
+ // Need to get the line again, may have looked at the previous
+ // one.
line = ml_get_buf(wp->w_buffer, lnum, FALSE);
}
- /* Copy the line into "buf" and append the start of the next line if
- * possible. */
+ // Copy the line into "buf" and append the start of the next line if
+ // possible.
STRCPY(buf, line);
if (lnum < wp->w_buffer->b_ml.ml_line_count)
spell_cat_line(buf + STRLEN(buf),
@@ -1329,25 +1329,25 @@
endp = buf + len;
while (p < endp)
{
- /* When searching backward don't search after the cursor. Unless
- * we wrapped around the end of the buffer. */
+ // When searching backward don't search after the cursor. Unless
+ // we wrapped around the end of the buffer.
if (dir == BACKWARD
&& lnum == wp->w_cursor.lnum
&& !wrapped
&& (colnr_T)(p - buf) >= wp->w_cursor.col)
break;
- /* start of word */
+ // start of word
attr = HLF_COUNT;
len = spell_check(wp, p, &attr, &capcol, FALSE);
if (attr != HLF_COUNT)
{
- /* We found a bad word. Check the attribute. */
+ // We found a bad word. Check the attribute.
if (allwords || attr == HLF_SPB)
{
- /* When searching forward only accept a bad word after
- * the cursor. */
+ // When searching forward only accept a bad word after
+ // the cursor.
if (dir == BACKWARD
|| lnum != wp->w_cursor.lnum
|| (lnum == wp->w_cursor.lnum
@@ -1377,7 +1377,7 @@
found_pos.coladd = 0;
if (dir == FORWARD)
{
- /* No need to search further. */
+ // No need to search further.
wp->w_cursor = found_pos;
vim_free(buf);
if (attrp != NULL)
@@ -1385,8 +1385,8 @@
return len;
}
else if (curline)
- /* Insert mode completion: put cursor after
- * the bad word. */
+ // Insert mode completion: put cursor after
+ // the bad word.
found_pos.col += len;
found_len = len;
}
@@ -1396,38 +1396,38 @@
}
}
- /* advance to character after the word */
+ // advance to character after the word
p += len;
capcol -= len;
}
if (dir == BACKWARD && found_pos.lnum != 0)
{
- /* Use the last match in the line (before the cursor). */
+ // Use the last match in the line (before the cursor).
wp->w_cursor = found_pos;
vim_free(buf);
return found_len;
}
if (curline)
- break; /* only check cursor line */
+ break; // only check cursor line
- /* If we are back at the starting line and searched it again there
- * is no match, give up. */
+ // If we are back at the starting line and searched it again there
+ // is no match, give up.
if (lnum == wp->w_cursor.lnum && wrapped)
break;
- /* Advance to next line. */
+ // Advance to next line.
if (dir == BACKWARD)
{
if (lnum > 1)
--lnum;
else if (!p_ws)
- break; /* at first line and 'nowrapscan' */
+ break; // at first line and 'nowrapscan'
else
{
- /* Wrap around to the end of the buffer. May search the
- * starting line again and accept the last match. */
+ // Wrap around to the end of the buffer. May search the
+ // starting line again and accept the last match.
lnum = wp->w_buffer->b_ml.ml_line_count;
wrapped = TRUE;
if (!shortmess(SHM_SEARCH))
@@ -1440,33 +1440,33 @@
if (lnum < wp->w_buffer->b_ml.ml_line_count)
++lnum;
else if (!p_ws)
- break; /* at first line and 'nowrapscan' */
+ break; // at first line and 'nowrapscan'
else
{
- /* Wrap around to the start of the buffer. May search the
- * starting line again and accept the first match. */
+ // Wrap around to the start of the buffer. May search the
+ // starting line again and accept the first match.
lnum = 1;
wrapped = TRUE;
if (!shortmess(SHM_SEARCH))
give_warning((char_u *)_(bot_top_msg), TRUE);
}
- /* If we are back at the starting line and there is no match then
- * give up. */
+ // If we are back at the starting line and there is no match then
+ // give up.
if (lnum == wp->w_cursor.lnum && !found_one)
break;
- /* Skip the characters at the start of the next line that were
- * included in a match crossing line boundaries. */
+ // Skip the characters at the start of the next line that were
+ // included in a match crossing line boundaries.
if (attr == HLF_COUNT)
skip = (int)(p - endp);
else
skip = 0;
- /* Capcol skips over the inserted space. */
+ // Capcol skips over the inserted space.
--capcol;
- /* But after empty line check first word in next line */
+ // But after empty line check first word in next line
if (*skipwhite(line) == NUL)
capcol = 0;
}
@@ -1496,8 +1496,8 @@
if (*p != NUL)
{
- /* Only worth concatenating if there is something else than spaces to
- * concatenate. */
+ // Only worth concatenating if there is something else than spaces to
+ // concatenate.
n = (int)(p - line) + 1;
if (n < maxlen - 1)
{
@@ -1512,9 +1512,9 @@
*/
typedef struct spelload_S
{
- char_u sl_lang[MAXWLEN + 1]; /* language name */
- slang_T *sl_slang; /* resulting slang_T struct */
- int sl_nobreak; /* NOBREAK language found */
+ char_u sl_lang[MAXWLEN + 1]; // language name
+ slang_T *sl_slang; // resulting slang_T struct
+ int sl_nobreak; // NOBREAK language found
} spelload_T;
/*
@@ -1529,14 +1529,14 @@
spelload_T sl;
int round;
- /* Copy the language name to pass it to spell_load_cb() as a cookie.
- * It's truncated when an error is detected. */
+ // Copy the language name to pass it to spell_load_cb() as a cookie.
+ // It's truncated when an error is detected.
STRCPY(sl.sl_lang, lang);
sl.sl_slang = NULL;
sl.sl_nobreak = FALSE;
- /* We may retry when no spell file is found for the language, an
- * autocommand may load it then. */
+ // We may retry when no spell file is found for the language, an
+ // autocommand may load it then.
for (round = 1; round <= 2; ++round)
{
/*
@@ -1553,7 +1553,7 @@
if (r == FAIL && *sl.sl_lang != NUL)
{
- /* Try loading the ASCII version. */
+ // Try loading the ASCII version.
vim_snprintf((char *)fname_enc, sizeof(fname_enc) - 5,
#ifdef VMS
"spell/%s_ascii.spl",
@@ -1584,7 +1584,7 @@
}
else if (sl.sl_slang != NULL)
{
- /* At least one file was loaded, now load ALL the additions. */
+ // At least one file was loaded, now load ALL the additions.
STRCPY(fname_enc + STRLEN(fname_enc) - 3, "add.spl");
do_in_runtimepath(fname_enc, DIP_ALL, spell_load_cb, &sl);
}
@@ -1685,19 +1685,19 @@
gap = &lp->sl_sal;
if (lp->sl_sofo)
{
- /* "ga_len" is set to 1 without adding an item for latin1 */
+ // "ga_len" is set to 1 without adding an item for latin1
if (gap->ga_data != NULL)
- /* SOFOFROM and SOFOTO items: free lists of wide characters. */
+ // SOFOFROM and SOFOTO items: free lists of wide characters.
for (i = 0; i < gap->ga_len; ++i)
vim_free(((int **)gap->ga_data)[i]);
}
else
- /* SAL items: free salitem_T items */
+ // SAL items: free salitem_T items
while (gap->ga_len > 0)
{
smp = &((salitem_T *)gap->ga_data)[--gap->ga_len];
vim_free(smp->sm_lead);
- /* Don't free sm_oneof and sm_rules, they point into sm_lead. */
+ // Don't free sm_oneof and sm_rules, they point into sm_lead.
vim_free(smp->sm_to);
vim_free(smp->sm_lead_w);
vim_free(smp->sm_oneof_w);
@@ -1730,7 +1730,7 @@
hash_clear_all(&lp->sl_map_hash, 0);
- /* Clear info from .sug file. */
+ // Clear info from .sug file.
slang_clear_sug(lp);
lp->sl_compmax = MAXWLEN;
@@ -1766,8 +1766,8 @@
slang = spell_load_file(fname, slp->sl_lang, NULL, FALSE);
if (slang != NULL)
{
- /* When a previously loaded file has NOBREAK also use it for the
- * ".add" files. */
+ // When a previously loaded file has NOBREAK also use it for the
+ // ".add" files.
if (slp->sl_nobreak && slang->sl_add)
slang->sl_nobreak = TRUE;
else if (slang->sl_nobreak)
@@ -1786,8 +1786,8 @@
count_common_word(
slang_T *lp,
char_u *word,
- int len, /* word length, -1 for upto NUL */
- int count) /* 1 to count once, 10 to init */
+ int len, // word length, -1 for upto NUL
+ int count) // 1 to count once, 10 to init
{
hash_T hash;
hashitem_T *hi;
@@ -1819,7 +1819,7 @@
else
{
wc = HI2WC(hi);
- if ((wc->wc_count += count) < (unsigned)count) /* check for overflow */
+ if ((wc->wc_count += count) < (unsigned)count) // check for overflow
wc->wc_count = MAXWORDCOUNT;
}
}
@@ -1842,7 +1842,7 @@
#define SY_MAXLEN 30
typedef struct syl_item_S
{
- char_u sy_chars[SY_MAXLEN]; /* the sequence of chars */
+ char_u sy_chars[SY_MAXLEN]; // the sequence of chars
int sy_len;
} syl_item_T;
@@ -1863,7 +1863,7 @@
while (p != NULL)
{
*p++ = NUL;
- if (*p == NUL) /* trailing slash */
+ if (*p == NUL) // trailing slash
break;
s = p;
p = vim_strchr(p, '/');
@@ -1904,7 +1904,7 @@
for (p = word; *p != NUL; p += len)
{
- /* When running into a space reset counter. */
+ // When running into a space reset counter.
if (*p == ' ')
{
len = 1;
@@ -1912,7 +1912,7 @@
continue;
}
- /* Find longest match of syllable items. */
+ // Find longest match of syllable items.
len = 0;
for (i = 0; i < slang->sl_syl_items.ga_len; ++i)
{
@@ -1921,22 +1921,22 @@
&& STRNCMP(p, syl->sy_chars, syl->sy_len) == 0)
len = syl->sy_len;
}
- if (len != 0) /* found a match, count syllable */
+ if (len != 0) // found a match, count syllable
{
++cnt;
skip = FALSE;
}
else
{
- /* No recognized syllable item, at least a syllable char then? */
+ // No recognized syllable item, at least a syllable char then?
c = mb_ptr2char(p);
len = (*mb_ptr2len)(p);
if (vim_strchr(slang->sl_syllable, c) == NULL)
- skip = FALSE; /* No, search for next syllable */
+ skip = FALSE; // No, search for next syllable
else if (!skip)
{
- ++cnt; /* Yes, count it */
- skip = TRUE; /* don't count following syllable chars */
+ ++cnt; // Yes, count it
+ skip = TRUE; // don't count following syllable chars
}
}
}
@@ -1976,9 +1976,9 @@
set_bufref(&bufref, wp->w_buffer);
- /* We don't want to do this recursively. May happen when a language is
- * not available and the SpellFileMissing autocommand opens a new buffer
- * in which 'spell' is set. */
+ // We don't want to do this recursively. May happen when a language is
+ // not available and the SpellFileMissing autocommand opens a new buffer
+ // in which 'spell' is set.
if (recursive)
return NULL;
recursive = TRUE;
@@ -1986,15 +1986,15 @@
ga_init2(&ga, sizeof(langp_T), 2);
clear_midword(wp);
- /* Make a copy of 'spelllang', the SpellFileMissing autocommands may change
- * it under our fingers. */
+ // Make a copy of 'spelllang', the SpellFileMissing autocommands may change
+ // it under our fingers.
spl_copy = vim_strsave(wp->w_s->b_p_spl);
if (spl_copy == NULL)
goto theend;
wp->w_s->b_cjk = 0;
- /* Loop over comma separated language names. */
+ // Loop over comma separated language names.
for (splp = spl_copy; *splp != NUL; )
{
// Get one language name.
@@ -2011,14 +2011,14 @@
continue;
}
- /* If the name ends in ".spl" use it as the name of the spell file.
- * If there is a region name let "region" point to it and remove it
- * from the name. */
+ // If the name ends in ".spl" use it as the name of the spell file.
+ // If there is a region name let "region" point to it and remove it
+ // from the name.
if (len > 4 && fnamecmp(lang + len - 4, ".spl") == 0)
{
filename = TRUE;
- /* Locate a region and remove it from the file name. */
+ // Locate a region and remove it from the file name.
p = vim_strchr(gettail(lang), '_');
if (p != NULL && ASCII_ISALPHA(p[1]) && ASCII_ISALPHA(p[2])
&& !ASCII_ISALPHA(p[3]))
@@ -2030,7 +2030,7 @@
else
dont_use_region = TRUE;
- /* Check if we loaded this language before. */
+ // Check if we loaded this language before.
for (slang = first_lang; slang != NULL; slang = slang->sl_next)
if (fullpathcmp(lang, slang->sl_fname, FALSE, TRUE) == FPC_SAME)
break;
@@ -2047,7 +2047,7 @@
else
dont_use_region = TRUE;
- /* Check if we loaded this language before. */
+ // Check if we loaded this language before.
for (slang = first_lang; slang != NULL; slang = slang->sl_next)
if (STRICMP(lang, slang->sl_name) == 0)
break;
@@ -2055,14 +2055,14 @@
if (region != NULL)
{
- /* If the region differs from what was used before then don't
- * use it for 'spellfile'. */
+ // If the region differs from what was used before then don't
+ // use it for 'spellfile'.
if (use_region != NULL && STRCMP(region, use_region) != 0)
dont_use_region = TRUE;
use_region = region;
}
- /* If not found try loading the language now. */
+ // If not found try loading the language now.
if (slang == NULL)
{
if (filename)
@@ -2070,8 +2070,8 @@
else
{
spell_load_lang(lang);
- /* SpellFileMissing autocommands may do anything, including
- * destroying the buffer we are using... */
+ // SpellFileMissing autocommands may do anything, including
+ // destroying the buffer we are using...
if (!bufref_valid(&bufref))
{
ret_msg = N_("E797: SpellFileMissing autocommand deleted buffer");
@@ -2091,19 +2091,19 @@
region_mask = REGION_ALL;
if (!filename && region != NULL)
{
- /* find region in sl_regions */
+ // find region in sl_regions
c = find_region(slang->sl_regions, region);
if (c == REGION_ALL)
{
if (slang->sl_add)
{
if (*slang->sl_regions != NUL)
- /* This addition file is for other regions. */
+ // This addition file is for other regions.
region_mask = 0;
}
else
- /* This is probably an error. Give a warning and
- * accept the words anyway. */
+ // This is probably an error. Give a warning and
+ // accept the words anyway.
smsg(_("Warning: region %s not supported"),
region);
}
@@ -2129,27 +2129,27 @@
}
}
- /* round 0: load int_wordlist, if possible.
- * round 1: load first name in 'spellfile'.
- * round 2: load second name in 'spellfile.
- * etc. */
+ // round 0: load int_wordlist, if possible.
+ // round 1: load first name in 'spellfile'.
+ // round 2: load second name in 'spellfile.
+ // etc.
spf = curwin->w_s->b_p_spf;
for (round = 0; round == 0 || *spf != NUL; ++round)
{
if (round == 0)
{
- /* Internal wordlist, if there is one. */
+ // Internal wordlist, if there is one.
if (int_wordlist == NULL)
continue;
int_wordlist_spl(spf_name);
}
else
{
- /* One entry in 'spellfile'. */
+ // One entry in 'spellfile'.
copy_option_part(&spf, spf_name, MAXPATHL - 5, ",");
STRCAT(spf_name, ".spl");
- /* If it was already found above then skip it. */
+ // If it was already found above then skip it.
for (c = 0; c < ga.ga_len; ++c)
{
p = LANGP_ENTRY(ga, c)->lp_slang->sl_fname;
@@ -2161,16 +2161,16 @@
continue;
}
- /* Check if it was loaded already. */
+ // Check if it was loaded already.
for (slang = first_lang; slang != NULL; slang = slang->sl_next)
if (fullpathcmp(spf_name, slang->sl_fname, FALSE, TRUE)
== FPC_SAME)
break;
if (slang == NULL)
{
- /* Not loaded, try loading it now. The language name includes the
- * region name, the region is ignored otherwise. for int_wordlist
- * use an arbitrary name. */
+ // Not loaded, try loading it now. The language name includes the
+ // region name, the region is ignored otherwise. for int_wordlist
+ // use an arbitrary name.
if (round == 0)
STRCPY(lang, "internal wordlist");
else
@@ -2178,12 +2178,12 @@
vim_strncpy(lang, gettail(spf_name), MAXWLEN);
p = vim_strchr(lang, '.');
if (p != NULL)
- *p = NUL; /* truncate at ".encoding.add" */
+ *p = NUL; // truncate at ".encoding.add"
}
slang = spell_load_file(spf_name, lang, NULL, TRUE);
- /* If one of the languages has NOBREAK we assume the addition
- * files also have this. */
+ // If one of the languages has NOBREAK we assume the addition
+ // files also have this.
if (slang != NULL && nobreak)
slang->sl_nobreak = TRUE;
}
@@ -2192,12 +2192,12 @@
region_mask = REGION_ALL;
if (use_region != NULL && !dont_use_region)
{
- /* find region in sl_regions */
+ // find region in sl_regions
c = find_region(slang->sl_regions, use_region);
if (c != REGION_ALL)
region_mask = 1 << c;
else if (*slang->sl_regions != NUL)
- /* This spell file is for other regions. */
+ // This spell file is for other regions.
region_mask = 0;
}
@@ -2213,23 +2213,23 @@
}
}
- /* Everything is fine, store the new b_langp value. */
+ // Everything is fine, store the new b_langp value.
ga_clear(&wp->w_s->b_langp);
wp->w_s->b_langp = ga;
- /* For each language figure out what language to use for sound folding and
- * REP items. If the language doesn't support it itself use another one
- * with the same name. E.g. for "en-math" use "en". */
+ // For each language figure out what language to use for sound folding and
+ // REP items. If the language doesn't support it itself use another one
+ // with the same name. E.g. for "en-math" use "en".
for (i = 0; i < ga.ga_len; ++i)
{
lp = LANGP_ENTRY(ga, i);
- /* sound folding */
+ // sound folding
if (lp->lp_slang->sl_sal.ga_len > 0)
- /* language does sound folding itself */
+ // language does sound folding itself
lp->lp_sallang = lp->lp_slang;
else
- /* find first similar language that does sound folding */
+ // find first similar language that does sound folding
for (j = 0; j < ga.ga_len; ++j)
{
lp2 = LANGP_ENTRY(ga, j);
@@ -2242,12 +2242,12 @@
}
}
- /* REP items */
+ // REP items
if (lp->lp_slang->sl_rep.ga_len > 0)
- /* language has REP items itself */
+ // language has REP items itself
lp->lp_replang = lp->lp_slang;
else
- /* find first similar language that has REP items */
+ // find first similar language that has REP items
for (j = 0; j < ga.ga_len; ++j)
{
lp2 = LANGP_ENTRY(ga, j);
@@ -2287,7 +2287,7 @@
{
char_u *p;
- if (lp->sl_midword == NULL) /* there aren't any */
+ if (lp->sl_midword == NULL) // there aren't any
return;
for (p = lp->sl_midword; *p != NUL; )
@@ -2301,11 +2301,11 @@
if (c < 256 && l <= 2)
wp->w_s->b_spell_ismw[c] = TRUE;
else if (wp->w_s->b_spell_ismw_mb == NULL)
- /* First multi-byte char in "b_spell_ismw_mb". */
+ // First multi-byte char in "b_spell_ismw_mb".
wp->w_s->b_spell_ismw_mb = vim_strnsave(p, l);
else
{
- /* Append multi-byte chars to "b_spell_ismw_mb". */
+ // Append multi-byte chars to "b_spell_ismw_mb".
n = (int)STRLEN(wp->w_s->b_spell_ismw_mb);
bp = vim_strnsave(wp->w_s->b_spell_ismw_mb, n + l);
if (bp != NULL)
@@ -2351,18 +2351,18 @@
int
captype(
char_u *word,
- char_u *end) /* When NULL use up to NUL byte. */
+ char_u *end) // When NULL use up to NUL byte.
{
char_u *p;
int c;
int firstcap;
int allcap;
- int past_second = FALSE; /* past second word char */
+ int past_second = FALSE; // past second word char
- /* find first letter */
+ // find first letter
for (p = word; !spell_iswordp_nmw(p, curwin); MB_PTR_ADV(p))
if (end == NULL ? *p == NUL : p >= end)
- return 0; /* only non-word characters, illegal word */
+ return 0; // only non-word characters, illegal word
if (has_mbyte)
c = mb_ptr2char_adv(&p);
else
@@ -2379,13 +2379,13 @@
c = PTR2CHAR(p);
if (!SPELL_ISUPPER(c))
{
- /* UUl -> KEEPCAP */
+ // UUl -> KEEPCAP
if (past_second && allcap)
return WF_KEEPCAP;
allcap = FALSE;
}
else if (!allcap)
- /* UlU -> KEEPCAP */
+ // UlU -> KEEPCAP
return WF_KEEPCAP;
past_second = TRUE;
}
@@ -2423,7 +2423,7 @@
slang_T *slang;
buf_T *buf;
- /* Go through all buffers and handle 'spelllang'. <VN> */
+ // Go through all buffers and handle 'spelllang'. <VN>
FOR_ALL_BUFFERS(buf)
ga_clear(&buf->b_s.b_langp);
@@ -2449,17 +2449,17 @@
{
win_T *wp;
- /* Initialize the table for spell_iswordp(). */
+ // Initialize the table for spell_iswordp().
init_spell_chartab();
- /* Unload all allocated memory. */
+ // Unload all allocated memory.
spell_free_all();
- /* Go through all buffers and handle 'spelllang'. */
+ // Go through all buffers and handle 'spelllang'.
FOR_ALL_WINDOWS(wp)
{
- /* Only load the wordlists when 'spelllang' is set and there is a
- * window for this buffer in which 'spell' is set. */
+ // Only load the wordlists when 'spelllang' is set and there is a
+ // window for this buffer in which 'spell' is set.
if (*wp->w_s->b_p_spl != NUL)
{
if (wp->w_p_spell)
@@ -2488,12 +2488,12 @@
if (buf != NULL)
{
buf->b_spell = TRUE;
- buf->b_p_swf = TRUE; /* may create a swap file */
+ buf->b_p_swf = TRUE; // may create a swap file
#ifdef FEAT_CRYPT
buf->b_p_key = empty_option;
#endif
ml_open(buf);
- ml_open_file(buf); /* create swap file now */
+ ml_open_file(buf); // create swap file now
}
return buf;
}
@@ -2520,7 +2520,7 @@
{
int i;
- /* Init everything to FALSE. */
+ // Init everything to FALSE.
vim_memset(sp->st_isw, FALSE, sizeof(sp->st_isw));
vim_memset(sp->st_isu, FALSE, sizeof(sp->st_isu));
for (i = 0; i < 256; ++i)
@@ -2529,8 +2529,8 @@
sp->st_upper[i] = i;
}
- /* We include digits. A word shouldn't start with a digit, but handling
- * that is done separately. */
+ // We include digits. A word shouldn't start with a digit, but handling
+ // that is done separately.
for (i = '0'; i <= '9'; ++i)
sp->st_isw[i] = TRUE;
for (i = 'A'; i <= 'Z'; ++i)
@@ -2562,7 +2562,7 @@
clear_spell_chartab(&spelltab);
if (enc_dbcs)
{
- /* DBCS: assume double-wide characters are word characters. */
+ // DBCS: assume double-wide characters are word characters.
for (i = 128; i <= 255; ++i)
if (MB_BYTE2LEN(i) == 2)
spelltab.st_isw[i] = TRUE;
@@ -2576,16 +2576,16 @@
spelltab.st_isu[i] = utf_isupper(i);
spelltab.st_isw[i] = spelltab.st_isu[i] || utf_islower(i);
- /* The folded/upper-cased value is different between latin1 and
- * utf8 for 0xb5, causing E763 for no good reason. Use the latin1
- * value for utf-8 to avoid this. */
+ // The folded/upper-cased value is different between latin1 and
+ // utf8 for 0xb5, causing E763 for no good reason. Use the latin1
+ // value for utf-8 to avoid this.
spelltab.st_fold[i] = (f < 256) ? f : i;
spelltab.st_upper[i] = (u < 256) ? u : i;
}
}
else
{
- /* Rough guess: use locale-dependent library functions. */
+ // Rough guess: use locale-dependent library functions.
for (i = 128; i < 256; ++i)
{
if (MB_ISUPPER(i))
@@ -2613,7 +2613,7 @@
int
spell_iswordp(
char_u *p,
- win_T *wp) /* buffer used */
+ win_T *wp) // buffer used
{
char_u *s;
int l;
@@ -2625,9 +2625,9 @@
s = p;
if (l == 1)
{
- /* be quick for ASCII */
+ // be quick for ASCII
if (wp->w_s->b_spell_ismw[*p])
- s = p + 1; /* skip a mid-word character */
+ s = p + 1; // skip a mid-word character
}
else
{
@@ -2676,7 +2676,7 @@
spell_mb_isword_class(int cl, win_T *wp)
{
if (wp->w_s->b_cjk)
- /* East Asian characters are not considered word characters. */
+ // East Asian characters are not considered word characters.
return cl == 2 || cl == 0x2800;
return cl >= 2 && cl != 0x2070 && cl != 0x2080 && cl != 3;
}
@@ -2727,7 +2727,7 @@
if (len >= buflen)
{
buf[0] = NUL;
- return FAIL; /* result will not fit */
+ return FAIL; // result will not fit
}
if (has_mbyte)
@@ -2736,7 +2736,7 @@
char_u *p;
int c;
- /* Fold one character at a time. */
+ // Fold one character at a time.
for (p = str; p < str + len; )
{
if (outi + MB_MAXBYTES > buflen)
@@ -2751,7 +2751,7 @@
}
else
{
- /* Be quick for non-multibyte encodings. */
+ // Be quick for non-multibyte encodings.
for (i = 0; i < len; ++i)
buf[i] = spelltab.st_fold[str[i]];
buf[i] = NUL;
@@ -2781,8 +2781,8 @@
endcol = 0;
if (getwhitecols(line) >= (int)col)
{
- /* At start of line, check if previous line is empty or sentence
- * ends there. */
+ // At start of line, check if previous line is empty or sentence
+ // ends there.
if (lnum == 1)
need_cap = TRUE;
else
@@ -2792,7 +2792,7 @@
need_cap = TRUE;
else
{
- /* Append a space in place of the line break. */
+ // Append a space in place of the line break.
line_copy = concat_str(line, (char_u *)" ");
line = line_copy;
endcol = (colnr_T)STRLEN(line);
@@ -2804,7 +2804,7 @@
if (endcol > 0)
{
- /* Check if sentence ends before the bad word. */
+ // Check if sentence ends before the bad word.
regmatch.regprog = curwin->w_s->b_cap_prog;
regmatch.rm_ic = FALSE;
p = line + endcol;
@@ -2865,8 +2865,8 @@
|| u_save_cursor() == FAIL)
break;
- /* Only replace when the right word isn't there yet. This happens
- * when changing "etc" to "etc.". */
+ // Only replace when the right word isn't there yet. This happens
+ // when changing "etc" to "etc.".
line = ml_get_curline();
if (addlen <= 0 || STRNCMP(line + curwin->w_cursor.col,
repl_to, STRLEN(repl_to)) != 0)
@@ -2909,7 +2909,7 @@
onecap_copy(
char_u *word,
char_u *wcopy,
- int upper) /* TRUE: first letter made upper case */
+ int upper) // TRUE: first letter made upper case
{
char_u *p;
int c;
@@ -2953,8 +2953,8 @@
else
c = *s++;
- /* We only change 0xdf to SS when we are certain latin1 is used. It
- * would cause weird errors in other 8-bit encodings. */
+ // We only change 0xdf to SS when we are certain latin1 is used. It
+ // would cause weird errors in other 8-bit encodings.
if (enc_latin1like && c == 0xdf)
{
c = 'S';
@@ -3005,13 +3005,13 @@
make_case_word(char_u *fword, char_u *cword, int flags)
{
if (flags & WF_ALLCAP)
- /* Make it all upper-case */
+ // Make it all upper-case
allcap_copy(fword, cword);
else if (flags & WF_ONECAP)
- /* Make the first letter upper-case */
+ // Make the first letter upper-case
onecap_copy(fword, cword, TRUE);
else
- /* Use goodword as-is. */
+ // Use goodword as-is.
STRCPY(cword, fword);
}
@@ -3028,19 +3028,19 @@
int lpi;
if (curwin->w_p_spell && *curwin->w_s->b_p_spl != NUL)
- /* Use the sound-folding of the first language that supports it. */
+ // Use the sound-folding of the first language that supports it.
for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi)
{
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
if (lp->lp_slang->sl_sal.ga_len > 0)
{
- /* soundfold the word */
+ // soundfold the word
spell_soundfold(lp->lp_slang, word, FALSE, sound);
return vim_strsave(sound);
}
}
- /* No language with sound folding, return word as-is. */
+ // No language with sound folding, return word as-is.
return vim_strsave(word);
}
#endif
@@ -3061,18 +3061,18 @@
spell_soundfold(
slang_T *slang,
char_u *inword,
- int folded, /* "inword" is already case-folded */
+ int folded, // "inword" is already case-folded
char_u *res)
{
char_u fword[MAXWLEN];
char_u *word;
if (slang->sl_sofo)
- /* SOFOFROM and SOFOTO used */
+ // SOFOFROM and SOFOTO used
spell_soundfold_sofo(slang, inword, res);
else
{
- /* SAL items used. Requires the word to be case-folded. */
+ // SAL items used. Requires the word to be case-folded.
if (folded)
word = inword;
else
@@ -3104,8 +3104,8 @@
int prevc = 0;
int *ip;
- /* The sl_sal_first[] table contains the translation for chars up to
- * 255, sl_sal the rest. */
+ // The sl_sal_first[] table contains the translation for chars up to
+ // 255, sl_sal the rest.
for (s = inword; *s != NUL; )
{
c = mb_cptr2char_adv(&s);
@@ -3116,17 +3116,17 @@
else
{
ip = ((int **)slang->sl_sal.ga_data)[c & 0xff];
- if (ip == NULL) /* empty list, can't match */
+ if (ip == NULL) // empty list, can't match
c = NUL;
else
- for (;;) /* find "c" in the list */
+ for (;;) // find "c" in the list
{
- if (*ip == 0) /* not found */
+ if (*ip == 0) // not found
{
c = NUL;
break;
}
- if (*ip == c) /* match! */
+ if (*ip == c) // match!
{
c = ip[1];
break;
@@ -3146,7 +3146,7 @@
}
else
{
- /* The sl_sal_first[] table contains the translation. */
+ // The sl_sal_first[] table contains the translation.
for (s = inword; (c = *s) != NUL; ++s)
{
if (VIM_ISWHITE(c))
@@ -3180,8 +3180,8 @@
int p0 = -333;
int c0;
- /* Remove accents, if wanted. We actually remove all non-word characters.
- * But keep white space. We need a copy, the word may be changed here. */
+ // Remove accents, if wanted. We actually remove all non-word characters.
+ // But keep white space. We need a copy, the word may be changed here.
if (slang->sl_rem_accents)
{
t = word;
@@ -3213,17 +3213,17 @@
i = reslen = z = 0;
while ((c = word[i]) != NUL)
{
- /* Start with the first rule that has the character in the word. */
+ // Start with the first rule that has the character in the word.
n = slang->sl_sal_first[c];
z0 = 0;
if (n >= 0)
{
- /* check all rules for the same letter */
+ // check all rules for the same letter
for (; (s = smp[n].sm_lead)[0] == c; ++n)
{
- /* Quickly skip entries that don't match the word. Most
- * entries are less then three chars, optimize for that. */
+ // Quickly skip entries that don't match the word. Most
+ // entries are less then three chars, optimize for that.
k = smp[n].sm_leadlen;
if (k > 1)
{
@@ -3241,7 +3241,7 @@
if ((pf = smp[n].sm_oneof) != NULL)
{
- /* Check for match with one of the chars in "sm_oneof". */
+ // Check for match with one of the chars in "sm_oneof".
while (*pf != NUL && *pf != word[i + k])
++pf;
if (*pf == NUL)
@@ -3249,7 +3249,7 @@
++k;
}
s = smp[n].sm_rules;
- pri = 5; /* default priority */
+ pri = 5; // default priority
p0 = *s;
k0 = k;
@@ -3262,7 +3262,7 @@
s++;
if (VIM_ISDIGIT(*s))
{
- /* determine priority */
+ // determine priority
pri = *s - '0';
s++;
}
@@ -3279,19 +3279,19 @@
&& spell_iswordp(word + i - 1, curwin)
&& (!spell_iswordp(word + i + k0, curwin))))
{
- /* search for followup rules, if: */
- /* followup and k > 1 and NO '-' in searchstring */
+ // search for followup rules, if:
+ // followup and k > 1 and NO '-' in searchstring
c0 = word[i + k - 1];
n0 = slang->sl_sal_first[c0];
if (slang->sl_followup && k > 1 && n0 >= 0
&& p0 != '-' && word[i + k] != NUL)
{
- /* test follow-up rule for "word[i + k]" */
+ // test follow-up rule for "word[i + k]"
for ( ; (s = smp[n0].sm_lead)[0] == c0; ++n0)
{
- /* Quickly skip entries that don't match the word.
- * */
+ // Quickly skip entries that don't match the word.
+ //
k0 = smp[n0].sm_leadlen;
if (k0 > 1)
{
@@ -3311,8 +3311,8 @@
if ((pf = smp[n0].sm_oneof) != NULL)
{
- /* Check for match with one of the chars in
- * "sm_oneof". */
+ // Check for match with one of the chars in
+ // "sm_oneof".
while (*pf != NUL && *pf != word[i + k0])
++pf;
if (*pf == NUL)
@@ -3324,8 +3324,8 @@
s = smp[n0].sm_rules;
while (*s == '-')
{
- /* "k0" gets NOT reduced because
- * "if (k0 == k)" */
+ // "k0" gets NOT reduced because
+ // "if (k0 == k)"
s++;
}
if (*s == '<')
@@ -3337,19 +3337,19 @@
}
if (*s == NUL
- /* *s == '^' cuts */
+ // *s == '^' cuts
|| (*s == '$'
&& !spell_iswordp(word + i + k0,
curwin)))
{
if (k0 == k)
- /* this is just a piece of the string */
+ // this is just a piece of the string
continue;
if (p0 < pri)
- /* priority too low */
+ // priority too low
continue;
- /* rule fits; stop search */
+ // rule fits; stop search
break;
}
}
@@ -3358,7 +3358,7 @@
continue;
}
- /* replace string */
+ // replace string
s = smp[n].sm_to;
if (s == NULL)
s = (char_u *)"";
@@ -3366,7 +3366,7 @@
p0 = (vim_strchr(pf, '<') != NULL) ? 1 : 0;
if (p0 == 1 && z == 0)
{
- /* rule with '<' is used */
+ // rule with '<' is used
if (reslen > 0 && *s != NUL && (res[reslen - 1] == c
|| res[reslen - 1] == *s))
reslen--;
@@ -3382,12 +3382,12 @@
if (k > k0)
STRMOVE(word + i + k0, word + i + k);
- /* new "actual letter" */
+ // new "actual letter"
c = word[i];
}
else
{
- /* no '<' rule used */
+ // no '<' rule used
i += k - 1;
z = 0;
while (*s != NUL && s[1] != NUL && reslen < MAXWLEN)
@@ -3396,7 +3396,7 @@
res[reslen++] = *s;
s++;
}
- /* new "actual letter" */
+ // new "actual letter"
c = *s;
if (strstr((char *)pf, "^^") != NULL)
{
@@ -3422,7 +3422,7 @@
if (k && !p0 && reslen < MAXWLEN && c != NUL
&& (!slang->sl_collapse || reslen == 0
|| res[reslen - 1] != c))
- /* condense only double letters */
+ // condense only double letters
res[reslen++] = c;
i++;
@@ -3501,20 +3501,20 @@
i = reslen = z = 0;
while ((c = word[i]) != NUL)
{
- /* Start with the first rule that has the character in the word. */
+ // Start with the first rule that has the character in the word.
n = slang->sl_sal_first[c & 0xff];
z0 = 0;
if (n >= 0)
{
- /* Check all rules for the same index byte.
- * If c is 0x300 need extra check for the end of the array, as
- * (c & 0xff) is NUL. */
+ // Check all rules for the same index byte.
+ // If c is 0x300 need extra check for the end of the array, as
+ // (c & 0xff) is NUL.
for (; ((ws = smp[n].sm_lead_w)[0] & 0xff) == (c & 0xff)
&& ws[0] != NUL; ++n)
{
- /* Quickly skip entries that don't match the word. Most
- * entries are less then three chars, optimize for that. */
+ // Quickly skip entries that don't match the word. Most
+ // entries are less then three chars, optimize for that.
if (c != ws[0])
continue;
k = smp[n].sm_leadlen;
@@ -3534,7 +3534,7 @@
if ((pf = smp[n].sm_oneof_w) != NULL)
{
- /* Check for match with one of the chars in "sm_oneof". */
+ // Check for match with one of the chars in "sm_oneof".
while (*pf != NUL && *pf != word[i + k])
++pf;
if (*pf == NUL)
@@ -3542,7 +3542,7 @@
++k;
}
s = smp[n].sm_rules;
- pri = 5; /* default priority */
+ pri = 5; // default priority
p0 = *s;
k0 = k;
@@ -3555,7 +3555,7 @@
s++;
if (VIM_ISDIGIT(*s))
{
- /* determine priority */
+ // determine priority
pri = *s - '0';
s++;
}
@@ -3572,21 +3572,20 @@
&& spell_iswordp_w(word + i - 1, curwin)
&& (!spell_iswordp_w(word + i + k0, curwin))))
{
- /* search for followup rules, if: */
- /* followup and k > 1 and NO '-' in searchstring */
+ // search for followup rules, if:
+ // followup and k > 1 and NO '-' in searchstring
c0 = word[i + k - 1];
n0 = slang->sl_sal_first[c0 & 0xff];
if (slang->sl_followup && k > 1 && n0 >= 0
&& p0 != '-' && word[i + k] != NUL)
{
- /* Test follow-up rule for "word[i + k]"; loop over
- * all entries with the same index byte. */
+ // Test follow-up rule for "word[i + k]"; loop over
+ // all entries with the same index byte.
for ( ; ((ws = smp[n0].sm_lead_w)[0] & 0xff)
== (c0 & 0xff); ++n0)
{
- /* Quickly skip entries that don't match the word.
- */
+ // Quickly skip entries that don't match the word.
if (c0 != ws[0])
continue;
k0 = smp[n0].sm_leadlen;
@@ -3608,8 +3607,8 @@
if ((pf = smp[n0].sm_oneof_w) != NULL)
{
- /* Check for match with one of the chars in
- * "sm_oneof". */
+ // Check for match with one of the chars in
+ // "sm_oneof".
while (*pf != NUL && *pf != word[i + k0])
++pf;
if (*pf == NUL)
@@ -3621,8 +3620,8 @@
s = smp[n0].sm_rules;
while (*s == '-')
{
- /* "k0" gets NOT reduced because
- * "if (k0 == k)" */
+ // "k0" gets NOT reduced because
+ // "if (k0 == k)"
s++;
}
if (*s == '<')
@@ -3634,19 +3633,19 @@
}
if (*s == NUL
- /* *s == '^' cuts */
+ // *s == '^' cuts
|| (*s == '$'
&& !spell_iswordp_w(word + i + k0,
curwin)))
{
if (k0 == k)
- /* this is just a piece of the string */
+ // this is just a piece of the string
continue;
if (p0 < pri)
- /* priority too low */
+ // priority too low
continue;
- /* rule fits; stop search */
+ // rule fits; stop search
break;
}
}
@@ -3656,13 +3655,13 @@
continue;
}
- /* replace string */
+ // replace string
ws = smp[n].sm_to_w;
s = smp[n].sm_rules;
p0 = (vim_strchr(s, '<') != NULL) ? 1 : 0;
if (p0 == 1 && z == 0)
{
- /* rule with '<' is used */
+ // rule with '<' is used
if (reslen > 0 && ws != NULL && *ws != NUL
&& (wres[reslen - 1] == c
|| wres[reslen - 1] == *ws))
@@ -3681,12 +3680,12 @@
mch_memmove(word + i + k0, word + i + k,
sizeof(int) * (wordlen - (i + k) + 1));
- /* new "actual letter" */
+ // new "actual letter"
c = word[i];
}
else
{
- /* no '<' rule used */
+ // no '<' rule used
i += k - 1;
z = 0;
if (ws != NULL)
@@ -3697,7 +3696,7 @@
wres[reslen++] = *ws;
ws++;
}
- /* new "actual letter" */
+ // new "actual letter"
if (ws == NULL)
c = NUL;
else
@@ -3727,7 +3726,7 @@
if (k && !p0 && reslen < MAXWLEN && c != NUL
&& (!slang->sl_collapse || reslen == 0
|| wres[reslen - 1] != c))
- /* condense only double letters */
+ // condense only double letters
wres[reslen++] = c;
i++;
@@ -3736,7 +3735,7 @@
}
}
- /* Convert wide characters in "wres" to a multi-byte string in "res". */
+ // Convert wide characters in "wres" to a multi-byte string in "res".
l = 0;
for (n = 0; n < reslen; ++n)
{
@@ -3777,11 +3776,11 @@
msg_end();
}
-#define DUMPFLAG_KEEPCASE 1 /* round 2: keep-case tree */
-#define DUMPFLAG_COUNT 2 /* include word count */
-#define DUMPFLAG_ICASE 4 /* ignore case when finding matches */
-#define DUMPFLAG_ONECAP 8 /* pattern starts with capital */
-#define DUMPFLAG_ALLCAP 16 /* pattern is all capitals */
+#define DUMPFLAG_KEEPCASE 1 // round 2: keep-case tree
+#define DUMPFLAG_COUNT 2 // include word count
+#define DUMPFLAG_ICASE 4 // ignore case when finding matches
+#define DUMPFLAG_ONECAP 8 // pattern starts with capital
+#define DUMPFLAG_ALLCAP 16 // pattern is all capitals
/*
* ":spelldump"
@@ -3796,10 +3795,10 @@
return;
get_option_value((char_u*)"spl", &dummy, &spl, OPT_LOCAL);
- /* Create a new empty buffer in a new window. */
+ // Create a new empty buffer in a new window.
do_cmdline_cmd((char_u *)"new");
- /* enable spelling locally in the new window */
+ // enable spelling locally in the new window
set_option_value((char_u*)"spell", TRUE, (char_u*)"", OPT_LOCAL);
set_option_value((char_u*)"spl", dummy, spl, OPT_LOCAL);
vim_free(spl);
@@ -3809,7 +3808,7 @@
spell_dump_compl(NULL, 0, NULL, eap->forceit ? DUMPFLAG_COUNT : 0);
- /* Delete the empty line that we started with. */
+ // Delete the empty line that we started with.
if (curbuf->b_ml.ml_line_count > 1)
ml_delete(curbuf->b_ml.ml_line_count, FALSE);
@@ -3824,10 +3823,10 @@
*/
void
spell_dump_compl(
- char_u *pat, /* leading part of the word */
- int ic, /* ignore case */
- int *dir, /* direction for adding matches */
- int dumpflags_arg) /* DUMPFLAG_* */
+ char_u *pat, // leading part of the word
+ int ic, // ignore case
+ int *dir, // direction for adding matches
+ int dumpflags_arg) // DUMPFLAG_*
{
langp_T *lp;
slang_T *slang;
@@ -3842,15 +3841,15 @@
int depth;
int n;
int flags;
- char_u *region_names = NULL; /* region names being used */
- int do_region = TRUE; /* dump region names and numbers */
+ char_u *region_names = NULL; // region names being used
+ int do_region = TRUE; // dump region names and numbers
char_u *p;
int lpi;
int dumpflags = dumpflags_arg;
int patlen;
- /* When ignoring case or when the pattern starts with capital pass this on
- * to dump_word(). */
+ // When ignoring case or when the pattern starts with capital pass this on
+ // to dump_word().
if (pat != NULL)
{
if (ic)
@@ -3865,19 +3864,19 @@
}
}
- /* Find out if we can support regions: All languages must support the same
- * regions or none at all. */
+ // Find out if we can support regions: All languages must support the same
+ // regions or none at all.
for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi)
{
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
p = lp->lp_slang->sl_regions;
if (p[0] != 0)
{
- if (region_names == NULL) /* first language with regions */
+ if (region_names == NULL) // first language with regions
region_names = p;
else if (STRCMP(region_names, p) != 0)
{
- do_region = FALSE; /* region names are different */
+ do_region = FALSE; // region names are different
break;
}
}
@@ -3901,7 +3900,7 @@
{
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
slang = lp->lp_slang;
- if (slang->sl_fbyts == NULL) /* reloading failed */
+ if (slang->sl_fbyts == NULL) // reloading failed
continue;
if (pat == NULL)
@@ -3910,15 +3909,15 @@
ml_append(lnum++, IObuff, (colnr_T)0, FALSE);
}
- /* When matching with a pattern and there are no prefixes only use
- * parts of the tree that match "pat". */
+ // When matching with a pattern and there are no prefixes only use
+ // parts of the tree that match "pat".
if (pat != NULL && slang->sl_pbyts == NULL)
patlen = (int)STRLEN(pat);
else
patlen = -1;
- /* round 1: case-folded tree
- * round 2: keep-case tree */
+ // round 1: case-folded tree
+ // round 2: keep-case tree
for (round = 1; round <= 2; ++round)
{
if (round == 1)
@@ -3934,7 +3933,7 @@
idxs = slang->sl_kidxs;
}
if (byts == NULL)
- continue; /* array is empty */
+ continue; // array is empty
depth = 0;
arridx[0] = 0;
@@ -3944,23 +3943,23 @@
{
if (curi[depth] > byts[arridx[depth]])
{
- /* Done all bytes at this node, go up one level. */
+ // Done all bytes at this node, go up one level.
--depth;
line_breakcheck();
ins_compl_check_keys(50, FALSE);
}
else
{
- /* Do one more byte at this node. */
+ // Do one more byte at this node.
n = arridx[depth] + curi[depth];
++curi[depth];
c = byts[n];
if (c == 0)
{
- /* End of word, deal with the word.
- * Don't use keep-case words in the fold-case tree,
- * they will appear in the keep-case tree.
- * Only use the word when the region matches. */
+ // End of word, deal with the word.
+ // Don't use keep-case words in the fold-case tree,
+ // they will appear in the keep-case tree.
+ // Only use the word when the region matches.
flags = (int)idxs[n];
if ((round == 2 || (flags & WF_KEEPCAP) == 0)
&& (flags & WF_NEEDCOMP) == 0
@@ -3973,8 +3972,8 @@
if (!do_region)
flags &= ~WF_REGION;
- /* Dump the basic word if there is no prefix or
- * when it's the first one. */
+ // Dump the basic word if there is no prefix or
+ // when it's the first one.
c = (unsigned)flags >> 24;
if (c == 0 || curi[depth] == 2)
{
@@ -3984,7 +3983,7 @@
++lnum;
}
- /* Apply the prefix, if there is one. */
+ // Apply the prefix, if there is one.
if (c != 0)
lnum = dump_prefixes(slang, word, pat, dir,
dumpflags, flags, lnum);
@@ -3992,17 +3991,17 @@
}
else
{
- /* Normal char, go one level deeper. */
+ // Normal char, go one level deeper.
word[depth++] = c;
arridx[depth] = idxs[n];
curi[depth] = 1;
- /* Check if this characters matches with the pattern.
- * If not skip the whole tree below it.
- * Always ignore case here, dump_word() will check
- * proper case later. This isn't exactly right when
- * length changes for multi-byte characters with
- * ignore case... */
+ // Check if this characters matches with the pattern.
+ // If not skip the whole tree below it.
+ // Always ignore case here, dump_word() will check
+ // proper case later. This isn't exactly right when
+ // length changes for multi-byte characters with
+ // ignore case...
if (depth <= patlen
&& MB_STRNICMP(word, pat, depth) != 0)
--depth;
@@ -4042,7 +4041,7 @@
if ((dumpflags & DUMPFLAG_KEEPCASE) == 0 && (flags & WF_CAPMASK) != 0)
{
- /* Need to fix case according to "flags". */
+ // Need to fix case according to "flags".
make_case_word(word, cword, flags);
p = cword;
}
@@ -4058,7 +4057,7 @@
if (pat == NULL)
{
- /* Add flags and regions after a slash. */
+ // Add flags and regions after a slash.
if ((flags & (WF_BANNED | WF_RARE | WF_REGION)) || keepcap)
{
STRCPY(badword, p);
@@ -4080,7 +4079,7 @@
{
hashitem_T *hi;
- /* Include the word count for ":spelldump!". */
+ // Include the word count for ":spelldump!".
hi = hash_find(&slang->sl_wordcount, tw);
if (!HASHITEM_EMPTY(hi))
{
@@ -4097,7 +4096,7 @@
: STRNCMP(p, pat, STRLEN(pat)) == 0)
&& ins_compl_add_infercase(p, (int)STRLEN(p),
p_ic, NULL, *dir, FALSE) == OK)
- /* if dir was BACKWARD then honor it just once */
+ // if dir was BACKWARD then honor it just once
*dir = FORWARD;
}
@@ -4110,11 +4109,11 @@
static linenr_T
dump_prefixes(
slang_T *slang,
- char_u *word, /* case-folded word */
+ char_u *word, // case-folded word
char_u *pat,
int *dir,
int dumpflags,
- int flags, /* flags with prefix ID */
+ int flags, // flags with prefix ID
linenr_T startlnum)
{
idx_T arridx[MAXWLEN];
@@ -4131,8 +4130,8 @@
int len;
int i;
- /* If the word starts with a lower-case letter make the word with an
- * upper-case letter in word_up[]. */
+ // If the word starts with a lower-case letter make the word with an
+ // upper-case letter in word_up[].
c = PTR2CHAR(word);
if (SPELL_TOUPPER(c) != c)
{
@@ -4142,7 +4141,7 @@
byts = slang->sl_pbyts;
idxs = slang->sl_pidxs;
- if (byts != NULL) /* array not is empty */
+ if (byts != NULL) // array not is empty
{
/*
* Loop over all prefixes, building them byte-by-byte in prefix[].
@@ -4157,19 +4156,19 @@
len = byts[n];
if (curi[depth] > len)
{
- /* Done all bytes at this node, go up one level. */
+ // Done all bytes at this node, go up one level.
--depth;
line_breakcheck();
}
else
{
- /* Do one more byte at this node. */
+ // Do one more byte at this node.
n += curi[depth];
++curi[depth];
c = byts[n];
if (c == 0)
{
- /* End of prefix, find out how many IDs there are. */
+ // End of prefix, find out how many IDs there are.
for (i = 1; i < len; ++i)
if (byts[n + i] != 0)
break;
@@ -4186,9 +4185,9 @@
++lnum;
}
- /* Check for prefix that matches the word when the
- * first letter is upper-case, but only if the prefix has
- * a condition. */
+ // Check for prefix that matches the word when the
+ // first letter is upper-case, but only if the prefix has
+ // a condition.
if (has_word_up)
{
c = valid_word_prefix(i, n, flags, word_up, slang,
@@ -4207,7 +4206,7 @@
}
else
{
- /* Normal char, go one level deeper. */
+ // Normal char, go one level deeper.
prefix[depth++] = c;
arridx[depth] = idxs[n];
curi[depth] = 1;
@@ -4250,7 +4249,7 @@
if (no_spell_checking(curwin))
return startcol;
- /* Find a word character before "startcol". */
+ // Find a word character before "startcol".
line = ml_get_curline();
for (p = line + startcol; p > line; )
{
@@ -4259,7 +4258,7 @@
break;
}
- /* Go back to start of the word. */
+ // Go back to start of the word.
while (p > line)
{
col = (int)(p - line);