summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-05 21:33:15 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-05 21:33:15 +0100
commit0d6f5d9740dbad1b0207f3ab257de806169dd905 (patch)
tree3b4d840ac6f3972bfab2599cc52555ce55d66eaa /src
parent63d9e730f726341bf41ee4f4b829253cb9879110 (diff)
patch 8.1.2395: using old C style commentsv8.1.2395
Problem: Using old C style comments. Solution: Use // comments where appropriate.
Diffstat (limited to 'src')
-rw-r--r--src/spell.c1043
-rw-r--r--src/spellfile.c1871
-rw-r--r--src/syntax.c976
-rw-r--r--src/tag.c651
-rw-r--r--src/term.c1043
-rw-r--r--src/terminal.c605
-rw-r--r--src/termlib.c194
-rw-r--r--src/testing.c4
-rw-r--r--src/version.c2
9 files changed, 3188 insertions, 3201 deletions
diff --git a/src/spell.c b/src/spell.c
index 46209077c6..572f7fbb9c 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 */
-
- /* 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 */
-
- /* 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 */
-
- /* 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 */
+ 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
+
+ // 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 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
+
+ // 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 @@ static linenr_T dump_prefixes(slang_T *slang, char_u *word, char_u *pat, int *di
*/
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 @@ spell_check(
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 @@ spell_check(
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 @@ spell_check(
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 @@ spell_check(
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 @@ spell_check(
{
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 @@ spell_check(
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 @@ spell_check(
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 @@ spell_check(
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(&regmatch, ptr, 0);
@@ -315,8 +315,8 @@ spell_check(
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 @@ spell_check(
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 @@ spell_check(
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 @@ spell_check(
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 @@ find_word(matchinf_T *mip, int mode)
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 @@ find_word(matchinf_T *mip, int mode)
}
if (byts == NULL)
- return; /* array is empty */
+ return; // array is empty
/*
* Repeat advancing in the tree until:
@@ -451,13 +451,13 @@ find_word(matchinf_T *mip, int mode)
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 @@ find_word(matchinf_T *mip, int mode)
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 @@ find_word(matchinf_T *mip, int mode)
}
}
- /* 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 @@ find_word(matchinf_T *mip, int mode)
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 @@ find_word(matchinf_T *mip, int mode)
}
}
- /* 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 @@ find_word(matchinf_T *mip, int mode)
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 @@ find_word(matchinf_T *mip, int mode)
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 @@ find_word(matchinf_T *mip, int mode)
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 @@ find_word(matchinf_T *mip, int mode)
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 @@ find_word(matchinf_T *mip, int mode)
{
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 @@ find_word(matchinf_T *mip, int mode)
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 @@ find_word(matchinf_T *mip, int mode)
}
}
- /* 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 @@ find_word(matchinf_T *mip, int mode)
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 @@ find_word(matchinf_T *mip, int mode)
}
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 @@ find_word(matchinf_T *mip, int mode)
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 @@ find_word(matchinf_T *mip, int mode)
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(matchinf_T *mip, int mode)
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 @@ find_word(matchinf_T *mip, int mode)
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 @@ find_word(matchinf_T *mip, int mode)
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 @@ find_word(matchinf_T *mip, int mode)
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 @@ match_checkcompoundpattern(
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 @@ can_compound(slang_T *slang, char_u *word, char_u *flags)
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 @@ can_compound(slang_T *slang, char_u *word, char_u *flags)
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 @@ match_compoundrule(slang_T *slang, char_u *compflags)
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 @@ match_compoundrule(slang_T *slang, char_u *compflags)
*/
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 @@ valid_word_prefix(
{
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 @@ valid_word_prefix(
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 @@ find_prefix(matchinf_T *mip, int mode)
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). */