summaryrefslogtreecommitdiff
path: root/src/spellfile.c
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/spellfile.c
parent63d9e730f726341bf41ee4f4b829253cb9879110 (diff)
downloadvim-git-0d6f5d9740dbad1b0207f3ab257de806169dd905.tar.gz
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/spellfile.c')
-rw-r--r--src/spellfile.c1871
1 files changed, 935 insertions, 936 deletions
diff --git a/src/spellfile.c b/src/spellfile.c
index 4b364421d..b9451ecd6 100644
--- a/src/spellfile.c
+++ b/src/spellfile.c
@@ -241,57 +241,57 @@
#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
-#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
-/* Special byte values for <byte>. Some are only used in the tree for
- * postponed prefixes, some only in the other trees. This is a bit messy... */
-#define BY_NOFLAGS 0 /* end of word without flags or region; for
- * postponed prefix: no <pflags> */
-#define BY_INDEX 1 /* child is shared, index follows */
-#define BY_FLAGS 2 /* end of word, <flags> byte follows; for
- * postponed prefix: <pflags> follows */
-#define BY_FLAGS2 3 /* end of word, <flags> and <flags2> bytes
- * follow; never used in prefix tree */
-#define BY_SPECIAL BY_FLAGS2 /* highest special byte value */
+// Special byte values for <byte>. Some are only used in the tree for
+// postponed prefixes, some only in the other trees. This is a bit messy...
+#define BY_NOFLAGS 0 // end of word without flags or region; for
+ // postponed prefix: no <pflags>
+#define BY_INDEX 1 // child is shared, index follows
+#define BY_FLAGS 2 // end of word, <flags> byte follows; for
+ // postponed prefix: <pflags> follows
+#define BY_FLAGS2 3 // end of word, <flags> and <flags2> bytes
+ // follow; never used in prefix tree
+#define BY_SPECIAL BY_FLAGS2 // highest special byte value
#define ZERO_FLAG 65009 // used when flag is zero: "0"
-/* Flags used in .spl file for soundsalike flags. */
+// Flags used in .spl file for soundsalike flags.
#define SAL_F0LLOWUP 1
#define SAL_COLLAPSE 2
#define SAL_REM_ACCENTS 4
-#define VIMSPELLMAGIC "VIMspell" /* string at start of Vim spell file */
+#define VIMSPELLMAGIC "VIMspell" // string at start of Vim spell file
#define VIMSPELLMAGICL 8
#define VIMSPELLVERSION 50
-/* Section IDs. Only renumber them when VIMSPELLVERSION changes! */
-#define SN_REGION 0 /* <regionname> section */
-#define SN_CHARFLAGS 1 /* charflags section */
-#define SN_MIDWORD 2 /* <midword> section */
-#define SN_PREFCOND 3 /* <prefcond> section */
-#define SN_REP 4 /* REP items section */
-#define SN_SAL 5 /* SAL items section */
-#define SN_SOFO 6 /* soundfolding section */
-#define SN_MAP 7 /* MAP items section */
-#define SN_COMPOUND 8 /* compound words section */
-#define SN_SYLLABLE 9 /* syllable section */
-#define SN_NOBREAK 10 /* NOBREAK section */
-#define SN_SUGFILE 11 /* timestamp for .sug file */
-#define SN_REPSAL 12 /* REPSAL items section */
-#define SN_WORDS 13 /* common words */
-#define SN_NOSPLITSUGS 14 /* don't split word for suggestions */
-#define SN_INFO 15 /* info section */
-#define SN_NOCOMPOUNDSUGS 16 /* don't compound for suggestions */
-#define SN_END 255 /* end of sections */
-
-#define SNF_REQUIRED 1 /* <sectionflags>: required section */
+// Section IDs. Only renumber them when VIMSPELLVERSION changes!
+#define SN_REGION 0 // <regionname> section
+#define SN_CHARFLAGS 1 // charflags section
+#define SN_MIDWORD 2 // <midword> section
+#define SN_PREFCOND 3 // <prefcond> section
+#define SN_REP 4 // REP items section
+#define SN_SAL 5 // SAL items section
+#define SN_SOFO 6 // soundfolding section
+#define SN_MAP 7 // MAP items section
+#define SN_COMPOUND 8 // compound words section
+#define SN_SYLLABLE 9 // syllable section
+#define SN_NOBREAK 10 // NOBREAK section
+#define SN_SUGFILE 11 // timestamp for .sug file
+#define SN_REPSAL 12 // REPSAL items section
+#define SN_WORDS 13 // common words
+#define SN_NOSPLITSUGS 14 // don't split word for suggestions
+#define SN_INFO 15 // info section
+#define SN_NOCOMPOUNDSUGS 16 // don't compound for suggestions
+#define SN_END 255 // end of sections
+
+#define SNF_REQUIRED 1 // <sectionflags>: required section
#define CF_WORD 0x01
#define CF_UPPER 0x02
@@ -341,7 +341,7 @@ spell_load_file(
char_u *fname,
char_u *lang,
slang_T *old_lp,
- int silent) /* no error if file doesn't exist */
+ int silent) // no error if file doesn't exist
{
FILE *fd;
char_u buf[VIMSPELLMAGICL];
@@ -381,18 +381,18 @@ spell_load_file(
if (lp == NULL)
goto endFAIL;
- /* Remember the file name, used to reload the file when it's updated. */
+ // Remember the file name, used to reload the file when it's updated.
lp->sl_fname = vim_strsave(fname);
if (lp->sl_fname == NULL)
goto endFAIL;
- /* Check for .add.spl (_add.spl for VMS). */
+ // Check for .add.spl (_add.spl for VMS).
lp->sl_add = strstr((char *)gettail(fname), SPL_FNAME_ADD) != NULL;
}
else
lp = old_lp;
- /* Set sourcing_name, so that error messages mention the file name. */
+ // Set sourcing_name, so that error messages mention the file name.
sourcing_name = fname;
sourcing_lnum = 0;
@@ -400,13 +400,13 @@ spell_load_file(
* <HEADER>: <fileID>
*/
for (i = 0; i < VIMSPELLMAGICL; ++i)
- buf[i] = getc(fd); /* <fileID> */
+ buf[i] = getc(fd); // <fileID>
if (STRNCMP(buf, VIMSPELLMAGIC, VIMSPELLMAGICL) != 0)
{
emsg(_("E757: This does not look like a spell file"));
goto endFAIL;
}
- c = getc(fd); /* <versionnr> */
+ c = getc(fd); // <versionnr>
if (c < VIMSPELLVERSION)
{
emsg(_("E771: Old spell file, needs to be updated"));
@@ -425,11 +425,11 @@ spell_load_file(
*/
for (;;)
{
- n = getc(fd); /* <sectionID> or <sectionend> */
+ n = getc(fd); // <sectionID> or <sectionend>
if (n == SN_END)
break;
- c = getc(fd); /* <sectionflags> */
- len = get4c(fd); /* <sectionlen> */
+ c = getc(fd); // <sectionflags>
+ len = get4c(fd); // <sectionlen>
if (len < 0)
goto truncerr;
@@ -437,7 +437,7 @@ spell_load_file(
switch (n)
{
case SN_INFO:
- lp->sl_info = read_string(fd, len); /* <infotext> */
+ lp->sl_info = read_string(fd, len); // <infotext>
if (lp->sl_info == NULL)
goto endFAIL;
break;
@@ -451,7 +451,7 @@ spell_load_file(
break;
case SN_MIDWORD:
- lp->sl_midword = read_string(fd, len); /* <midword> */
+ lp->sl_midword = read_string(fd, len); // <midword>
if (lp->sl_midword == NULL)
goto endFAIL;
break;
@@ -477,7 +477,7 @@ spell_load_file(
break;
case SN_MAP:
- p = read_string(fd, len); /* <mapstr> */
+ p = read_string(fd, len); // <mapstr>
if (p == NULL)
goto endFAIL;
set_map_str(lp, p);
@@ -489,7 +489,7 @@ spell_load_file(
break;
case SN_SUGFILE:
- lp->sl_sugtime = get8ctime(fd); /* <timestamp> */
+ lp->sl_sugtime = get8ctime(fd); // <timestamp>
break;
case SN_NOSPLITSUGS:
@@ -509,7 +509,7 @@ spell_load_file(
break;
case SN_SYLLABLE:
- lp->sl_syllable = read_string(fd, len); /* <syllable> */
+ lp->sl_syllable = read_string(fd, len); // <syllable>
if (lp->sl_syllable == NULL)
goto endFAIL;
if (init_syl_tab(lp) == FAIL)
@@ -517,8 +517,8 @@ spell_load_file(
break;
default:
- /* Unsupported section. When it's required give an error
- * message. When it's not required skip the contents. */
+ // Unsupported section. When it's required give an error
+ // message. When it's not required skip the contents.
if (c & SNF_REQUIRED)
{
emsg(_("E770: Unsupported section in spell file"));
@@ -545,23 +545,23 @@ truncerr:
goto endFAIL;
}
- /* <LWORDTREE> */
+ // <LWORDTREE>
res = spell_read_tree(fd, &lp->sl_fbyts, &lp->sl_fidxs, FALSE, 0);
if (res != 0)
goto someerror;
- /* <KWORDTREE> */
+ // <KWORDTREE>
res = spell_read_tree(fd, &lp->sl_kbyts, &lp->sl_kidxs, FALSE, 0);
if (res != 0)
goto someerror;
- /* <PREFIXTREE> */
+ // <PREFIXTREE>
res = spell_read_tree(fd, &lp->sl_pbyts, &lp->sl_pidxs, TRUE,
lp->sl_prefixcnt);
if (res != 0)
goto someerror;
- /* For a new file link it in the list of spell files. */
+ // For a new file link it in the list of spell files.
if (old_lp == NULL && lang != NULL)
{
lp->sl_next = first_lang;
@@ -572,7 +572,7 @@ truncerr:
endFAIL:
if (lang != NULL)
- /* truncating the name signals the error to spell_load_lang() */
+ // truncating the name signals the error to spell_load_lang()
*lang = NUL;
if (lp != NULL && old_lp == NULL)
slang_free(lp);
@@ -609,7 +609,7 @@ tree_count_words(char_u *byts, idx_T *idxs)
{
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.
idxs[arridx[depth]] = wordcount[depth];
if (depth > 0)
wordcount[depth - 1] += wordcount[depth];
@@ -619,18 +619,18 @@ tree_count_words(char_u *byts, idx_T *idxs)
}
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, count it. */
+ // End of word, count it.
++wordcount[depth];
- /* Skip over any other NUL bytes (same word with different
- * flags). */
+ // Skip over any other NUL bytes (same word with different
+ // flags).
while (byts[n + 1] == 0)
{
++n;
@@ -639,7 +639,7 @@ tree_count_words(char_u *byts, idx_T *idxs)
}
else
{
- /* Normal char, go one level deeper to count the words. */
+ // Normal char, go one level deeper to count the words.
++depth;
arridx[depth] = idxs[n];
curi[depth] = 1;
@@ -668,16 +668,16 @@ suggest_load_files(void)
garray_T ga;
int c;
- /* Do this for all languages that support sound folding. */
+ // Do this for all languages that support sound folding.
for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi)
{
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
slang = lp->lp_slang;
if (slang->sl_sugtime != 0 && !slang->sl_sugloaded)
{
- /* Change ".spl" to ".sug" and open the file. When the file isn't
- * found silently skip it. Do set "sl_sugloaded" so that we
- * don't try again and again. */
+ // Change ".spl" to ".sug" and open the file. When the file isn't
+ // found silently skip it. Do set "sl_sugloaded" so that we
+ // don't try again and again.
slang->sl_sugloaded = TRUE;
dotp = vim_strrchr(slang->sl_fname, '.');
@@ -692,14 +692,14 @@ suggest_load_files(void)
* <SUGHEADER>: <fileID> <versionnr> <timestamp>
*/
for (i = 0; i < VIMSUGMAGICL; ++i)
- buf[i] = getc(fd); /* <fileID> */
+ buf[i] = getc(fd); // <fileID>
if (STRNCMP(buf, VIMSUGMAGIC, VIMSUGMAGICL) != 0)
{
semsg(_("E778: This does not look like a .sug file: %s"),
slang->sl_fname);
goto nextone;
}
- c = getc(fd); /* <versionnr> */
+ c = getc(fd); // <versionnr>
if (c < VIMSUGVERSION)
{
semsg(_("E779: Old .sug file, needs to be updated: %s"),
@@ -713,9 +713,9 @@ suggest_load_files(void)
goto nextone;
}
- /* Check the timestamp, it must be exactly the same as the one in
- * the .spl file. Otherwise the word numbers won't match. */
- timestamp = get8ctime(fd); /* <timestamp> */
+ // Check the timestamp, it must be exactly the same as the one in
+ // the .spl file. Otherwise the word numbers won't match.
+ timestamp = get8ctime(fd); // <timestamp>
if (timestamp != slang->sl_sugtime)
{
semsg(_("E781: .sug file doesn't match .spl file: %s"),
@@ -747,20 +747,20 @@ someerror:
slang->sl_sugbuf = open_spellbuf();
if (slang->sl_sugbuf == NULL)
goto someerror;
- /* <sugwcount> */
+ // <sugwcount>
wcount = get4c(fd);
if (wcount < 0)
goto someerror;
- /* Read all the wordnr lists into the buffer, one NUL terminated
- * list per line. */
+ // Read all the wordnr lists into the buffer, one NUL terminated
+ // list per line.
ga_init2(&ga, 1, 100);
for (wordnr = 0; wordnr < wcount; ++wordnr)
{
ga.ga_len = 0;
for (;;)
{
- c = getc(fd); /* <sugline> */
+ c = getc(fd); // <sugline>
if (c < 0 || ga_grow(&ga, 1) == FAIL)
goto someerror;
((char_u *)ga.ga_data)[ga.ga_len++] = c;
@@ -803,7 +803,7 @@ read_cnt_string(FILE *fd, int cnt_bytes, int *cntp)
int i;
char_u *str;
- /* read the length bytes, MSB first */
+ // read the length bytes, MSB first
for (i = 0; i < cnt_bytes; ++i)
cnt = (cnt << 8) + getc(fd);
if (cnt < 0)
@@ -813,7 +813,7 @@ read_cnt_string(FILE *fd, int cnt_bytes, int *cntp)
}
*cntp = cnt;
if (cnt == 0)
- return NULL; /* nothing to read, return NULL */
+ return NULL; // nothing to read, return NULL
str = read_string(fd, cnt);
if (str == NULL)
@@ -833,7 +833,7 @@ read_region_section(FILE *fd, slang_T *lp, int len)
if (len > MAXREGIONS * 2)
return SP_FORMERROR;
for (i = 0; i < len; ++i)
- lp->sl_regions[i] = getc(fd); /* <regionname> */
+ lp->sl_regions[i] = getc(fd); // <regionname>
lp->sl_regions[len] = NUL;
return 0;
}
@@ -850,12 +850,12 @@ read_charflags_section(FILE *fd)
char_u *fol;
int flagslen, follen;
- /* <charflagslen> <charflags> */
+ // <charflagslen> <charflags>
flags = read_cnt_string(fd, 1, &flagslen);
if (flagslen < 0)
return flagslen;
- /* <folcharslen> <folchars> */
+ // <folcharslen> <folchars>
fol = read_cnt_string(fd, 2, &follen);
if (follen < 0)
{
@@ -863,14 +863,14 @@ read_charflags_section(FILE *fd)
return follen;
}
- /* Set the word-char flags and fill SPELL_ISUPPER() table. */
+ // Set the word-char flags and fill SPELL_ISUPPER() table.
if (flags != NULL && fol != NULL)
set_spell_charflags(flags, flagslen, fol);
vim_free(flags);
vim_free(fol);
- /* When <charflagslen> is zero then <fcharlen> must also be zero. */
+ // When <charflagslen> is zero then <fcharlen> must also be zero.
if ((flags == NULL) != (fol == NULL))
return SP_FORMERROR;
return 0;
@@ -889,8 +889,8 @@ read_prefcond_section(FILE *fd, slang_T *lp)
char_u *p;
char_u buf[MAXWLEN + 1];
- /* <prefcondcnt> <prefcond> ... */
- cnt = get2c(fd); /* <prefcondcnt> */
+ // <prefcondcnt> <prefcond> ...
+ cnt = get2c(fd); // <prefcondcnt>
if (cnt <= 0)
return SP_FORMERROR;
@@ -901,19 +901,19 @@ read_prefcond_section(FILE *fd, slang_T *lp)
for (i = 0; i < cnt; ++i)
{
- /* <prefcond> : <condlen> <condstr> */
- n = getc(fd); /* <condlen> */
+ // <prefcond> : <condlen> <condstr>
+ n = getc(fd); // <condlen>
if (n < 0 || n >= MAXWLEN)
return SP_FORMERROR;
- /* When <condlen> is zero we have an empty condition. Otherwise
- * compile the regexp program used to check for the condition. */
+ // When <condlen> is zero we have an empty condition. Otherwise
+ // compile the regexp program used to check for the condition.
if (n > 0)
{
- buf[0] = '^'; /* always match at one position only */
+ buf[0] = '^'; // always match at one position only
p = buf + 1;
while (n-- > 0)
- *p++ = getc(fd); /* <condstr> */
+ *p++ = getc(fd); // <condstr>
*p = NUL;
lp->sl_prefprog[i] = vim_regcomp(buf, RE_MAGIC + RE_STRING);
}
@@ -932,14 +932,14 @@ read_rep_section(FILE *fd, garray_T *gap, short *first)
fromto_T *ftp;
int i;
- cnt = get2c(fd); /* <repcount> */
+ cnt = get2c(fd); // <repcount>
if (cnt < 0)
return SP_TRUNCERROR;
if (ga_grow(gap, cnt) == FAIL)
return SP_OTHERERROR;
- /* <rep> : <repfromlen> <repfrom> <reptolen> <repto> */
+ // <rep> : <repfromlen> <repfrom> <reptolen> <repto>
for (; gap->ga_len < cnt; ++gap->ga_len)
{
ftp = &((fromto_T *)gap->ga_data)[gap->ga_len];
@@ -958,7 +958,7 @@ read_rep_section(FILE *fd, garray_T *gap, short *first)
}
}
- /* Fill the first-index table. */
+ // Fill the first-index table.
for (i = 0; i < 256; ++i)
first[i] = -1;
for (i = 0; i < gap->ga_len; ++i)
@@ -987,7 +987,7 @@ read_sal_section(FILE *fd, slang_T *slang)
slang->sl_sofo = FALSE;
- i = getc(fd); /* <salflags> */
+ i = getc(fd); // <salflags>
if (i & SAL_F0LLOWUP)
slang->sl_followup = TRUE;
if (i & SAL_COLLAPSE)
@@ -995,7 +995,7 @@ read_sal_section(FILE *fd, slang_T *slang)
if (i & SAL_REM_ACCENTS)
slang->sl_rem_accents = TRUE;
- cnt = get2c(fd); /* <salcount> */
+ cnt = get2c(fd); // <salcount>
if (cnt < 0)
return SP_TRUNCERROR;
@@ -1004,21 +1004,21 @@ read_sal_section(FILE *fd, slang_T *slang)
if (ga_grow(gap, cnt + 1) == FAIL)
return SP_OTHERERROR;
- /* <sal> : <salfromlen> <salfrom> <saltolen> <salto> */
+ // <sal> : <salfromlen> <salfrom> <saltolen> <salto>
for (; gap->ga_len < cnt; ++gap->ga_len)
{
smp = &((salitem_T *)gap->ga_data)[gap->ga_len];
- ccnt = getc(fd); /* <salfromlen> */
+ ccnt = getc(fd); // <salfromlen>
if (ccnt < 0)
return SP_TRUNCERROR;
if ((p = alloc(ccnt + 2)) == NULL)
return SP_OTHERERROR;
smp->sm_lead = p;
- /* Read up to the first special char into sm_lead. */
+ // Read up to the first special char into sm_lead.
for (i = 0; i < ccnt; ++i)
{
- c = getc(fd); /* <salfrom> */
+ c = getc(fd); // <salfrom>
if (vim_strchr((char_u *)"0123456789(-<^$", c) != NULL)
break;
*p++ = c;
@@ -1026,13 +1026,13 @@ read_sal_section(FILE *fd, slang_T *slang)
smp->sm_leadlen = (int)(p - smp->sm_lead);
*p++ = NUL;
- /* Put (abc) chars in sm_oneof, if any. */
+ // Put (abc) chars in sm_oneof, if any.
if (c == '(')
{
smp->sm_oneof = p;
for (++i; i < ccnt; ++i)
{
- c = getc(fd); /* <salfrom> */
+ c = getc(fd); // <salfrom>
if (c == ')')
break;
*p++ = c;
@@ -1044,16 +1044,16 @@ read_sal_section(FILE *fd, slang_T *slang)
else
smp->sm_oneof = NULL;
- /* Any following chars go in sm_rules. */
+ // Any following chars go in sm_rules.
smp->sm_rules = p;
if (i < ccnt)
- /* store the char we got while checking for end of sm_lead */
+ // store the char we got while checking for end of sm_lead
*p++ = c;
for (++i; i < ccnt; ++i)
- *p++ = getc(fd); /* <salfrom> */
+ *p++ = getc(fd); // <salfrom>
*p++ = NUL;
- /* <saltolen> <salto> */
+ // <saltolen> <salto>
smp->sm_to = read_cnt_string(fd, 1, &ccnt);
if (ccnt < 0)
{
@@ -1063,7 +1063,7 @@ read_sal_section(FILE *fd, slang_T *slang)
if (has_mbyte)
{
- /* convert the multi-byte strings to wide char strings */
+ // convert the multi-byte strings to wide char strings
smp->sm_lead_w = mb_str2wide(smp->sm_lead);
smp->sm_leadlen = mb_charlen(smp->sm_lead);
if (smp->sm_oneof == NULL)
@@ -1090,8 +1090,8 @@ read_sal_section(FILE *fd, slang_T *slang)
if (gap->ga_len > 0)
{
- /* Add one extra entry to mark the end with an empty sm_lead. Avoids
- * that we need to check the index every time. */
+ // Add one extra entry to mark the end with an empty sm_lead. Avoids
+ // that we need to check the index every time.
smp = &((salitem_T *)gap->ga_data)[gap->ga_len];
if ((p = alloc(1)) == NULL)
return SP_OTHERERROR;
@@ -1111,7 +1111,7 @@ read_sal_section(FILE *fd, slang_T *slang)
++gap->ga_len;
}
- /* Fill the first-index table. */
+ // Fill the first-index table.
set_sal_first(slang);
return 0;
@@ -1131,7 +1131,7 @@ read_words_section(FILE *fd, slang_T *lp, int len)
while (done < len)
{
- /* Read one word at a time. */
+ // Read one word at a time.
for (i = 0; ; ++i)
{
c = getc(fd);
@@ -1144,7 +1144,7 @@ read_words_section(FILE *fd, slang_T *lp, int len)
return SP_FORMERROR;
}
- /* Init the count to 10. */
+ // Init the count to 10.
count_common_word(lp, word, -1, 10);
done += i + 1;
}
@@ -1164,12 +1164,12 @@ read_sofo_section(FILE *fd, slang_T *slang)
slang->sl_sofo = TRUE;
- /* <sofofromlen> <sofofrom> */
+ // <sofofromlen> <sofofrom>
from = read_cnt_string(fd, 2, &cnt);
if (cnt < 0)
return cnt;
- /* <sofotolen> <sofoto> */
+ // <sofotolen> <sofoto>
to = read_cnt_string(fd, 2, &cnt);
if (cnt < 0)
{
@@ -1177,11 +1177,11 @@ read_sofo_section(FILE *fd, slang_T *slang)
return cnt;
}
- /* Store the info in slang->sl_sal and/or slang->sl_sal_first. */
+ // Store the info in slang->sl_sal and/or slang->sl_sal_first.
if (from != NULL && to != NULL)
res = set_sofo(slang, from, to);
else if (from != NULL || to != NULL)
- res = SP_FORMERROR; /* only one of two strings is an error */
+ res = SP_FORMERROR; // only one of two strings is an error
else
res = 0;
@@ -1210,38 +1210,38 @@ read_compound(FILE *fd, slang_T *slang, int len)
garray_T *gap;
if (todo < 2)
- return SP_FORMERROR; /* need at least two bytes */
+ return SP_FORMERROR; // need at least two bytes
--todo;
- c = getc(fd); /* <compmax> */
+ c = getc(fd); // <compmax>
if (c < 2)
c = MAXWLEN;
slang->sl_compmax = c;
--todo;
- c = getc(fd); /* <compminlen> */
+ c = getc(fd); // <compminlen>
if (c < 1)
c = 0;
slang->sl_compminlen = c;
--todo;
- c = getc(fd); /* <compsylmax> */
+ c = getc(fd); // <compsylmax>
if (c < 1)
c = MAXWLEN;
slang->sl_compsylmax = c;
- c = getc(fd); /* <compoptions> */
+ c = getc(fd); // <compoptions>
if (c != 0)
- ungetc(c, fd); /* be backwards compatible with Vim 7.0b */
+ ungetc(c, fd); // be backwards compatible with Vim 7.0b
else
{
--todo;
- c = getc(fd); /* only use the lower byte for now */
+ c = getc(fd); // only use the lower byte for now
--todo;
slang->sl_compoptions = c;
gap = &slang->sl_comppat;
- c = get2c(fd); /* <comppatcount> */
+ c = get2c(fd); // <comppatcount>
todo -= 2;
ga_init2(gap, sizeof(char_u *), c);
if (ga_grow(gap, c) == OK)
@@ -1249,7 +1249,7 @@ read_compound(FILE *fd, slang_T *slang, int len)
{
((char_u **)(gap->ga_data))[gap->ga_len++] =
read_cnt_string(fd, 1, &cnt);
- /* <comppatlen> <comppattext> */
+ // <comppatlen> <comppattext>
if (cnt < 0)
return cnt;
todo -= cnt + 1;
@@ -1258,10 +1258,10 @@ read_compound(FILE *fd, slang_T *slang, int len)
if (todo < 0)
return SP_FORMERROR;
- /* Turn the COMPOUNDRULE items into a regexp pattern:
- * "a[bc]/a*b+" -> "^\(a[bc]\|a*b\+\)$".
- * Inserting backslashes may double the length, "^\(\)$<Nul>" is 7 bytes.
- * Conversion to utf-8 may double the size. */
+ // Turn the COMPOUNDRULE items into a regexp pattern:
+ // "a[bc]/a*b+" -> "^\(a[bc]\|a*b\+\)$".
+ // Inserting backslashes may double the length, "^\(\)$<Nul>" is 7 bytes.
+ // Conversion to utf-8 may double the size.
c = todo * 2 + 7;
if (enc_utf8)
c += todo * 2;
@@ -1269,8 +1269,8 @@ read_compound(FILE *fd, slang_T *slang, int len)
if (pat == NULL)
return SP_OTHERERROR;
- /* We also need a list of all flags that can appear at the start and one
- * for all flags. */
+ // We also need a list of all flags that can appear at the start and one
+ // for all flags.
cp = alloc(todo + 1);
if (cp == NULL)
{
@@ -1289,9 +1289,9 @@ read_compound(FILE *fd, slang_T *slang, int len)
slang->sl_compallflags = ap;
*ap = NUL;
- /* And a list of all patterns in their original form, for checking whether
- * compounding may work in match_compoundrule(). This is freed when we
- * encounter a wildcard, the check doesn't work then. */
+ // And a list of all patterns in their original form, for checking whether
+ // compounding may work in match_compoundrule(). This is freed when we
+ // encounter a wildcard, the check doesn't work then.
crp = alloc(todo + 1);
slang->sl_comprules = crp;
@@ -1303,14 +1303,14 @@ read_compound(FILE *fd, slang_T *slang, int len)
atstart = 1;
while (todo-- > 0)
{
- c = getc(fd); /* <compflags> */
+ c = getc(fd); // <compflags>
if (c == EOF)
{
vim_free(pat);
return SP_TRUNCERROR;
}
- /* Add all flags to "sl_compallflags". */
+ // Add all flags to "sl_compallflags".
if (vim_strchr((char_u *)"?*+[]/", c) == NULL
&& !byte_in_str(slang->sl_compallflags, c))
{
@@ -1320,8 +1320,8 @@ read_compound(FILE *fd, slang_T *slang, int len)
if (atstart != 0)
{
- /* At start of item: copy flags to "sl_compstartflags". For a
- * [abc] item set "atstart" to 2 and copy up to the ']'. */
+ // At start of item: copy flags to "sl_compstartflags". For a
+ // [abc] item set "atstart" to 2 and copy up to the ']'.
if (c == '[')
atstart = 2;
else if (c == ']')
@@ -1338,7 +1338,7 @@ read_compound(FILE *fd, slang_T *slang, int len)
}
}
- /* Copy flag to "sl_comprules", unless we run into a wildcard. */
+ // Copy flag to "sl_comprules", unless we run into a wildcard.
if (crp != NULL)
{
if (c == '?' || c == '+' || c == '*')
@@ -1350,16 +1350,16 @@ read_compound(FILE *fd, slang_T *slang, int len)
*crp++ = c;
}
- if (c == '/') /* slash separates two items */
+ if (c == '/') // slash separates two items
{
*pp++ = '\\';
*pp++ = '|';
atstart = 1;
}
- else /* normal char, "[abc]" and '*' are copied as-is */
+ else // normal char, "[abc]" and '*' are copied as-is
{
if (c == '?' || c == '+' || c == '~')
- *pp++ = '\\'; /* "a?" becomes "a\?", "a+" becomes "a\+" */
+ *pp++ = '\\'; // "a?" becomes "a\?", "a+" becomes "a\+"
if (enc_utf8)
pp += mb_char2bytes(c, pp);
else
@@ -1400,10 +1400,10 @@ set_sofo(slang_T *lp, char_u *from, char_u *to)
if (has_mbyte)
{
- /* Use "sl_sal" as an array with 256 pointers to a list of wide
- * characters. The index is the low byte of the character.
- * The list contains from-to pairs with a terminating NUL.
- * sl_sal_first[] is used for latin1 "from" characters. */
+ // Use "sl_sal" as an array with 256 pointers to a list of wide
+ // characters. The index is the low byte of the character.
+ // The list contains from-to pairs with a terminating NUL.
+ // sl_sal_first[] is used for latin1 "from" characters.
gap = &lp->sl_sal;
ga_init2(gap, sizeof(int *), 1);
if (ga_grow(gap, 256) == FAIL)
@@ -1411,8 +1411,8 @@ set_sofo(slang_T *lp, char_u *from, char_u *to)
vim_memset(gap->ga_data, 0, sizeof(int *) * 256);
gap->ga_len = 256;
- /* First count the number of items for each list. Temporarily use
- * sl_sal_first[] for this. */
+ // First count the number of items for each list. Temporarily use
+ // sl_sal_first[] for this.
for (p = from, s = to; *p != NUL && *s != NUL; )
{
c = mb_cptr2char_adv(&p);
@@ -1420,10 +1420,10 @@ set_sofo(slang_T *lp, char_u *from, char_u *to)
if (c >= 256)
++lp->sl_sal_first[c & 0xff];
}
- if (*p != NUL || *s != NUL) /* lengths differ */
+ if (*p != NUL || *s != NUL) // lengths differ
return SP_FORMERROR;
- /* Allocate the lists. */
+ // Allocate the lists.
for (i = 0; i < 256; ++i)
if (lp->sl_sal_first[i] > 0)
{
@@ -1434,8 +1434,8 @@ set_sofo(slang_T *lp, char_u *from, char_u *to)
*(int *)p = 0;
}
- /* Put the characters up to 255 in sl_sal_first[] the rest in a sl_sal
- * list. */
+ // Put the characters up to 255 in sl_sal_first[] the rest in a sl_sal
+ // list.
vim_memset(lp->sl_sal_first, 0, sizeof(salfirst_T) * 256);
for (p = from, s = to; *p != NUL && *s != NUL; )
{
@@ -1443,29 +1443,29 @@ set_sofo(slang_T *lp, char_u *from, char_u *to)
i = mb_cptr2char_adv(&s);
if (c >= 256)
{
- /* Append the from-to chars at the end of the list with
- * the low byte. */
+ // Append the from-to chars at the end of the list with
+ // the low byte.
inp = ((int **)gap->ga_data)[c & 0xff];
while (*inp != 0)
++inp;
- *inp++ = c; /* from char */
- *inp++ = i; /* to char */
- *inp++ = NUL; /* NUL at the end */
+ *inp++ = c; // from char
+ *inp++ = i; // to char
+ *inp++ = NUL; // NUL at the end
}
else
- /* mapping byte to char is done in sl_sal_first[] */
+ // mapping byte to char is done in sl_sal_first[]
lp->sl_sal_first[c] = i;
}
}
else
{
- /* mapping bytes to bytes is done in sl_sal_first[] */
+ // mapping bytes to bytes is done in sl_sal_first[]
if (STRLEN(from) != STRLEN(to))
return SP_FORMERROR;
for (i = 0; to[i] != NUL; ++i)
lp->sl_sal_first[from[i]] = to[i];
- lp->sl_sal.ga_len = 1; /* indicates we have soundfolding */
+ lp->sl_sal.ga_len = 1; // indicates we have soundfolding
}
return 0;
@@ -1490,9 +1490,9 @@ set_sal_first(slang_T *lp)
for (i = 0; i < gap->ga_len; ++i)
{
if (has_mbyte)
- /* Use the lowest byte of the first character. For latin1 it's
- * the character, for other encodings it should differ for most
- * characters. */
+ // Use the lowest byte of the first character. For latin1 it's
+ // the character, for other encodings it should differ for most
+ // characters.
c = *smp[i].sm_lead_w & 0xff;
else
c = *smp[i].sm_lead;
@@ -1503,12 +1503,12 @@ set_sal_first(slang_T *lp)
{
int n;
- /* Make sure all entries with this byte are following each
- * other. Move the ones that are in the wrong position. Do
- * keep the same ordering! */
+ // Make sure all entries with this byte are following each
+ // other. Move the ones that are in the wrong position. Do
+ // keep the same ordering!
while (i + 1 < gap->ga_len
&& (*smp[i + 1].sm_lead_w & 0xff) == c)
- /* Skip over entry with same index byte. */
+ // Skip over entry with same index byte.
++i;
for (n = 1; i + n < gap->ga_len; ++n)
@@ -1516,8 +1516,8 @@ set_sal_first(slang_T *lp)
{
salitem_T tsal;
- /* Move entry with same index byte after the entries
- * we already found. */
+ // Move entry with same index byte after the entries
+ // we already found.
++i;
--n;
tsal = smp[i + n];
@@ -1562,37 +1562,37 @@ spell_read_tree(
FILE *fd,
char_u **bytsp,
idx_T **idxsp,
- int prefixtree, /* TRUE for the prefix tree */
- int prefixcnt) /* when "prefixtree" is TRUE: prefix count */
+ int prefixtree, // TRUE for the prefix tree
+ int prefixcnt) // when "prefixtree" is TRUE: prefix count
{
long len;
int idx;
char_u *bp;
idx_T *ip;
- /* The tree size was computed when writing the file, so that we can
- * allocate it as one long block. <nodecount> */
+ // The tree size was computed when writing the file, so that we can
+ // allocate it as one long block. <nodecount>
len = get4c(fd);
if (len < 0)
return SP_TRUNCERROR;
if (len >= LONG_MAX / (long)sizeof(int))
- /* Invalid length, multiply with sizeof(int) would overflow. */
+ // Invalid length, multiply with sizeof(int) would overflow.
return SP_FORMERROR;
if (len > 0)
{
- /* Allocate the byte array. */
+ // Allocate the byte array.
bp = alloc(len);
if (bp == NULL)
return SP_OTHERERROR;
*bytsp = bp;
- /* Allocate the index array. */
+ // Allocate the index array.
ip = lalloc_clear(len * sizeof(int), TRUE);
if (ip == NULL)
return SP_OTHERERROR;
*idxsp = ip;
- /* Recursively read the tree and store it in the array. */
+ // Recursively read the tree and store it in the array.
idx = read_tree_node(fd, bp, ip, len, 0, prefixtree, prefixcnt);
if (idx < 0)
return idx;
@@ -1615,10 +1615,10 @@ read_tree_node(
FILE *fd,
char_u *byts,
idx_T *idxs,
- int maxidx, /* size of arrays */
- idx_T startidx, /* current index in "byts" and "idxs" */
- int prefixtree, /* TRUE for reading PREFIXTREE */
- int maxprefcondnr) /* maximum for <prefcondnr> */
+ int maxidx, // size of arrays
+ idx_T startidx, // current index in "byts" and "idxs"
+ int prefixtree, // TRUE for reading PREFIXTREE
+ int maxprefcondnr) // maximum for <prefcondnr>
{
int len;
int i;
@@ -1628,7 +1628,7 @@ read_tree_node(
int c2;
#define SHARED_MASK 0x8000000
- len = getc(fd); /* <siblingcount> */
+ len = getc(fd); // <siblingcount>
if (len <= 0)
return SP_TRUNCERROR;
@@ -1636,17 +1636,17 @@ read_tree_node(
return SP_FORMERROR;
byts[idx++] = len;
- /* Read the byte values, flag/region bytes and shared indexes. */
+ // Read the byte values, flag/region bytes and shared indexes.
for (i = 1; i <= len; ++i)
{
- c = getc(fd); /* <byte> */
+ c = getc(fd); // <byte>
if (c < 0)
return SP_TRUNCERROR;
if (c <= BY_SPECIAL)
{
if (c == BY_NOFLAGS && !prefixtree)
{
- /* No flags, all regions. */
+ // No flags, all regions.
idxs[idx] = 0;
c = 0;
}
@@ -1654,56 +1654,56 @@ read_tree_node(
{
if (prefixtree)
{
- /* Read the optional pflags byte, the prefix ID and the
- * condition nr. In idxs[] store the prefix ID in the low
- * byte, the condition index shifted up 8 bits, the flags
- * shifted up 24 bits. */
+ // Read the optional pflags byte, the prefix ID and the
+ // condition nr. In idxs[] store the prefix ID in the low
+ // byte, the condition index shifted up 8 bits, the flags
+ // shifted up 24 bits.
if (c == BY_FLAGS)
- c = getc(fd) << 24; /* <pflags> */
+ c = getc(fd) << 24; // <pflags>
else
c = 0;
- c |= getc(fd); /* <affixID> */
+ c |= getc(fd); // <affixID>
- n = get2c(fd); /* <prefcondnr> */
+ n = get2c(fd); // <prefcondnr>
if (n >= maxprefcondnr)
return SP_FORMERROR;
c |= (n << 8);
}
- else /* c must be BY_FLAGS or BY_FLAGS2 */
+ else // c must be BY_FLAGS or BY_FLAGS2
{
- /* Read flags and optional region and prefix ID. In
- * idxs[] the flags go in the low two bytes, region above
- * that and prefix ID above the region. */
+ // Read flags and optional region and prefix ID. In
+ // idxs[] the flags go in the low two bytes, region above
+ // that and prefix ID above the region.
c2 = c;
- c = getc(fd); /* <flags> */
+ c = getc(fd); // <flags>
if (c2 == BY_FLAGS2)
- c = (getc(fd) << 8) + c; /* <flags2> */
+ c = (getc(fd) << 8) + c; // <flags2>
if (c & WF_REGION)
- c = (getc(fd) << 16) + c; /* <region> */
+ c = (getc(fd) << 16) + c; // <region>
if (c & WF_AFX)
- c = (getc(fd) << 24) + c; /* <affixID> */
+ c = (getc(fd) << 24) + c; // <affixID>
}
idxs[idx] = c;
c = 0;
}
- else /* c == BY_INDEX */
+ else // c == BY_INDEX
{
- /* <nodeidx> */
+ // <nodeidx>
n = get3c(fd);
if (n < 0 || n >= maxidx)
return SP_FORMERROR;
idxs[idx] = n + SHARED_MASK;
- c = getc(fd); /* <xbyte> */
+ c = getc(fd); // <xbyte>
}
}
byts[idx++] = c;
}
- /* Recursively read the children for non-shared siblings.
- * Skip the end-of-word ones (zero byte value) and the shared ones (and
- * remove SHARED_MASK) */
+ // Recursively read the children for non-shared siblings.
+ // Skip the end-of-word ones (zero byte value) and the shared ones (and
+ // remove SHARED_MASK)
for (i = 1; i <= len; ++i)
if (byts[startidx + i] != 0)
{
@@ -1728,7 +1728,7 @@ read_tree_node(
static void
spell_reload_one(
char_u *fname,
- int added_word) /* invoked through "zg" */
+ int added_word) // invoked through "zg"
{
slang_T *slang;
int didit = FALSE;
@@ -1739,15 +1739,15 @@ spell_reload_one(
{
slang_clear(slang);
if (spell_load_file(fname, NULL, slang, FALSE) == NULL)
- /* reloading failed, clear the language */
+ // reloading failed, clear the language
slang_clear(slang);
redraw_all_later(SOME_VALID);
didit = TRUE;
}
}
- /* When "zg" was used and the file wasn't loaded yet, should redo
- * 'spelllang' to load it now. */
+ // When "zg" was used and the file wasn't loaded yet, should redo
+ // 'spelllang' to load it now.
if (added_word && !didit)
did_set_spelllang(curwin);
}
@@ -1757,73 +1757,73 @@ spell_reload_one(
* Functions for ":mkspell".
*/
-#define MAXLINELEN 500 /* Maximum length in bytes of a line in a .aff
- and .dic file. */
+#define MAXLINELEN 500 // Maximum length in bytes of a line in a .aff
+ // and .dic file.
/*
* Main structure to store the contents of a ".aff" file.
*/
typedef struct afffile_S
{
- char_u *af_enc; /* "SET", normalized, alloc'ed string or NULL */
- int af_flagtype; /* AFT_CHAR, AFT_LONG, AFT_NUM or AFT_CAPLONG */
- unsigned af_rare; /* RARE ID for rare word */
- unsigned af_keepcase; /* KEEPCASE ID for keep-case word */
- unsigned af_bad; /* BAD ID for banned word */
- unsigned af_needaffix; /* NEEDAFFIX ID */
- unsigned af_circumfix; /* CIRCUMFIX ID */
- unsigned af_needcomp; /* NEEDCOMPOUND ID */
- unsigned af_comproot; /* COMPOUNDROOT ID */
- unsigned af_compforbid; /* COMPOUNDFORBIDFLAG ID */
- unsigned af_comppermit; /* COMPOUNDPERMITFLAG ID */
- unsigned af_nosuggest; /* NOSUGGEST ID */
- int af_pfxpostpone; /* postpone prefixes without chop string and
- without flags */
- int af_ignoreextra; /* IGNOREEXTRA present */
- hashtab_T af_pref; /* hashtable for prefixes, affheader_T */
- hashtab_T af_suff; /* hashtable for suffixes, affheader_T */
- hashtab_T af_comp; /* hashtable for compound flags, compitem_T */
+ char_u *af_enc; // "SET", normalized, alloc'ed string or NULL
+ int af_flagtype; // AFT_CHAR, AFT_LONG, AFT_NUM or AFT_CAPLONG
+ unsigned af_rare; // RARE ID for rare word
+ unsigned af_keepcase; // KEEPCASE ID for keep-case word
+ unsigned af_bad; // BAD ID for banned word
+ unsigned af_needaffix; // NEEDAFFIX ID
+ unsigned af_circumfix; // CIRCUMFIX ID
+ unsigned af_needcomp; // NEEDCOMPOUND ID
+ unsigned af_comproot; // COMPOUNDROOT ID
+ unsigned af_compforbid; // COMPOUNDFORBIDFLAG ID
+ unsigned af_comppermit; // COMPOUNDPERMITFLAG ID
+ unsigned af_nosuggest; // NOSUGGEST ID
+ int af_pfxpostpone; // postpone prefixes without chop string and
+ // without flags
+ int af_ignoreextra; // IGNOREEXTRA present
+ hashtab_T af_pref; // hashtable for prefixes, affheader_T
+ hashtab_T af_suff; // hashtable for suffixes, affheader_T
+ hashtab_T af_comp; // hashtable for compound flags, compitem_T
} afffile_T;
-#define AFT_CHAR 0 /* flags are one character */
-#define AFT_LONG 1 /* flags are two characters */
-#define AFT_CAPLONG 2 /* flags are one or two characters */
-#define AFT_NUM 3 /* flags are numbers, comma separated */
+#define AFT_CHAR 0 // flags are one character
+#define AFT_LONG 1 // flags are two characters
+#define AFT_CAPLONG 2 // flags are one or two characters
+#define AFT_NUM 3 // flags are numbers, comma separated
typedef struct affentry_S affentry_T;
-/* Affix entry from ".aff" file. Used for prefixes and suffixes. */
+// Affix entry from ".aff" file. Used for prefixes and suffixes.
struct affentry_S
{
- affentry_T *ae_next; /* next affix with same name/number */
- char_u *ae_chop; /* text to chop off basic word (can be NULL) */
- char_u *ae_add; /* text to add to basic word (can be NULL) */
- char_u *ae_flags; /* flags on the affix (can be NULL) */
- char_u *ae_cond; /* condition (NULL for ".") */
- regprog_T *ae_prog; /* regexp program for ae_cond or NULL */
- char ae_compforbid; /* COMPOUNDFORBIDFLAG found */
- char ae_comppermit; /* COMPOUNDPERMITFLAG found */
+ affentry_T *ae_next; // next affix with same name/number
+ char_u *ae_chop; // text to chop off basic word (can be NULL)
+ char_u *ae_add; // text to add to basic word (can be NULL)
+ char_u *ae_flags; // flags on the affix (can be NULL)
+ char_u *ae_cond; // condition (NULL for ".")
+ regprog_T *ae_prog; // regexp program for ae_cond or NULL
+ char ae_compforbid; // COMPOUNDFORBIDFLAG found
+ char ae_comppermit; // COMPOUNDPERMITFLAG found
};
-#define AH_KEY_LEN 17 /* 2 x 8 bytes + NUL */
+#define AH_KEY_LEN 17 // 2 x 8 bytes + NUL
-/* Affix header from ".aff" file. Used for af_pref and af_suff. */
+// Affix header from ".aff" file. Used for af_pref and af_suff.
typedef struct affheader_S
{
- char_u ah_key[AH_KEY_LEN]; /* key for hashtab == name of affix */
- unsigned ah_flag; /* affix name as number, uses "af_flagtype" */
- int ah_newID; /* prefix ID after renumbering; 0 if not used */
- int ah_combine; /* suffix may combine with prefix */
- int ah_follows; /* another affix block should be following */
- affentry_T *ah_first; /* first affix entry */
+ char_u ah_key[AH_KEY_LEN]; // key for hashtab == name of affix
+ unsigned ah_flag; // affix name as number, uses "af_flagtype"
+ int ah_newID; // prefix ID after renumbering; 0 if not used
+ int ah_combine; // suffix may combine with prefix
+ int ah_follows; // another affix block should be following
+ affentry_T *ah_first; // first affix entry
} affheader_T;
#define HI2AH(hi) ((affheader_T *)(hi)->hi_key)
-/* Flag used in compound items. */
+// Flag used in compound items.
typedef struct compitem_S
{
- char_u ci_key[AH_KEY_LEN]; /* key for hashtab == name of compound */
- unsigned ci_flag; /* affix name as number, uses "af_flagtype" */
- int ci_newID; /* affix ID after renumbering. */
+ char_u ci_key[AH_KEY_LEN]; // key for hashtab == name of compound
+ unsigned ci_flag; // affix name as number, uses "af_flagtype"
+ int ci_newID; // affix ID after renumbering.
} compitem_T;
#define HI2CI(hi) ((compitem_T *)(hi)->hi_key)
@@ -1836,13 +1836,13 @@ typedef struct compitem_S
* "sb_data" is correct for systems where pointers must be aligned on
* pointer-size boundaries and sizeof(pointer) > sizeof(int) (e.g., Sparc).
*/
-#define SBLOCKSIZE 16000 /* size of sb_data */
+#define SBLOCKSIZE 16000 // size of sb_data
typedef struct sblock_S sblock_T;
struct sblock_S
{
- int sb_used; /* nr of bytes already in use */
- sblock_T *sb_next; /* next block in list */
- char_u sb_data[1]; /* data, actually longer */
+ int sb_used; // nr of bytes already in use
+ sblock_T *sb_next; // next block in list
+ char_u sb_data[1]; // data, actually longer
};
/*
@@ -1851,40 +1851,40 @@ struct sblock_S
typedef struct wordnode_S wordnode_T;
struct wordnode_S
{
- union /* shared to save space */
+ union // shared to save space
{
- char_u hashkey[6]; /* the hash key, only used while compressing */
- int index; /* index in written nodes (valid after first
- round) */
+ char_u hashkey[6]; // the hash key, only used while compressing
+ int index; // index in written nodes (valid after first
+ // round)
} wn_u1;
- union /* shared to save space */
+ union // shared to save space
{
- wordnode_T *next; /* next node with same hash key */
- wordnode_T *wnode; /* parent node that will write this node */
+ wordnode_T *next; // next node with same hash key
+ wordnode_T *wnode; // parent node that will write this node
} wn_u2;
- wordnode_T *wn_child; /* child (next byte in word) */
- wordnode_T *wn_sibling; /* next sibling (alternate byte in word,
- always sorted) */
- int wn_refs; /* Nr. of references to this node. Only
- relevant for first node in a list of
- siblings, in following siblings it is
- always one. */
- char_u wn_byte; /* Byte for this node. NUL for word end */
-
- /* Info for when "wn_byte" is NUL.
- * In PREFIXTREE "wn_region" is used for the prefcondnr.
- * In the soundfolded word tree "wn_flags" has the MSW of the wordnr and
- * "wn_region" the LSW of the wordnr. */
- char_u wn_affixID; /* supported/required prefix ID or 0 */
- short_u wn_flags; /* WF_ flags */
- short wn_region; /* region mask */
+ wordnode_T *wn_child; // child (next byte in word)
+ wordnode_T *wn_sibling; // next sibling (alternate byte in word,
+ // always sorted)
+ int wn_refs; // Nr. of references to this node. Only
+ // relevant for first node in a list of
+ // siblings, in following siblings it is
+ // always one.
+ char_u wn_byte; // Byte for this node. NUL for word end
+
+ // Info for when "wn_byte" is NUL.
+ // In PREFIXTREE "wn_region" is used for the prefcondnr.
+ // In the soundfolded word tree "wn_flags" has the MSW of the wordnr and
+ // "wn_region" the LSW of the wordnr.
+ char_u wn_affixID; // supported/required prefix ID or 0
+ short_u wn_flags; // WF_ flags
+ short wn_region; // region mask
#ifdef SPELL_PRINTTREE
- int wn_nr; /* sequence nr for printing */
+ int wn_nr; // sequence nr for printing
#endif
};
-#define WN_MASK 0xffff /* mask relevant bits of "wn_flags" */
+#define WN_MASK 0xffff // mask relevant bits of "wn_flags"
#define HI2WN(hi) (wordnode_T *)((hi)->hi_key)
@@ -1893,73 +1893,73 @@ struct wordnode_S
*/
typedef struct spellinfo_S
{
- wordnode_T *si_foldroot; /* tree with case-folded words */
- long si_foldwcount; /* nr of words in si_foldroot */
+ wordnode_T *si_foldroot; // tree with case-folded words
+ long si_foldwcount; // nr of words in si_foldroot
- wordnode_T *si_keeproot; /* tree with keep-case words */
- long si_keepwcount; /* nr of words in si_keeproot */
+ wordnode_T *si_keeproot; // tree with keep-case words
+ long si_keepwcount; // nr of words in si_keeproot
- wordnode_T *si_prefroot; /* tree with postponed prefixes */
+ wordnode_T *si_prefroot; // tree with postponed prefixes
- long si_sugtree; /* creating the soundfolding trie */
+ long si_sugtree; // creating the soundfolding trie
- sblock_T *si_blocks; /* memory blocks used */
- long si_blocks_cnt; /* memory blocks allocated */
- int si_did_emsg; /* TRUE when ran out of memory */
+ sblock_T *si_blocks; // memory blocks used
+ long si_blocks_cnt; // memory blocks allocated
+ int si_did_emsg; // TRUE when ran out of memory
- long si_compress_cnt; /* words to add before lowering
- compression limit */
- wordnode_T *si_first_free; /* List of nodes that have been freed during
- compression, linked by "wn_child" field. */
- long si_free_count; /* number of nodes in si_first_free */
+ long si_compress_cnt; // words to add before lowering
+ // compression limit
+ wordnode_T *si_first_free; // List of nodes that have been freed during
+ // compression, linked by "wn_child" field.
+ long si_free_count; // number of nodes in si_first_free
#ifdef SPELL_PRINTTREE
- int si_wordnode_nr; /* sequence nr for nodes */
+ int si_wordnode_nr; // sequence nr for nodes
#endif
- buf_T *si_spellbuf; /* buffer used to store soundfold word table */
-
- int si_ascii; /* handling only ASCII words */
- int si_add; /* addition file */
- int si_clear_chartab; /* when TRUE clear char tables */
- int si_region; /* region mask */
- vimconv_T si_conv; /* for conversion to 'encoding' */
- int si_memtot; /* runtime memory used */
- int si_verbose; /* verbose messages */
- int si_msg_count; /* number of words added since last message */
- char_u *si_info; /* info text chars or NULL */
- int si_region_count; /* number of regions supported (1 when there
- are no regions) */
+ buf_T *si_spellbuf; // buffer used to store soundfold word table
+
+ int si_ascii; // handling only ASCII words
+ int si_add; // addition file
+ int si_clear_chartab; // when TRUE clear char tables
+ int si_region; // region mask
+ vimconv_T si_conv; // for conversion to 'encoding'
+ int si_memtot; // runtime memory used
+ int si_verbose; // verbose messages
+ int si_msg_count; // number of words added since last message
+ char_u *si_info; // info text chars or NULL
+ int si_region_count; // number of regions supported (1 when there
+ // are no regions)
char_u si_region_name[MAXREGIONS * 2 + 1];
- /* region names; used only if
- * si_region_count > 1) */
-
- garray_T si_rep; /* list of fromto_T entries from REP lines */
- garray_T si_repsal; /* list of fromto_T entries from REPSAL lines */
- garray_T si_sal; /* list of fromto_T entries from SAL lines */
- char_u *si_sofofr; /* SOFOFROM text */
- char_u *si_sofoto; /* SOFOTO text */
- int si_nosugfile; /* NOSUGFILE item found */
- int si_nosplitsugs; /* NOSPLITSUGS item found */
- int si_nocompoundsugs; /* NOCOMPOUNDSUGS item found */
- int si_followup; /* soundsalike: ? */
- int si_collapse; /* soundsalike: ? */
- hashtab_T si_commonwords; /* hashtable for common words */
- time_t si_sugtime; /* timestamp for .sug file */
- int si_rem_accents; /* soundsalike: remove accents */
- garray_T si_map; /* MAP info concatenated */
- char_u *si_midword; /* MIDWORD chars or NULL */
- int si_compmax; /* max nr of words for compounding */
- int si_compminlen; /* minimal length for compounding */
- int si_compsylmax; /* max nr of syllables for compounding */
- int si_compoptions; /* COMP_ flags */
- garray_T si_comppat; /* CHECKCOMPOUNDPATTERN items, each stored as
- a string */
- char_u *si_compflags; /* flags used for compounding */
- char_u si_nobreak; /* NOBREAK */
- char_u *si_syllable; /* syllable string */
- garray_T si_prefcond; /* table with conditions for postponed
- * prefixes, each stored as a string */
- int si_newprefID; /* current value for ah_newID */
- int si_newcompID; /* current value for compound ID */
+ // region names; used only if
+ // si_region_count > 1)
+
+ garray_T si_rep; // list of fromto_T entries from REP lines
+ garray_T si_repsal; // list of fromto_T entries from REPSAL lines
+ garray_T si_sal; // list of fromto_T entries from SAL lines
+ char_u *si_sofofr; // SOFOFROM text
+ char_u *si_sofoto; // SOFOTO text
+ int si_nosugfile; // NOSUGFILE item found
+ int si_nosplitsugs; // NOSPLITSUGS item found
+ int si_nocompoundsugs; // NOCOMPOUNDSUGS item found
+ int si_followup; // soundsalike: ?
+ int si_collapse; // soundsalike: ?
+ hashtab_T si_commonwords; // hashtable for common words
+ time_t si_sugtime; // timestamp for .sug file
+ int si_rem_accents; // soundsalike: remove accents
+ garray_T si_map; // MAP info concatenated
+ char_u *si_midword; // MIDWORD chars or NULL
+ int si_compmax; // max nr of words for compounding
+ int si_compminlen; // minimal length for compounding
+ int si_compsylmax; // max nr of syllables for compounding
+ int si_compoptions; // COMP_ flags
+ garray_T si_comppat; // CHECKCOMPOUNDPATTERN items, each stored as
+ // a string
+ char_u *si_compflags; // flags used for compounding
+ char_u si_nobreak; // NOBREAK
+ char_u *si_syllable; // syllable string
+ garray_T si_prefcond; // table with conditions for postponed
+ // prefixes, each stored as a string
+ int si_newprefID; // current value for ah_newID
+ int si_newcompID; // current value for compound ID
} spellinfo_T;
static int is_aff_rule(char_u **items, int itemcnt, char *rulename, int mincount);
@@ -1997,23 +1997,23 @@ static void sug_write(spellinfo_T *spin, char_u *fname);
static void spell_message(spellinfo_T *spin, char_u *str);
static void init_spellfile(void);
-/* In the postponed prefixes tree wn_flags is used to store the WFP_ flags,
- * but it must be negative to indicate the prefix tree to tree_add_word().
- * Use a negative number with the lower 8 bits zero. */
+// In the postponed prefixes tree wn_flags is used to store the WFP_ flags,
+// but it must be negative to indicate the prefix tree to tree_add_word().
+// Use a negative number with the lower 8 bits zero.
#define PFX_FLAGS -256
-/* flags for "condit" argument of store_aff_word() */
-#define CONDIT_COMB 1 /* affix must combine */
-#define CONDIT_CFIX 2 /* affix must have CIRCUMFIX flag */
-#define CONDIT_SUF 4 /* add a suffix for matching flags */
-#define CONDIT_AFF 8 /* word already has an affix */
+// flags for "condit" argument of store_aff_word()
+#define CONDIT_COMB 1 // affix must combine
+#define CONDIT_CFIX 2 // affix must have CIRCUMFIX flag
+#define CONDIT_SUF 4 // add a suffix for matching flags
+#define CONDIT_AFF 8 // word already has an affix
/*
* Tunable parameters for when the tree is compressed. See 'mkspellmem'.
*/
-static long compress_start = 30000; /* memory / SBLOCKSIZE */
-static long compress_inc = 100; /* memory / SBLOCKSIZE */
-static long compress_added = 500000; /* word count */
+static long compress_start = 30000; // memory / SBLOCKSIZE
+static long compress_inc = 100; // memory / SBLOCKSIZE
+static long compress_added = 500000; // word count
/*
* Check the 'mkspellmem' option. Return FAIL if it's wrong.
@@ -2029,7 +2029,7 @@ spell_check_msm(void)
if (!VIM_ISDIGIT(*p))
return FAIL;
- /* block count = (value * 1024) / SBLOCKSIZE (but avoid overflow)*/
+ // block count = (value * 1024) / SBLOCKSIZE (but avoid overflow)
start = (getdigits(&p) * 10) / (SBLOCKSIZE / 102);
if (*p != ',')
return FAIL;
@@ -2089,7 +2089,7 @@ spell_print_node(wordnode_T *node, int depth)
{
if (node->wn_u1.index)
{
- /* Done this node before, print the reference. */
+ // Done this node before, print the reference.
PRINTSOME(line1, depth, "(%d)", node->wn_nr, 0);
PRINTSOME(line2, depth, " ", 0, 0);
PRINTSOME(line3, depth, " ", 0, 0);
@@ -2106,7 +2106,7 @@ spell_print_node(wordnode_T *node, int depth)
if (node->wn_child != NULL)
PRINTSOME(line1, depth, " %c -> ", node->wn_byte, 0);
else
- /* Cannot happen? */
+ // Cannot happen?
PRINTSOME(line1, depth, " %c ???", node->wn_byte, 0);
}
else
@@ -2126,14 +2126,14 @@ spell_print_node(wordnode_T *node, int depth)
msg(line3);
}
- /* do the children */
+ // do the children
if (node->wn_byte != NUL && node->wn_child != NULL)
spell_print_node(node->wn_child, depth + 1);
- /* do the siblings */
+ // do the siblings
if (node->wn_sibling != NULL)
{
- /* get rid of all parent details except | */
+ // get rid of all parent details except |
STRCPY(line1, line3);
STRCPY(line2, line3);
spell_print_node(node->wn_sibling, depth);
@@ -2146,15 +2146,15 @@ spell_print_tree(wordnode_T *root)
{
if (root != NULL)
{
- /* Clear the "wn_u1.index" fields, used to remember what has been
- * done. */
+ // Clear the "wn_u1.index" fields, used to remember what has been
+ // done.
spell_clear_flags(root);
- /* Recursively print the tree. */
+ // Recursively print the tree.
spell_print_node(root, 0);
}
}
-#endif /* SPELL_PRINTTREE */
+#endif // SPELL_PRINTTREE
/*
* Read the affix file "fname".
@@ -2187,16 +2187,16 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
int found_map = FALSE;
hashitem_T *hi;
int l;
- int compminlen = 0; /* COMPOUNDMIN value */
- int compsylmax = 0; /* COMPOUNDSYLMAX value */
- int compoptions = 0; /* COMP_ flags */
- int compmax = 0; /* COMPOUNDWORDMAX value */
- char_u *compflags = NULL; /* COMPOUNDFLAG and COMPOUNDRULE
- concatenated */
- char_u *midword = NULL; /* MIDWORD value */
- char_u *syllable = NULL; /* SYLLABLE value */
- char_u *sofofrom = NULL; /* SOFOFROM value */
- char_u *sofoto = NULL; /* SOFOTO value */
+ int compminlen = 0; // COMPOUNDMIN value
+ int compsylmax = 0; // COMPOUNDSYLMAX value
+ int compoptions = 0; // COMP_ flags
+ int compmax = 0; // COMPOUNDWORDMAX value
+ char_u *compflags = NULL; // COMPOUNDFLAG and COMPOUNDRULE
+ // concatenated
+ char_u *midword = NULL; // MIDWORD value
+ char_u *syllable = NULL; // SYLLABLE value
+ char_u *sofofrom = NULL; // SOFOFROM value
+ char_u *sofoto = NULL; // SOFOTO value
/*
* Open the file.
@@ -2211,16 +2211,16 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
vim_snprintf((char *)IObuff, IOSIZE, _("Reading affix file %s..."), fname);
spell_message(spin, IObuff);
- /* Only do REP lines when not done in another .aff file already. */
+ // Only do REP lines when not done in another .aff file already.
do_rep = spin->si_rep.ga_len == 0;
- /* Only do REPSAL lines when not done in another .aff file already. */
+ // Only do REPSAL lines when not done in another .aff file already.
do_repsal = spin->si_repsal.ga_len == 0;
- /* Only do SAL lines when not done in another .aff file already. */
+ // Only do SAL lines when not done in another .aff file already.
do_sal = spin->si_sal.ga_len == 0;
- /* Only do MAP lines when not done in another .aff file already. */
+ // Only do MAP lines when not done in another .aff file already.
do_mapline = spin->si_map.ga_len == 0;
/*
@@ -2244,11 +2244,11 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
line_breakcheck();
++lnum;
- /* Skip comment lines. */
+ // Skip comment lines.
if (*rline == '#')
continue;
- /* Convert from "SET" to 'encoding' when needed. */
+ // Convert from "SET" to 'encoding' when needed.
vim_free(pc);
if (spin->si_conv.vc_type != CONV_NONE)
{
@@ -2267,36 +2267,36 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
line = rline;
}
- /* Split the line up in white separated items. Put a NUL after each
- * item. */
+ // Split the line up in white separated items. Put a NUL after each
+ // item.
itemcnt = 0;
for (p = line; ; )
{
- while (*p != NUL && *p <= ' ') /* skip white space and CR/NL */
+ while (*p != NUL && *p <= ' ') // skip white space and CR/NL
++p;
if (*p == NUL)
break;
- if (itemcnt == MAXITEMCNT) /* too many items */
+ if (itemcnt == MAXITEMCNT) // too many items
break;
items[itemcnt++] = p;
- /* A few items have arbitrary text argument, don't split them. */
+ // A few items have arbitrary text argument, don't split them.
if (itemcnt == 2 && spell_info_item(items[0]))
- while (*p >= ' ' || *p == TAB) /* skip until CR/NL */
+ while (*p >= ' ' || *p == TAB) // skip until CR/NL
++p;
else
- while (*p > ' ') /* skip until white space or CR/NL */
+ while (*p > ' ') // skip until white space or CR/NL
++p;
if (*p == NUL)
break;
*p++ = NUL;
}
- /* Handle non-empty lines. */
+ // Handle non-empty lines.
if (itemcnt > 0)
{
if (is_aff_rule(items, itemcnt, "SET", 2) && aff->af_enc == NULL)
{
- /* Setup for conversion from "ENC" to 'encoding'. */
+ // Setup for conversion from "ENC" to 'encoding'.
aff->af_enc = enc_canonize(items[1]);
if (aff->af_enc != NULL && !spin->si_ascii
&& convert_setup(&spin->si_conv, aff->af_enc,
@@ -2357,9 +2357,9 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
}
else if (is_aff_rule(items, itemcnt, "TRY", 2))
{
- /* ignored, we look in the tree for what chars may appear */
+ // ignored, we look in the tree for what chars may appear
}
- /* TODO: remove "RAR" later */
+ // TODO: remove "RAR" later
else if ((is_aff_rule(items, itemcnt, "RAR", 2)
|| is_aff_rule(items, itemcnt, "RARE", 2))
&& aff->af_rare == 0)
@@ -2367,7 +2367,7 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
aff->af_rare = affitem2flag(aff->af_flagtype, items[1],
fname, lnum);
}
- /* TODO: remove "KEP" later */
+ // TODO: remove "KEP" later
else if ((is_aff_rule(items, itemcnt, "KEP", 2)
|| is_aff_rule(items, itemcnt, "KEEPCASE", 2))
&& aff->af_keepcase == 0)
@@ -2434,8 +2434,8 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2)
&& compflags == NULL)
{
- /* Turn flag "c" into COMPOUNDRULE compatible string "c+",
- * "Na" into "Na+", "1234" into "1234+". */
+ // Turn flag "c" into COMPOUNDRULE compatible string "c+",
+ // "Na" into "Na+", "1234" into "1234+".
p = getroom(spin, STRLEN(items[1]) + 2, FALSE);
if (p != NULL)
{
@@ -2446,19 +2446,19 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
}
else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2))
{
- /* We don't use the count, but do check that it's a number and
- * not COMPOUNDRULE mistyped. */
+ // We don't use the count, but do check that it's a number and
+ // not COMPOUNDRULE mistyped.
if (atoi((char *)items[1]) == 0)
smsg(_("Wrong COMPOUNDRULES value in %s line %d: %s"),
fname, lnum, items[1]);
}
else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2))
{
- /* Don't use the first rule if it is a number. */
+ // Don't use the first rule if it is a number.
if (compflags != NULL || *skipdigits(items[1]) != NUL)
{
- /* Concatenate this string to previously defined ones,
- * using a slash to separate them. */
+ // Concatenate this string to previously defined ones,
+ // using a slash to separate them.
l = (int)STRLEN(items[1]) + 1;
if (compflags != NULL)
l += (int)STRLEN(compflags) + 1;
@@ -2526,7 +2526,7 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
garray_T *gap = &spin->si_comppat;
int i;
- /* Only add the couple if it isn't already there. */
+ // Only add the couple if it isn't already there.
for (i = 0; i < gap->ga_len - 1; i += 2)
if (STRCMP(((char_u **)(gap->ga_data))[i], items[1]) == 0
&& STRCMP(((char_u **)(gap->ga_data))[i + 1],
@@ -2582,10 +2582,10 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
else
tp = &aff->af_suff;
- /* Myspell allows the same affix name to be used multiple
- * times. The affix files that do this have an undocumented
- * "S" flag on all but the last block, thus we check for that
- * and store it in ah_follows. */
+ // Myspell allows the same affix name to be used multiple
+ // times. The affix files that do this have an undocumented
+ // "S" flag on all but the last block, thus we check for that
+ // and store it in ah_follows.
vim_strncpy(key, items[1], AH_KEY_LEN - 1);
hi = hash_find(tp, key);
if (!HASHITEM_EMPTY(hi))
@@ -2600,7 +2600,7 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
}
else
{
- /* New affix letter. */
+ // New affix letter.
cur_aff = (affheader_T *)getroom(spin,
sizeof(affheader_T), TRUE);
if (cur_aff == NULL)
@@ -2625,8 +2625,8 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
cur_aff->ah_combine = (*items[2] == 'Y');
}
- /* Check for the "S" flag, which apparently means that another
- * block with the same affix name is following. */
+ // Check for the "S" flag, which apparently means that another
+ // block with the same affix name is following.
if (itemcnt > lasti && STRCMP(items[lasti], "S") == 0)
{
++lasti;
@@ -2635,8 +2635,8 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
else
cur_aff->ah_follows = FALSE;
- /* Myspell allows extra text after the item, but that might
- * mean mistakes go unnoticed. Require a comment-starter. */
+ // Myspell allows extra text after the item, but that might
+ // mean mistakes go unnoticed. Require a comment-starter.
if (itemcnt > lasti && *items[lasti] != '#')
smsg(_(e_afftrailing), fname, lnum, items[lasti]);
@@ -2648,18 +2648,18 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
{
if (cur_aff->ah_newID == 0)
{
- /* Use a new number in the .spl file later, to be able
- * to handle multiple .aff files. */
+ // Use a new number in the .spl file later, to be able
+ // to handle multiple .aff files.
check_renumber(spin);
cur_aff->ah_newID = ++spin->si_newprefID;
- /* We only really use ah_newID if the prefix is
- * postponed. We know that only after handling all
- * the items. */
+ // We only really use ah_newID if the prefix is
+ // postponed. We know that only after handling all
+ // the items.
did_postpone_prefix = FALSE;
}
else
- /* Did use the ID in a previous block. */
+ // Did use the ID in a previous block.
did_postpone_prefix = TRUE;
}
@@ -2675,9 +2675,9 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
int upper = FALSE;
int lasti = 5;
- /* Myspell allows extra text after the item, but that might
- * mean mistakes go unnoticed. Require a comment-starter,
- * unless IGNOREEXTRA is used. Hunspell uses a "-" item. */
+ // Myspell allows extra text after the item, but that might
+ // mean mistakes go unnoticed. Require a comment-starter,
+ // unless IGNOREEXTRA is used. Hunspell uses a "-" item.
if (itemcnt > lasti
&& !aff->af_ignoreextra
&& *items[lasti] != '#'
@@ -2685,7 +2685,7 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
|| itemcnt != lasti + 1))
smsg(_(e_afftrailing), fname, lnum, items[lasti]);
- /* New item for an affix letter. */
+ // New item for an affix letter.
--aff_todo;
aff_entry = (affentry_T *)getroom(spin,
sizeof(affentry_T), TRUE);
@@ -2698,7 +2698,7 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
{
aff_entry->ae_add = getroom_save(spin, items[3]);
- /* Recognize flags on the affix: abcd/XYZ */
+ // Recognize flags on the affix: abcd/XYZ
aff_entry->ae_flags = vim_strchr(aff_entry->ae_add, '/');
if (aff_entry->ae_flags != NULL)
{
@@ -2707,8 +2707,8 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
}
}
- /* Don't use an affix entry with non-ASCII characters when
- * "spin->si_ascii" is TRUE. */
+ // Don't use an affix entry with non-ASCII characters when
+ // "spin->si_ascii" is TRUE.
if (!spin->si_ascii || !(has_non_ascii(aff_entry->ae_chop)
|| has_non_ascii(aff_entry->ae_add)))
{
@@ -2731,18 +2731,18 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
fname, lnum, items[4]);
}
- /* For postponed prefixes we need an entry in si_prefcond
- * for the condition. Use an existing one if possible.
- * Can't be done for an affix with flags, ignoring
- * COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG. */
+ // For postponed prefixes we need an entry in si_prefcond
+ // for the condition. Use an existing one if possible.
+ // Can't be done for an affix with flags, ignoring
+ // COMPOUNDFORBIDFLAG and COMPOUNDPERMITFLAG.
if (*items[0] == 'P' && aff->af_pfxpostpone
&& aff_entry->ae_flags == NULL)
{
- /* When the chop string is one lower-case letter and
- * the add string ends in the upper-case letter we set
- * the "upper" flag, clear "ae_chop" and remove the
- * letters from "ae_add". The condition must either
- * be empty or start with the same letter. */
+ // When the chop string is one lower-case letter and
+ // the add string ends in the upper-case letter we set
+ // the "upper" flag, clear "ae_chop" and remove the
+ // letters from "ae_add". The condition must either
+ // be empty or start with the same letter.
if (aff_entry->ae_chop != NULL
&& aff_entry->ae_add != NULL
&& aff_entry->ae_chop[(*mb_ptr2len)(
@@ -2765,9 +2765,9 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
aff_entry->ae_chop = NULL;
*p = NUL;
- /* The condition is matched with the
- * actual word, thus must check for the
- * upper-case letter. */
+ // The condition is matched with the
+ // actual word, thus must check for the
+ // upper-case letter.
if (aff_entry->ae_cond != NULL)
{
char_u buf[MAXLINELEN];
@@ -2800,7 +2800,7 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
char_u **pp;
int n;
- /* Find a previously used condition. */
+ // Find a previously used condition.
for (idx = spin->si_prefcond.ga_len - 1; idx >= 0;
--idx)
{
@@ -2810,7 +2810,7 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
}
if (idx < 0 && ga_grow(&spin->si_prefcond, 1) == OK)
{
- /* Not found, add a new condition. */
+ // Not found, add a new condition.
idx = spin->si_prefcond.ga_len++;
pp = ((char_u **)spin->si_prefcond.ga_data)
+ idx;
@@ -2821,14 +2821,14 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
aff_entry->ae_cond);
}
- /* Add the prefix to the prefix tree. */
+ // Add the prefix to the prefix tree.
if (aff_entry->ae_add == NULL)
p = (char_u *)"";
else
p = aff_entry->ae_add;
- /* PFX_FLAGS is a negative number, so that
- * tree_add_word() knows this is the prefix tree. */
+ // PFX_FLAGS is a negative number, so that
+ // tree_add_word() knows this is the prefix tree.
n = PFX_FLAGS;
if (!cur_aff->ah_combine)
n |= WFP_NC;
@@ -2843,7 +2843,7 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
did_postpone_prefix = TRUE;
}
- /* Didn't actually use ah_newID, backup si_newprefID. */
+ // Didn't actually use ah_newID, backup si_newprefID.
if (aff_todo == 0 && !did_postpone_prefix)
{
--spin->si_newprefID;
@@ -2867,7 +2867,7 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
else if (is_aff_rule(items, itemcnt, "REP", 2)
|| is_aff_rule(items, itemcnt, "REPSAL", 2))
{
- /* Ignore REP/REPSAL count */;
+ // Ignore REP/REPSAL count
if (!isdigit(*items[1]))
smsg(_("Expected REP(SAL) count in %s line %d"),
fname, lnum);
@@ -2876,15 +2876,15 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
|| STRCMP(items[0], "REPSAL") == 0)
&& itemcnt >= 3)
{
- /* REP/REPSAL item */
- /* Myspell ignores extra arguments, we require it starts with
- * # to detect mistakes. */
+ // REP/REPSAL item
+ // Myspell ignores extra arguments, we require it starts with
+ // # to detect mistakes.
if (itemcnt > 3 && items[3][0] != '#')
smsg(_(e_afftrailing), fname, lnum, items[3]);
if (items[0][3] == 'S' ? do_repsal : do_rep)
{
- /* Replace underscore with space (can't include a space
- * directly). */
+ // Replace underscore with space (can't include a space
+ // directly).
for (p = items[1]; *p != NUL; MB_PTR_ADV(p))
if (*p == '_')
*p = ' ';
@@ -2898,10 +2898,10 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
}
else if (is_aff_rule(items, itemcnt, "MAP", 2))
{
- /* MAP item or count */
+ // MAP item or count
if (!found_map)
{
- /* First line contains the count. */
+ // First line contains the count.
found_map = TRUE;
if (!isdigit(*items[1]))
smsg(_("Expected MAP count in %s line %d"),
@@ -2911,7 +2911,7 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
{
int c;
- /* Check that every character appears only once. */
+ // Check that every character appears only once.
for (p = items[1]; *p != NUL; )
{
c = mb_ptr2char_adv(&p);
@@ -2923,19 +2923,19 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
fname, lnum);
}
- /* We simply concatenate all the MAP strings, separated by
- * slashes. */
+ // We simply concatenate all the MAP strings, separated by
+ // slashes.
ga_concat(&spin->si_map, items[1]);
ga_append(&spin->si_map, '/');
}
}
- /* Accept "SAL from to" and "SAL from to #comment". */
+ // Accept "SAL from to" and "SAL from to #comment".
else if (is_aff_rule(items, itemcnt, "SAL", 3))
{
if (do_sal)
{
- /* SAL item (sounds-a-like)
- * Either one of the known keys or a from-to pair. */
+ // SAL item (sounds-a-like)
+ // Either one of the known keys or a from-to pair.
if (STRCMP(items[1], "followup") == 0)
spin->si_followup = sal_to_bool(items[2]);
else if (STRCMP(items[1], "collapse_result") == 0)
@@ -2943,7 +2943,7 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
else if (STRCMP(items[1], "remove_accents") == 0)
spin->si_rem_accents = sal_to_bool(items[2]);
else
- /* when "to" is "_" it means empty */
+ // when "to" is "_" it means empty
add_fromto(spin, &spin->si_sal, items[1],
STRCMP(items[2], "_") == 0 ? (char_u *)""
: items[2]);
@@ -2985,8 +2985,8 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
{
if (spin->si_clear_chartab)
{
- /* Clear the char type tables, don't want to use any of the
- * currently used spell properties. */
+ // Clear the char type tables, don't want to use any of the
+ // currently used spell properties.
init_spell_chartab();
spin->si_clear_chartab = FALSE;
}
@@ -3010,7 +3010,7 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
vim_free(upp);
}
- /* Use compound specifications of the .aff file for the spell info. */
+ // Use compound specifications of the .aff file for the spell info.
if (compmax != 0)
{
aff_check_number(spin->si_compmax, compmax, "COMPOUNDWORDMAX");
@@ -3040,7 +3040,7 @@ spell_read_aff(spellinfo_T *spin, char_u *fname)
if (compflags != NULL)
process_compflags(spin, aff, compflags);
- /* Check that we didn't use too many renumbered flags. */
+ // Check that we didn't use too many renumbered flags.
if (spin->si_newcompID < spin->si_newprefID)
{
if (spin->si_newcompID == 127 || spin->si_newcompID == 255)
@@ -3131,7 +3131,7 @@ aff_process_flags(afffile_T *affile, affentry_T *entry)
++p;
}
if (*entry->ae_flags == NUL)
- entry->ae_flags = NULL; /* nothing left */
+ entry->ae_flags = NULL; // nothing left
}
}
@@ -3196,7 +3196,7 @@ get_affitem(int flagtype, char_u **pp)
{
if (!VIM_ISDIGIT(**pp))
{
- ++*pp; /* always advance, avoid getting stuck */
+ ++*pp; // always advance, avoid getting stuck
return 0;
}
res = getdigits(pp);
@@ -3239,9 +3239,9 @@ process_compflags(
char_u key[AH_KEY_LEN];
hashitem_T *hi;
- /* Make room for the old and the new compflags, concatenated with a / in
- * between. Processing it makes it shorter, but we don't know by how
- * much, thus allocate the maximum. */
+ // Make room for the old and the new compflags, concatenated with a / in
+ // between. Processing it makes it shorter, but we don't know by how
+ // much, thus allocate the maximum.
len = (int)STRLEN(compflags) + 1;
if (spin->si_compflags != NULL)
len += (int)STRLEN(spin->si_compflags) + 1;
@@ -3259,17 +3259,17 @@ process_compflags(
for (p = compflags; *p != NUL; )
{
if (vim_strchr((char_u *)"/?*+[]", *p) != NULL)
- /* Copy non-flag characters directly. */
+ // Copy non-flag characters directly.
*tp++ = *p++;
else
{
- /* First get the flag number, also checks validity. */
+ // First get the flag number, also checks validity.
prevp = p;
flag = get_affitem(aff->af_flagtype, &p);
if (flag != 0)
{
- /* Find the flag in the hashtable. If it was used before, use
- * the existing ID. Otherwise add a new entry. */
+ // Find the flag in the hashtable. If it was used before, use
+ // the existing ID. Otherwise add a new entry.
vim_strncpy(key, prevp, p - prevp);
hi = hash_find(&aff->af_comp, key);
if (!HASHITEM_EMPTY(hi))
@@ -3281,8 +3281,8 @@ process_compflags(
break;
STRCPY(ci->ci_key, key);
ci->ci_flag = flag;
- /* Avoid using a flag ID that has a special meaning in a
- * regexp (also inside []). */
+ // Avoid using a flag ID that has a special meaning in a
+ // regexp (also inside []).
do
{
check_renumber(spin);
@@ -3352,7 +3352,7 @@ flag_in_afflist(int flagtype, char_u *afflist, unsigned flag)
n = ZERO_FLAG;
if (n == flag)
return TRUE;
- if (*p != NUL) /* skip over comma */
+ if (*p != NUL) // skip over comma
++p;
}
break;
@@ -3440,7 +3440,7 @@ spell_free_aff(afffile_T *aff)
vim_free(aff->af_enc);
- /* All this trouble to free the "ae_prog" items... */
+ // All this trouble to free the "ae_prog" items...
for (ht = &aff->af_pref; ; ht = &aff->af_suff)
{
todo = (int)ht->ht_used;
@@ -3501,17 +3501,17 @@ spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
return FAIL;
}
- /* The hashtable is only used to detect duplicated words. */
+ // The hashtable is only used to detect duplicated words.
hash_init(&ht);
vim_snprintf((char *)IObuff, IOSIZE,
_("Reading dictionary file %s..."), fname);
spell_message(spin, IObuff);
- /* start with a message for the first line */
+ // start with a message for the first line
spin->si_msg_count = 999999;
- /* Read and ignore the first line: word count. */
+ // Read and ignore the first line: word count.
(void)vim_fgets(line, MAXLINELEN, fd);
if (!vim_isdigit(*skipwhite(line)))
semsg(_("E760: No word count in %s"), fname);
@@ -3526,18 +3526,18 @@ spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
line_breakcheck();
++lnum;
if (line[0] == '#' || line[0] == '/')
- continue; /* comment line */
+ continue; // comment line
- /* Remove CR, LF and white space from the end. White space halfway
- * the word is kept to allow e.g., "et al.". */
+ // Remove CR, LF and white space from the end. White space halfway
+ // the word is kept to allow e.g., "et al.".
l = (int)STRLEN(line);
while (l > 0 && line[l - 1] <= ' ')
--l;
if (l == 0)
- continue; /* empty line */
+ continue; // empty line
line[l] = NUL;
- /* Convert from "SET" to 'encoding' when needed. */
+ // Convert from "SET" to 'encoding' when needed.
if (spin->si_conv.vc_type != CONV_NONE)
{
pc = string_convert(&spin->si_conv, line, NULL);
@@ -3555,8 +3555,8 @@ spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
w = line;
}
- /* Truncate the word at the "/", set "afflist" to what follows.
- * Replace "\/" by "/" and "\\" by "\". */
+ // Truncate the word at the "/", set "afflist" to what follows.
+ // Replace "\/" by "/" and "\\" by "\".
afflist = NULL;
for (p = w; *p != NUL; MB_PTR_ADV(p))
{
@@ -3570,7 +3570,7 @@ spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
}
}
- /* Skip non-ASCII words when "spin->si_ascii" is TRUE. */
+ // Skip non-ASCII words when "spin->si_ascii" is TRUE.
if (spin->si_ascii && has_non_ascii(w))
{
++non_ascii;
@@ -3578,7 +3578,7 @@ spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
continue;
}
- /* This takes time, print a message every 10000 words. */
+ // This takes time, print a message every 10000 words.
if (spin->si_verbose && spin->si_msg_count > 10000)
{
spin->si_msg_count = 0;
@@ -3593,7 +3593,7 @@ spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
out_flush();
}
- /* Store the word in the hashtable to be able to find duplicates. */
+ // Store the word in the hashtable to be able to find duplicates.
dw = (char_u *)getroom_save(spin, w);
if (dw == NULL)
{
@@ -3623,7 +3623,7 @@ spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
need_affix = FALSE;
if (afflist != NULL)
{
- /* Extract flags from the affix list. */
+ // Extract flags from the affix list.
flags |= get_affix_flags(affile, afflist);
if (affile->af_needaffix != 0 && flag_in_afflist(
@@ -3631,30 +3631,30 @@ spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
need_affix = TRUE;
if (affile->af_pfxpostpone)
- /* Need to store the list of prefix IDs with the word. */
+ // Need to store the list of prefix IDs with the word.
pfxlen = get_pfxlist(affile, afflist, store_afflist);
if (spin->si_compflags != NULL)
- /* Need to store the list of compound flags with the word.
- * Concatenate them to the list of prefix IDs. */
+ // Need to store the list of compound flags with the word.
+ // Concatenate them to the list of prefix IDs.
get_compflags(affile, afflist, store_afflist + pfxlen);
}
- /* Add the word to the word tree(s). */
+ // Add the word to the word tree(s).
if (store_word(spin, dw, flags, spin->si_region,
store_afflist, need_affix) == FAIL)
retval = FAIL;
if (afflist != NULL)
{
- /* Find all matching suffixes and add the resulting words.
- * Additionally do matching prefixes that combine. */
+ // Find all matching suffixes and add the resulting words.
+ // Additionally do matching prefixes that combine.
if (store_aff_word(spin, dw, afflist, affile,
&affile->af_suff, &affile->af_pref,
CONDIT_SUF, flags, store_afflist, pfxlen) == FAIL)
retval = FAIL;
- /* Find all matching prefixes and add the resulting words. */
+ // Find all matching prefixes and add the resulting words.
if (store_aff_word(spin, dw, afflist, affile,
&affile->af_pref, NULL,
CONDIT_SUF, flags, store_afflist, pfxlen) == FAIL)
@@ -3729,8 +3729,8 @@ get_pfxlist(
prevp = p;
if (get_affitem(affile->af_flagtype, &p) != 0)
{
- /* A flag is a postponed prefix flag if it appears in "af_pref"
- * and its ID is not zero. */
+ // A flag is a postponed prefix flag if it appears in "af_pref"
+ // and its ID is not zero.
vim_strncpy(key, prevp, p - prevp);
hi = hash_find(&affile->af_pref, key);
if (!HASHITEM_EMPTY(hi))
@@ -3770,7 +3770,7 @@ get_compflags(
prevp = p;
if (get_affitem(affile->af_flagtype, &p) != 0)
{
- /* A flag is a compound flag if it appears in "af_comp". */
+ // A flag is a compound flag if it appears in "af_comp".
vim_strncpy(key, prevp, p - prevp);
hi = hash_find(&affile->af_comp, key);
if (!HASHITEM_EMPTY(hi))
@@ -3794,17 +3794,17 @@ get_compflags(
*/
static int
store_aff_word(
- spellinfo_T *spin, /* spell info */
- char_u *word, /* basic word start */
- char_u *afflist, /* list of names of supported affixes */
+ spellinfo_T *spin, // spell info
+ char_u *word, // basic word start
+ char_u *afflist, // list of names of supported affixes
afffile_T *affile,
hashtab_T *ht,
hashtab_T *xht,
- int condit, /* CONDIT_SUF et al. */
- int flags, /* flags for the word */
- char_u *pfxlist, /* list of prefix IDs */
- int pfxlen) /* nr of flags in "pfxlist" for prefixes, rest
- * is compound flags */
+ int condit, // CONDIT_SUF et al.
+ int flags, // flags for the word
+ char_u *pfxlist, // list of prefix IDs
+ int pfxlen) // nr of flags in "pfxlist" for prefixes, rest
+ // is compound flags
{
int todo;
hashitem_T *hi;
@@ -3831,25 +3831,25 @@ store_aff_word(
--todo;
ah = HI2AH(hi);
- /* Check that the affix combines, if required, and that the word
- * supports this affix. */
+ // Check that the affix combines, if required, and that the word
+ // supports this affix.
if (((condit & CONDIT_COMB) == 0 || ah->ah_combine)
&& flag_in_afflist(affile->af_flagtype, afflist,
ah->ah_flag))
{
- /* Loop over all affix entries with this name. */
+ // Loop over all affix entries with this name.
for (ae = ah->ah_first; ae != NULL; ae = ae->ae_next)
{
- /* Check the condition. It's not logical to match case
- * here, but it is required for compatibility with
- * Myspell.
- * Another requirement from Myspell is that the chop
- * string is shorter than the word itself.
- * For prefixes, when "PFXPOSTPONE" was used, only do
- * prefixes with a chop string and/or flags.
- * When a previously added affix had CIRCUMFIX this one
- * must have it too, if it had not then this one must not
- * have one either. */
+ // Check the condition. It's not logical to match case
+ // here, but it is required for compatibility with
+ // Myspell.
+ // Another requirement from Myspell is that the chop
+ // string is shorter than the word itself.
+ // For prefixes, when "PFXPOSTPONE" was used, only do
+ // prefixes with a chop string and/or flags.
+ // When a previously added affix had CIRCUMFIX this one
+ // must have it too, if it had not then this one must not
+ // have one either.
if ((xht != NULL || !affile->af_pfxpostpone
|| ae->ae_chop != NULL
|| ae->ae_flags != NULL)
@@ -3864,10 +3864,10 @@ store_aff_word(
|| !flag_in_afflist(affile->af_flagtype,
ae->ae_flags, affile->af_circumfix))))
{
- /* Match. Remove the chop and add the affix. */
+ // Match. Remove the chop and add the affix.
if (xht == NULL)
{
- /* prefix: chop/add at the start of the word */
+ // prefix: chop/add at the start of the word
if (ae->ae_add == NULL)
*newword = NUL;
else
@@ -3875,7 +3875,7 @@ store_aff_word(
p = word;
if (ae->ae_chop != NULL)
{
- /* Skip chop string. */
+ // Skip chop string.
if (has_mbyte)
{
i = mb_charlen(ae->ae_chop);
@@ -3889,11 +3889,11 @@ store_aff_word(
}
else
{
- /* suffix: chop/add at the end of the word */
+ // suffix: chop/add at the end of the word
vim_strncpy(newword, word, MAXWLEN - 1);
if (ae->ae_chop != NULL)
{
- /* Remove chop string. */
+ // Remove chop string.
p = newword + STRLEN(newword);
i = (int)MB_CHARLEN(ae->ae_chop);
for ( ; i > 0; --i)
@@ -3911,7 +3911,7 @@ store_aff_word(
use_condit = condit | CONDIT_COMB | CONDIT_AFF;
if (ae->ae_flags != NULL)
{
- /* Extract flags from the affix list. */
+ // Extract flags from the affix list.
use_flags |= get_affix_flags(affile, ae->ae_flags);
if (affile->af_needaffix != 0 && flag_in_afflist(
@@ -3919,9 +3919,9 @@ store_aff_word(
affile->af_needaffix))
need_affix = TRUE;
- /* When there is a CIRCUMFIX flag the other affix
- * must also have it and we don't add the word
- * with one affix. */
+ // When there is a CIRCUMFIX flag the other affix
+ // must also have it and we don't add the word
+ // with one affix.
if (affile->af_circumfix != 0 && flag_in_afflist(
affile->af_flagtype, ae->ae_flags,
affile->af_circumfix))
@@ -3935,15 +3935,15 @@ store_aff_word(
|| spin->si_compflags != NULL)
{
if (affile->af_pfxpostpone)
- /* Get prefix IDS from the affix list. */
+ // Get prefix IDS from the affix list.
use_pfxlen = get_pfxlist(affile,
ae->ae_flags, store_afflist);
else
use_pfxlen = 0;
use_pfxlist = store_afflist;
- /* Combine the prefix IDs. Avoid adding the
- * same ID twice. */
+ // Combine the prefix IDs. Avoid adding the
+ // same ID twice.
for (i = 0; i < pfxlen; ++i)
{
for (j = 0; j < use_pfxlen; ++j)
@@ -3954,13 +3954,13 @@ store_aff_word(
}
if (spin->si_compflags != NULL)
- /* Get compound IDS from the affix list. */
+ // Get compound IDS from the affix list.
get_compflags(affile, ae->ae_flags,
use_pfxlist + use_pfxlen);
- /* Combine the list of compound flags.
- * Concatenate them to the prefix IDs list.
- * Avoid adding the same ID twice. */
+ // Combine the list of compound flags.
+ // Concatenate them to the prefix IDs list.
+ // Avoid adding the same ID twice.
for (i = pfxlen; pfxlist[i] != NUL; ++i)
{
for (j = use_pfxlen;
@@ -3976,31 +3976,31 @@ store_aff_word(
}
}
- /* Obey a "COMPOUNDFORBIDFLAG" of the affix: don't
- * use the compound flags. */
+ // Obey a "COMPOUNDFORBIDFLAG" of the affix: don't
+ // use the compound flags.
if (use_pfxlist != NULL && ae->ae_compforbid)
{
vim_strncpy(pfx_pfxlist, use_pfxlist, use_pfxlen);
use_pfxlist = pfx_pfxlist;
}
- /* When there are postponed prefixes... */
+ // When there are postponed prefixes...
if (spin->si_prefroot != NULL
&& spin->si_prefroot->wn_sibling != NULL)
{
- /* ... add a flag to indicate an affix was used. */
+ // ... add a flag to indicate an affix was used.
use_flags |= WF_HAS_AFF;
- /* ... don't use a prefix list if combining
- * affixes is not allowed. But do use the
- * compound flags after them. */
+ // ... don't use a prefix list if combining
+ // affixes is not allowed. But do use the
+ // compound flags after them.
if (!ah->ah_combine && use_pfxlist != NULL)
use_pfxlist += use_pfxlen;
}
- /* When compounding is supported and there is no
- * "COMPOUNDPERMITFLAG" then forbid compounding on the
- * side where the affix is applied. */
+ // When compounding is supported and there is no
+ // "COMPOUNDPERMITFLAG" then forbid compounding on the
+ // side where the affix is applied.
if (spin->si_compflags != NULL && !ae->ae_comppermit)
{
if (xht != NULL)
@@ -4009,14 +4009,14 @@ store_aff_word(
use_flags |= WF_NOCOMPBEF;
}
- /* Store the modified word. */
+ // Store the modified word.
if (store_word(spin, newword, use_flags,
spin->si_region, use_pfxlist,
need_affix) == FAIL)
retval = FAIL;
- /* When added a prefix or a first suffix and the affix
- * has flags may add a(nother) suffix. RECURSIVE! */
+ // When added a prefix or a first suffix and the affix
+ // has flags may add a(nother) suffix. RECURSIVE!
if ((condit & CONDIT_SUF) && ae->ae_flags != NULL)
if (store_aff_word(spin, newword, ae->ae_flags,
affile, &affile->af_suff, xht,
@@ -4025,9 +4025,9 @@ store_aff_word(
use_flags, use_pfxlist, pfxlen) == FAIL)
retval = FAIL;
- /* When added a suffix and combining is allowed also
- * try adding a prefix additionally. Both for the
- * word flags and for the affix flags. RECURSIVE! */
+ // When added a suffix and combining is allowed also
+ // try adding a prefix additionally. Both for the
+ // word flags and for the affix flags. RECURSIVE!
if (xht != NULL && ah->ah_combine)
{
if (store_aff_word(spin, newword,
@@ -4092,19 +4092,19 @@ spell_read_wordfile(spellinfo_T *spin, char_u *fname)
line_breakcheck();
++lnum;
- /* Skip comment lines. */
+ // Skip comment lines.
if (*rline == '#')
continue;
- /* Remove CR, LF and white space from the end. */
+ // Remove CR, LF and white space from the end.
l = (int)STRLEN(rline);
while (l > 0 && rline[l - 1] <= ' ')
--l;
if (l == 0)
- continue; /* empty or blank line */
+ continue; // empty or blank line
rline[l] = NUL;
- /* Convert from "/encoding={encoding}" to 'encoding' when needed. */
+ // Convert from "/encoding={encoding}" to 'encoding' when needed.
vim_free(pc);
if (spin->si_conv.vc_type != CONV_NONE)
{
@@ -4138,7 +4138,7 @@ spell_read_wordfile(spellinfo_T *spin, char_u *fname)
{
char_u *enc;
- /* Setup for conversion to 'encoding'. */
+ // Setup for conversion to 'encoding'.
line += 9;
enc = enc_canonize(line);
if (enc != NULL && !spin->si_ascii
@@ -4168,7 +4168,7 @@ spell_read_wordfile(spellinfo_T *spin, char_u *fname)
spin->si_region_count = (int)STRLEN(line) / 2;
STRCPY(spin->si_region_name, line);
- /* Adjust the mask for a word valid in all regions. */
+ // Adjust the mask for a word valid in all regions.
spin->si_region = (1 << spin->si_region_count) - 1;
}
}
@@ -4183,22 +4183,22 @@ spell_read_wordfile(spellinfo_T *spin, char_u *fname)
flags = 0;
regionmask = spin->si_region;
- /* Check for flags and region after a slash. */
+ // Check for flags and region after a slash.
p = vim_strchr(line, '/');
if (p != NULL)
{
*p++ = NUL;
while (*p != NUL)
{
- if (*p == '=') /* keep-case word */
+ if (*p == '=') // keep-case word
flags |= WF_KEEPCAP | WF_FIXCAP;
- else if (*p == '!') /* Bad, bad, wicked word. */
+ else if (*p == '!') // Bad, bad, wicked word.
flags |= WF_BANNED;
- else if (*p == '?') /* Rare word. */
+ else if (*p == '?') // Rare word.
flags |= WF_RARE;
- else if (VIM_ISDIGIT(*p)) /* region number(s) */
+ else if (VIM_ISDIGIT(*p)) // region number(s)
{
- if ((flags & WF_REGION) == 0) /* first one */
+ if ((flags & WF_REGION) == 0) // first one
regionmask = 0;
flags |= WF_REGION;
@@ -4221,14 +4221,14 @@ spell_read_wordfile(spellinfo_T *spin, char_u *fname)
}
}
- /* Skip non-ASCII words when "spin->si_ascii" is TRUE. */
+ // Skip non-ASCII words when "spin->si_ascii" is TRUE.
if (spin->si_ascii && has_non_ascii(line))
{
++non_ascii;
continue;
}
- /* Normal word: store it. */
+ // Normal word: store it.
if (store_word(spin, line, flags, regionmask, NULL, FALSE) == FAIL)
{
retval = FAIL;
@@ -4260,15 +4260,15 @@ spell_read_wordfile(spellinfo_T *spin, char_u *fname)
static void *
getroom(
spellinfo_T *spin,
- size_t len, /* length needed */
- int align) /* align for pointer */
+ size_t len, // length needed
+ int align) // align for pointer
{
char_u *p;
sblock_T *bl = spin->si_blocks;
if (align && bl != NULL)
- /* Round size up for alignment. On some systems structures need to be
- * aligned to the size of a pointer (e.g., SPARC). */
+ // Round size up for alignment. On some systems structures need to be
+ // aligned to the size of a pointer (e.g., SPARC).
bl->sb_used = (bl->sb_used + sizeof(char *) - 1)
& ~(sizeof(char *) - 1);
@@ -4277,7 +4277,7 @@ getroom(
if (len >= SBLOCKSIZE)
bl = NULL;
else
- /* Allocate a block of memory. It is not freed until much later. */
+ // Allocate a block of memory. It is not freed until much later.
bl = alloc_clear(sizeof(sblock_T) + SBLOCKSIZE);
if (bl == NULL)
{
@@ -4355,10 +4355,10 @@ wordtree_alloc(spellinfo_T *spin)
store_word(
spellinfo_T *spin,
char_u *word,
- int flags, /* extra flags, WF_BANNED */
- int region, /* supported region(s) */
- char_u *pfxlist, /* list of prefix IDs or NULL */
- int need_affix) /* only store word with affix ID */
+ int flags, // extra flags, WF_BANNED
+ int region, // supported region(s)
+ char_u *pfxlist, // list of prefix IDs or NULL
+ int need_affix) // only store word with affix ID
{
int len = (int)STRLEN(word);
int ct = captype(word, word + len);
@@ -4413,25 +4413,25 @@ tree_add_word(
wordnode_T **prev = NULL;
int i;
- /* Add each byte of the word to the tree, including the NUL at the end. */
+ // Add each byte of the word to the tree, including the NUL at the end.
for (i = 0; ; ++i)
{
- /* When there is more than one reference to this node we need to make
- * a copy, so that we can modify it. Copy the whole list of siblings
- * (we don't optimize for a partly shared list of siblings). */
+ // When there is more than one reference to this node we need to make
+ // a copy, so that we can modify it. Copy the whole list of siblings
+ // (we don't optimize for a partly shared list of siblings).
if (node != NULL && node->wn_refs > 1)
{
--node->wn_refs;
copyprev = prev;
for (copyp = node; copyp != NULL; copyp = copyp->wn_sibling)
{
- /* Allocate a new node and copy the info. */
+ // Allocate a new node and copy the info.
np = get_wordnode(spin);
if (np == NULL)
return FAIL;
np->wn_child = copyp->wn_child;
if (np->wn_child != NULL)
- ++np->wn_child->wn_refs; /* child gets extra ref */
+ ++np->wn_child->wn_refs; // child gets extra ref
np->wn_byte = copyp->wn_byte;
if (np->wn_byte == NUL)
{
@@ -4440,22 +4440,22 @@ tree_add_word(
np->wn_affixID = copyp->wn_affixID;
}
- /* Link the new node in the list, there will be one ref. */
+ // Link the new node in the list, there will be one ref.
np->wn_refs = 1;
if (copyprev != NULL)
*copyprev = np;
copyprev = &np->wn_sibling;
- /* Let "node" point to the head of the copied list. */
+ // Let "node" point to the head of the copied list.
if (copyp == node)
node = np;
}
}
- /* Look for the sibling that has the same character. They are sorted
- * on byte value, thus stop searching when a sibling is found with a
- * higher byte value. For zero bytes (end of word) the sorting is
- * done on flags and then on affixID. */
+ // Look for the sibling that has the same character. They are sorted
+ // on byte value, thus stop searching when a sibling is found with a
+ // higher byte value. For zero bytes (end of word) the sorting is
+ // done on flags and then on affixID.
while (node != NULL
&& (node->wn_byte < word[i]
|| (node->wn_byte == NUL
@@ -4479,16 +4479,16 @@ tree_add_word(
|| node->wn_flags != (flags & WN_MASK)
|| node->wn_affixID != affixID)))
{
- /* Allocate a new node. */
+ // Allocate a new node.
np = get_wordnode(spin);
if (np == NULL)
return FAIL;
np->wn_byte = word[i];
- /* If "node" is NULL this is a new child or the end of the sibling
- * list: ref count is one. Otherwise use ref count of sibling and
- * make ref count of sibling one (matters when inserting in front
- * of the list of siblings). */
+ // If "node" is NULL this is a new child or the end of the sibling
+ // list: ref count is one. Otherwise use ref count of sibling and
+ // make ref count of sibling one (matters when inserting in front
+ // of the list of siblings).
if (node == NULL)
np->wn_refs = 1;
else
@@ -4517,13 +4517,13 @@ tree_add_word(
spell_print_tree(root->wn_sibling);
#endif
- /* count nr of words added since last message */
+ // count nr of words added since last message
++spin->si_msg_count;
if (spin->si_compress_cnt > 1)
{
if (--spin->si_compress_cnt == 1)
- /* Did enough words to lower the block count limit. */
+ // Did enough words to lower the block count limit.
spin->si_blocks_cnt += compress_inc;
}
@@ -4545,10 +4545,10 @@ tree_add_word(
: spin->si_blocks_cnt >= compress_start)
#endif
{
- /* Decrement the block counter. The effect is that we compress again
- * when the freed up room has been used and another "compress_inc"
- * blocks have been allocated. Unless "compress_added" words have
- * been added, then the limit is put back again. */
+ // Decrement the block counter. The effect is that we compress again
+ // when the freed up room has been used and another "compress_inc"
+ // blocks have been allocated. Unless "compress_added" words have
+ // been added, then the limit is put back again.
spin->si_blocks_cnt -= compress_inc;
spin->si_compress_cnt = compress_added;
@@ -4562,10 +4562,10 @@ tree_add_word(
out_flush();
}
- /* Compress both trees. Either they both have many nodes, which makes
- * compression useful, or one of them is small, which means
- * compression goes fast. But when filling the soundfold word tree
- * there is no keep-case tree. */
+ // Compress both trees. Either they both have many nodes, which makes
+ // compression useful, or one of them is small, which means
+ // compression goes fast. But when filling the soundfold word tree
+ // there is no keep-case tree.
wordtree_compress(spin, spin->si_foldroot);
if (affixID >= 0)
wordtree_compress(spin, spin->si_keeproot);
@@ -4621,7 +4621,7 @@ deref_wordnode(spellinfo_T *spin, wordnode_T *node)
free_wordnode(spin, np);
++cnt;
}
- ++cnt; /* length field */
+ ++cnt; // length field
}
return cnt;
}
@@ -4649,8 +4649,8 @@ wordtree_compress(spellinfo_T *spin, wordnode_T *root)
int tot = 0;
int perc;
- /* Skip the root itself, it's not actually used. The first sibling is the
- * start of the tree. */
+ // Skip the root itself, it's not actually used. The first sibling is the
+ // start of the tree.
if (root->wn_sibling != NULL)
{
hash_init(&ht);
@@ -4687,8 +4687,8 @@ node_compress(
spellinfo_T *spin,
wordnode_T *node,
hashtab_T *ht,
- int *tot) /* total count of nodes before compressing,
- incremented while going through the tree */
+ int *tot) // total count of nodes before compressing,
+ // incremented while going through the tree
{
wordnode_T *np;
wordnode_T *tp;
@@ -4710,23 +4710,23 @@ node_compress(
++len;
if ((child = np->wn_child) != NULL)
{
- /* Compress the child first. This fills hashkey. */
+ // Compress the child first. This fills hashkey.
compressed += node_compress(spin, child, ht, tot);
- /* Try to find an identical child. */
+ // Try to find an identical child.
hash = hash_hash(child->wn_u1.hashkey);
hi = hash_lookup(ht, child->wn_u1.hashkey, hash);
if (!HASHITEM_EMPTY(hi))
{
- /* There are children we encountered before with a hash value
- * identical to the current child. Now check if there is one
- * that is really identical. */
+ // There are children we encountered before with a hash value
+ // identical to the current child. Now check if there is one
+ // that is really identical.
for (tp = HI2WN(hi); tp != NULL; tp = tp->wn_u2.next)
if (node_equal(child, tp))
{
- /* Found one! Now use that child in place of the
- * current one. This means the current child and all
- * its siblings is unlinked from the tree. */
+ // Found one! Now use that child in place of the
+ // current one. This means the current child and all
+ // its siblings is unlinked from the tree.
++tp->wn_refs;
compressed += deref_wordnode(spin, child);
np->wn_child = tp;
@@ -4734,21 +4734,21 @@ node_compress(
}
if (tp == NULL)
{
- /* No other child with this hash value equals the child of
- * the node, add it to the linked list after the first
- * item. */
+ // No other child with this hash value equals the child of
+ // the node, add it to the linked list after the first
+ // item.
tp = HI2WN(hi);
child->wn_u2.next = tp->wn_u2.next;
tp->wn_u2.next = child;
}
}
else
- /* No other child has this hash value, add it to the
- * hashtable. */
+ // No other child has this hash value, add it to the
+ // hashtable.
hash_add_item(ht, hi, child->wn_u1.hashkey, hash);
}
}
- *tot += len + 1; /* add one for the node that stores the length */
+ *tot += len + 1; // add one for the node that stores the length
/*
* Make a hash key for the node and its siblings, so that we can quickly
@@ -4760,15 +4760,15 @@ node_compress(
for (np = node; np != NULL; np = np->wn_sibling)
{
if (np->wn_byte == NUL)
- /* end node: use wn_flags, wn_region and wn_affixID */
+ // end node: use wn_flags, wn_region and wn_affixID
n = np->wn_flags + (np->wn_region << 8) + (np->wn_affixID << 16);
else
- /* byte node: use the byte value and the child pointer */
+ // byte node: use the byte value and the child pointer
n = (unsigned)(np->wn_byte + ((long_u)np->wn_child << 8));
nr = nr * 101 + n;
}
- /* Avoid NUL bytes, it terminates the hash key. */
+ // Avoid NUL bytes, it terminates the hash key.
n = nr & 0xff;
node->wn_u1.hashkey[1] = n == 0 ? 1 : n;
n = (nr >> 8) & 0xff;
@@ -4779,7 +4779,7 @@ node_compress(
node->wn_u1.hashkey[4] = n == 0 ? 1 : n;
node->wn_u1.hashkey[5] = NUL;
- /* Check for CTRL-C pressed now and then. */
+ // Check for CTRL-C pressed now and then.
fast_breakcheck();
return compressed;
@@ -4840,8 +4840,8 @@ write_vim_spell(spellinfo_T *spin, char_u *fname)
char_u *p;
int rr;
int retval = OK;
- size_t fwv = 1; /* collect return value of fwrite() to avoid
- warnings from picky compiler */
+ size_t fwv = 1; // collect return value of fwrite() to avoid
+ // warnings from picky compiler
fd = mch_fopen((char *)fname, "w");
if (fd == NULL)
@@ -4850,64 +4850,63 @@ write_vim_spell(spellinfo_T *spin, char_u *fname)
return FAIL;
}
- /* <HEADER>: <fileID> <versionnr> */
- /* <fileID> */
+ // <HEADER>: <fileID> <versionnr>
+ // <fileID>
fwv &= fwrite(VIMSPELLMAGIC, VIMSPELLMAGICL, (size_t)1, fd);
if (fwv != (size_t)1)
- /* Catch first write error, don't try writing more. */
+ // Catch first write error, don't try writing more.
goto theend;
- putc(VIMSPELLVERSION, fd); /* <versionnr> */
+ putc(VIMSPELLVERSION, fd); // <versionnr>
/*
* <SECTIONS>: <section> ... <sectionend>
*/
- /* SN_INFO: <infotext> */
+ // SN_INFO: <infotext>
if (spin->si_info != NULL)
{
- putc(SN_INFO, fd); /* <sectionID> */
- putc(0, fd); /* <sectionflags> */
+ putc(SN_INFO, fd); // <sectionID>
+ putc(0, fd); // <sectionflags>
i = (int)STRLEN(spin->si_info);
- put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
- fwv &= fwrite(spin->si_info, (size_t)i, (size_t)1, fd); /* <infotext> */
+ put_bytes(fd, (long_u)i, 4); // <sectionlen>
+ fwv &= fwrite(spin->si_info, (size_t)i, (size_t)1, fd); // <infotext>
}
- /* SN_REGION: <regionname> ...
- * Write the region names only if there is more than one. */
+ // SN_REGION: <regionname> ...
+ // Write the region names only if there is more than one.
if (spin->si_region_count > 1)
{
- putc(SN_REGION, fd); /* <sectionID> */
- putc(SNF_REQUIRED, fd); /* <sectionflags> */
+ putc(SN_REGION, fd); // <sectionID>
+ putc(SNF_REQUIRED, fd); // <sectionflags>
l = spin->si_region_count * 2;
- put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
+ put_bytes(fd, (long_u)l, 4); // <sectionlen>
fwv &= fwrite(spin->si_region_name, (size_t)l, (size_t)1, fd);
- /* <regionname> ... */
+ // <regionname> ...
regionmask = (1 << spin->si_region_count) - 1;
}
else
regionmask = 0;
- /* SN_CHARFLAGS: <charflagslen> <charflags> <folcharslen> <folchars>
- *
- * The table with character flags and the table for case folding.
- * This makes sure the same characters are recognized as word characters
- * when generating an when using a spell file.
- * Skip this for ASCII, the table may conflict with the one used for
- * 'encoding'.
- * Also skip this for an .add.spl file, the main spell file must contain
- * the table (avoids that it conflicts). File is shorter too.
- */
+ // SN_CHARFLAGS: <charflagslen> <charflags> <folcharslen> <folchars>
+ //
+ // The table with character flags and the table for case folding.
+ // This makes sure the same characters are recognized as word characters
+ // when generating an when using a spell file.
+ // Skip this for ASCII, the table may conflict with the one used for
+ // 'encoding'.
+ // Also skip this for an .add.spl file, the main spell file must contain
+ // the table (avoids that it conflicts). File is shorter too.
if (!spin->si_ascii && !spin->si_add)
{
char_u folchars[128 * 8];
int flags;
- putc(SN_CHARFLAGS, fd); /* <sectionID> */
- putc(SNF_REQUIRED, fd); /* <sectionflags> */
+ putc(SN_CHARFLAGS, fd); // <sectionID>
+ putc(SNF_REQUIRED, fd); // <sectionflags>
- /* Form the <folchars> string first, we need to know its length. */
+ // Form the <folchars> string first, we need to know its length.
l = 0;
for (i = 128; i < 256; ++i)
{
@@ -4916,9 +4915,9 @@ write_vim_spell(spellinfo_T *spin, char_u *fname)
else
folchars[l++] = spelltab.st_fold[i];
}
- put_bytes(fd, (long_u)(1 + 128 + 2 + l), 4); /* <sectionlen> */
+ put_bytes(fd, (long_u)(1 + 128 + 2 + l), 4); // <sectionlen>
- fputc(128, fd); /* <charflagslen> */
+ fputc(128, fd); // <charflagslen>
for (i = 128; i < 256; ++i)
{
flags = 0;
@@ -4926,51 +4925,51 @@ write_vim_spell(spellinfo_T *spin, char_u *fname)
flags |= CF_WORD;
if (spelltab.st_isu[i])
flags |= CF_UPPER;
- fputc(flags, fd); /* <charflags> */
+ fputc(flags, fd); // <charflags>
}
- put_bytes(fd, (long_u)l, 2); /* <folcharslen> */
- fwv &= fwrite(folchars, (size_t)l, (size_t)1, fd); /* <folchars> */
+ put_bytes(fd, (long_u)l, 2); // <folcharslen>
+ fwv &= fwrite(folchars, (size_t)l, (size_t)1, fd); // <folchars>
}
- /* SN_MIDWORD: <midword> */
+ // SN_MIDWORD: <midword>
if (spin->si_midword != NULL)
{
- putc(SN_MIDWORD, fd); /* <sectionID> */
- putc(SNF_REQUIRED, fd); /* <sectionflags> */
+ putc(SN_MIDWORD, fd); // <sectionID>
+ putc(SNF_REQUIRED, fd); // <sectionflags>
i = (int)STRLEN(spin->si_midword);
- put_bytes(fd, (long_u)i, 4); /* <sectionlen> */
+ put_bytes(fd, (long_u)i, 4); // <sectionlen>
fwv &= fwrite(spin->si_midword, (size_t)i, (size_t)1, fd);
- /* <midword> */
+ // <midword>
}
- /* SN_PREFCOND: <prefcondcnt> <prefcond> ... */
+ // SN_PREFCOND: <prefcondcnt> <prefcond> ...
if (spin->si_prefcond.ga_len > 0)
{
- putc(SN_PREFCOND, fd); /* <sectionID> */
- putc(SNF_REQUIRED, fd); /* <sectionflags> */
+ putc(SN_PREFCOND, fd); // <sectionID>
+ putc(SNF_REQUIRED, fd); // <sectionflags>
l = write_spell_prefcond(NULL, &spin->si_prefcond);
- put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
+ put_bytes(fd, (long_u)l, 4); // <sectionlen>
write_spell_prefcond(fd, &spin->si_prefcond);
}
- /* SN_REP: <repcount> <rep> ...
- * SN_SAL: <salflags> <salcount> <sal> ...
- * SN_REPSAL: <repcount> <rep> ... */
+ // SN_REP: <repcount> <rep> ...
+ // SN_SAL: <salflags> <salcount> <sal> ...
+ // SN_REPSAL: <repcount> <rep> ...
- /* round 1: SN_REP section
- * round 2: SN_SAL section (unless SN_SOFO is used)
- * round 3: SN_REPSAL section */
+ // round 1: SN_REP section
+ // round 2: SN_SAL section (unless SN_SOFO is used)
+ // round 3: SN_REPSAL section
for (round = 1; round <= 3; ++round)
{
if (round == 1)
gap = &spin->si_rep;
else if (round == 2)
{
- /* Don't write SN_SAL when using a SN_SOFO section */
+ // Don't write SN_SAL when using a SN_SOFO section
if (spin->si_sofofr != NULL && spin->si_sofoto != NULL)
continue;
gap = &spin->si_sal;
@@ -4978,32 +4977,32 @@ write_vim_spell(spellinfo_T *spin, char_u *fname)
else
gap = &spin->si_repsal;
- /* Don't write the section if there are no items. */
+ // Don't write the section if there are no items.
if (gap->ga_len == 0)
continue;
- /* Sort the REP/REPSAL items. */
+ // Sort the REP/REPSAL items.
if (round != 2)
qsort(gap->ga_data, (size_t)gap->ga_len,
sizeof(fromto_T), rep_compare);
i = round == 1 ? SN_REP : (round == 2 ? SN_SAL : SN_REPSAL);
- putc(i, fd); /* <sectionID> */
+ putc(i, fd); // <sectionID>
- /* This is for making suggestions, section is not required. */
- putc(0, fd); /* <sectionflags> */
+ // This is for making suggestions, section is not required.
+ putc(0, fd); // <sectionflags>
- /* Compute the length of what follows. */
- l = 2; /* count <repcount> or <salcount> */
+ // Compute the length of what follows.
+ l = 2; // count <repcount> or <salcount>
for (i = 0; i < gap->ga_len; ++i)
{
ftp = &((fromto_T *)gap->ga_data)[i];
- l += 1 + (int)STRLEN(ftp->ft_from); /* count <*fromlen> and <*from> */
- l += 1 + (int)STRLEN(ftp->ft_to); /* count <*tolen> and <*to> */
+ l += 1 + (int)STRLEN(ftp->ft_from); // count <*fromlen> and <*from>
+ l += 1 + (int)STRLEN(ftp->ft_to); // count <*tolen> and <*to>
}
if (round == 2)
- ++l; /* count <salflags> */
- put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
+ ++l; // count <salflags>
+ put_bytes(fd, (long_u)l, 4); // <sectionlen>
if (round == 2)
{
@@ -5014,14 +5013,14 @@ write_vim_spell(spellinfo_T *spin, char_u *fname)
i |= SAL_COLLAPSE;
if (spin->si_rem_accents)
i |= SAL_REM_ACCENTS;
- putc(i, fd); /* <salflags> */
+ putc(i, fd); // <salflags>
}
- put_bytes(fd, (long_u)gap->ga_len, 2); /* <repcount> or <salcount> */
+ put_bytes(fd, (long_u)gap->ga_len, 2); // <repcount> or <salcount>
for (i = 0; i < gap->ga_len; ++i)
{
- /* <rep> : <repfromlen> <repfrom> <reptolen> <repto> */
- /* <sal> : <salfromlen> <salfrom> <saltolen> <salto> */
+ // <rep> : <repfromlen> <repfrom> <reptolen> <repto>
+ // <sal> : <salfromlen> <salfrom> <saltolen> <salto>
ftp = &((fromto_T *)gap->ga_data)[i];
for (rr = 1; rr <= 2; ++rr)
{
@@ -5035,34 +5034,34 @@ write_vim_spell(spellinfo_T *spin, char_u *fname)
}
- /* SN_SOFO: <sofofromlen> <sofofrom> <sofotolen> <sofoto>
- * This is for making suggestions, section is not required. */
+ // SN_SOFO: <sofofromlen> <sofofrom> <sofotolen> <sofoto>
+ // This is for making suggestions, section is not required.
if (spin->si_sofofr != NULL && spin->si_sofoto != NULL)
{
- putc(SN_SOFO, fd); /* <sectionID> */
- putc(0, fd); /* <sectionflags> */
+ putc(SN_SOFO, fd); // <sectionID>
+ putc(0, fd); // <sectionflags>
l = (int)STRLEN(spin->si_sofofr);
put_bytes(fd, (long_u)(l + STRLEN(spin->si_sofoto) + 4), 4);
- /* <sectionlen> */
+ // <sectionlen>
- put_bytes(fd, (long_u)l, 2); /* <sofofromlen> */
- fwv &= fwrite(spin->si_sofofr, l, (size_t)1, fd); /* <sofofrom> */
+ put_bytes(fd, (long_u)l, 2); // <sofofromlen>
+ fwv &= fwrite(spin->si_sofofr, l, (size_t)1, fd); // <sofofrom>
l = (int)STRLEN(spin->si_sofoto);
- put_bytes(fd, (long_u)l, 2); /* <sofotolen> */
- fwv &= fwrite(spin->si_sofoto, l, (size_t)1, fd); /* <sofoto> */
+ put_bytes(fd, (long_u)l, 2); // <sofotolen>
+ fwv &= fwrite(spin->si_sofoto, l, (size_t)1, fd); // <sofoto>
}
- /* SN_WORDS: <word> ...
- * This is for making suggestions, section is not required. */
+ // SN_WORDS: <word> ...
+ // This is for making suggestions, section is not required.
if (spin->si_commonwords.ht_used > 0)
{
- putc(SN_WORDS, fd); /* <sectionID> */
- putc(0, fd); /* <sectionflags> */
+ putc(SN_WORDS, fd); // <sectionID>
+ putc(0, fd); // <sectionflags>
- /* round 1: count the bytes
- * round 2: write the bytes */
+ // round 1: count the bytes
+ // round 2: write the bytes
for (round = 1; round <= 2; ++round)
{
int todo;
@@ -5075,123 +5074,123 @@ write_vim_spell(spellinfo_T *spin, char_u *fname)
{
l = (int)STRLEN(hi->hi_key) + 1;
len += l;
- if (round == 2) /* <word> */
+ if (round == 2) // <word>
fwv &= fwrite(hi->hi_key, (size_t)l, (size_t)1, fd);
--todo;
}
if (round == 1)
- put_bytes(fd, (long_u)len, 4); /* <sectionlen> */
+ put_bytes(fd, (long_u)len, 4); // <sectionlen>
}
}
- /* SN_MAP: <mapstr>
- * This is for making suggestions, section is not required. */
+ // SN_MAP: <mapstr>
+ // This is for making suggestions, section is not required.
if (spin->si_map.ga_len > 0)
{
- putc(SN_MAP, fd); /* <sectionID> */
- putc(0, fd); /* <sectionflags> */
+ putc(SN_MAP, fd); // <sectionID>
+ putc(0, fd); // <sectionflags>
l = spin->si_map.ga_len;
- put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
+ put_bytes(fd, (long_u)l, 4); // <sectionlen>
fwv &= fwrite(spin->si_map.ga_data, (size_t)l, (size_t)1, fd);
- /* <mapstr> */
+ // <mapstr>
}
- /* SN_SUGFILE: <timestamp>
- * This is used to notify that a .sug file may be available and at the
- * same time allows for checking that a .sug file that is found matches
- * with this .spl file. That's because the word numbers must be exactly
- * right. */
+ // SN_SUGFILE: <timestamp>
+ // This is used to notify that a .sug file may be available and at the
+ // same time allows for checking that a .sug file that is found matches
+ // with this .spl file. That's because the word numbers must be exactly
+ // right.
if (!spin->si_nosugfile
&& (spin->si_sal.ga_len > 0
|| (spin->si_sofofr != NULL && spin->si_sofoto != NULL)))
{
- putc(SN_SUGFILE, fd); /* <sectionID> */
- putc(0, fd); /* <sectionflags> */
- put_bytes(fd, (long_u)8, 4); /* <sectionlen> */
+ putc(SN_SUGFILE, fd); // <sectionID>
+ putc(0, fd); // <sectionflags>
+ put_bytes(fd, (long_u)8, 4); // <sectionlen>
- /* Set si_sugtime and write it to the file. */
+ // Set si_sugtime and write it to the file.
spin->si_sugtime = time(NULL);
- put_time(fd, spin->si_sugtime); /* <timestamp> */
+ put_time(fd, spin->si_sugtime); // <timestamp>
}
- /* SN_NOSPLITSUGS: nothing
- * This is used to notify that no suggestions with word splits are to be
- * made. */
+ // SN_NOSPLITSUGS: nothing
+ // This is used to notify that no suggestions with word splits are to be
+ // made.
if (spin->si_nosplitsugs)
{
- putc(SN_NOSPLITSUGS, fd); /* <sectionID> */
- putc(0, fd); /* <sectionflags> */
- put_bytes(fd, (long_u)0, 4); /* <sectionlen> */
+ putc(SN_NOSPLITSUGS, fd); // <sectionID>
+ putc(0, fd); // <sectionflags>
+ put_bytes(fd, (long_u)0, 4); // <sectionlen>
}
- /* SN_NOCOMPUNDSUGS: nothing
- * This is used to notify that no suggestions with compounds are to be
- * made. */
+ // SN_NOCOMPUNDSUGS: nothing
+ // This is used to notify that no suggestions with compounds are to be
+ // made.
if (spin->si_nocompoundsugs)
{
- putc(SN_NOCOMPOUNDSUGS, fd); /* <sectionID> */
- putc(0, fd); /* <sectionflags> */
- put_bytes(fd, (long_u)0, 4); /* <sectionlen> */
+ putc(SN_NOCOMPOUNDSUGS, fd); // <sectionID>
+ putc(0, fd); // <sectionflags>
+ put_bytes(fd, (long_u)0, 4); // <sectionlen>
}
- /* SN_COMPOUND: compound info.
- * We don't mark it required, when not supported all compound words will
- * be bad words. */
+ // SN_COMPOUND: compound info.
+ // We don't mark it required, when not supported all compound words will
+ // be bad words.
if (spin->si_compflags != NULL)
{
- putc(SN_COMPOUND, fd); /* <sectionID> */
- putc(0, fd); /* <sectionflags> */
+ putc(SN_COMPOUND, fd); // <sectionID>
+ putc(0, fd); // <sectionflags>
l = (int)STRLEN(spin->si_compflags);
for (i = 0; i < spin->si_comppat.ga_len; ++i)
l += (int)STRLEN(((char_u **)(spin->si_comppat.ga_data))[i]) + 1;
- put_bytes(fd, (long_u)(l + 7), 4); /* <sectionlen> */
+ put_bytes(fd, (long_u)(l + 7), 4); // <sectionlen>
- putc(spin->si_compmax, fd); /* <compmax> */
- putc(spin->si_compminlen, fd); /* <compminlen> */
- putc(spin->si_compsylmax, fd); /* <compsylmax> */
- putc(0, fd); /* for Vim 7.0b compatibility */
- putc(spin->si_compoptions, fd); /* <compoptions> */
+ putc(spin->si_compmax, fd); // <compmax>
+ putc(spin->si_compminlen, fd); // <compminlen>
+ putc(spin->si_compsylmax, fd); // <compsylmax>
+ putc(0, fd); // for Vim 7.0b compatibility
+ putc(spin->si_compoptions, fd); // <compoptions>
put_bytes(fd, (long_u)spin->si_comppat.ga_len, 2);
- /* <comppatcount> */
+ // <comppatcount>
for (i = 0; i < spin->si_comppat.ga_len; ++i)
{
p = ((char_u **)(spin->si_comppat.ga_data))[i];
- putc((int)STRLEN(p), fd); /* <comppatlen> */
+ putc((int)STRLEN(p), fd); // <comppatlen>
fwv &= fwrite(p, (size_t)STRLEN(p), (size_t)1, fd);
- /* <comppattext> */
+ // <comppattext>
}
- /* <compflags> */
+ // <compflags>
fwv &= fwrite(spin->si_compflags, (size_t)STRLEN(spin->si_compflags),
(size_t)1, fd);
}
- /* SN_NOBREAK: NOBREAK flag */
+ // SN_NOBREAK: NOBREAK flag
if (spin->si_nobreak)
{
- putc(SN_NOBREAK, fd); /* <sectionID> */
- putc(0, fd); /* <sectionflags> */
+ putc(SN_NOBREAK, fd); // <sectionID>
+ putc(0, fd); // <sectionflags>
- /* It's empty, the presence of the section flags the feature. */
- put_bytes(fd, (long_u)0, 4); /* <sectionlen> */
+ // It's empty, the presence of the section flags the feature.
+ put_bytes(fd, (long_u)0, 4); // <sectionlen>
}
- /* SN_SYLLABLE: syllable info.
- * We don't mark it required, when not supported syllables will not be
- * counted. */
+ // SN_SYLLABLE: syllable info.
+ // We don't mark it required, when not supported syllables will not be
+ // counted.
if (spin->si_syllable != NULL)
{
- putc(SN_SYLLABLE, fd); /* <sectionID> */
- putc(0, fd); /* <sectionflags> */
+ putc(SN_SYLLABLE, fd); // <sectionID>
+ putc(0, fd); // <sectionflags>
l = (int)STRLEN(spin->si_syllable);
- put_bytes(fd, (long_u)l, 4); /* <sectionlen> */
+ put_bytes(fd, (long_u)l, 4); // <sectionlen>
fwv &= fwrite(spin->si_syllable, (size_t)l, (size_t)1, fd);
- /* <syllable> */
+ // <syllable>
}
- /* end of <SECTIONS> */
- putc(SN_END, fd); /* <sectionend> */
+ // end of <SECTIONS>
+ putc(SN_END, fd); // <sectionend>
/*
@@ -5207,23 +5206,23 @@ write_vim_spell(spellinfo_T *spin, char_u *fname)
else
tree = spin->si_prefroot->wn_sibling;
- /* Clear the index and wnode fields in the tree. */
+ // Clear the index and wnode fields in the tree.
clear_node(tree);
- /* Count the number of nodes. Needed to be able to allocate the
- * memory when reading the nodes. Also fills in index for shared
- * nodes. */
+ // Count the number of nodes. Needed to be able to allocate the
+ // memory when reading the nodes. Also fills in index for shared
+ // nodes.
nodecount = put_node(NULL, tree, 0, regionmask, round == 3);
- /* number of nodes in 4 bytes */
- put_bytes(fd, (long_u)nodecount, 4); /* <nodecount> */
+ // number of nodes in 4 bytes
+ put_bytes(fd, (long_u)nodecount, 4); // <nodecount>
spin->si_memtot += nodecount + nodecount * sizeof(int);
- /* Write the nodes. */
+ // Write the nodes.
(void)put_node(fd, tree, 0, regionmask, round == 3);
}
- /* Write another byte to check for errors (file system full). */
+ // Write another byte to check for errors (file system full).
if (putc(0, fd) == EOF)
retval = FAIL;
theend:
@@ -5274,59 +5273,59 @@ clear_node(wordnode_T *node)
*/
static int
put_node(
- FILE *fd, /* NULL when only counting */
+ FILE *fd, // NULL when only counting
wordnode_T *node,
int idx,
int regionmask,
- int prefixtree) /* TRUE for PREFIXTREE */
+ int prefixtree) // TRUE for PREFIXTREE
{
int newindex = idx;
int siblingcount = 0;
wordnode_T *np;
int flags;
- /* If "node" is zero the tree is empty. */
+ // If "node" is zero the tree is empty.
if (node == NULL)
return 0;
- /* Store the index where this node is written. */
+ // Store the index where this node is written.
node->wn_u1.index = idx;
- /* Count the number of siblings. */
+ // Count the number of siblings.
for (np = node; np != NULL; np = np->wn_sibling)
++siblingcount;
- /* Write the sibling count. */
+ // Write the sibling count.
if (fd != NULL)
- putc(siblingcount, fd); /* <siblingcount> */
+ putc(siblingcount, fd); // <siblingcount>
- /* Write each sibling byte and optionally extra info. */
+ // Write each sibling byte and optionally extra info.
for (np = node; np != NULL; np = np->wn_sibling)
{
if (np->wn_byte == 0)
{
if (fd != NULL)
{
- /* For a NUL byte (end of word) write the flags etc. */
+ // For a NUL byte (end of word) write the flags etc.
if (prefixtree)
{
- /* In PREFIXTREE write the required affixID and the
- * associated condition nr (stored in wn_region). The
- * byte value is misused to store the "rare" and "not
- * combining" flags */
+ // In PREFIXTREE write the required affixID and the
+ // associated condition nr (stored in wn_region). The
+ // byte value is misused to store the "rare" and "not
+ // combining" flags
if (np->wn_flags == (short_u)PFX_FLAGS)
- putc(BY_NOFLAGS, fd); /* <byte> */
+ putc(BY_NOFLAGS, fd); // <byte>
else
{
- putc(BY_FLAGS, fd); /* <byte> */
- putc(np->wn_flags, fd); /* <pflags> */
+ putc(BY_FLAGS, fd); // <byte>
+ putc(np->wn_flags, fd); // <pflags>
}
- putc(np->wn_affixID, fd); /* <affixID> */
- put_bytes(fd, (long_u)np->wn_region, 2); /* <prefcondnr> */
+ putc(np->wn_affixID, fd); // <affixID>
+ put_bytes(fd, (long_u)np->wn_region, 2); // <prefcondnr>
}
else
{
- /* For word trees we write the flag/region items. */
+ // For word trees we write the flag/region items.
flags = np->wn_flags;
if (regionmask != 0 && np->wn_region != regionmask)
flags |= WF_REGION;
@@ -5334,26 +5333,26 @@ put_node(
flags |= WF_AFX;
if (flags == 0)
{
- /* word without flags or region */
- putc(BY_NOFLAGS, fd); /* <byte> */
+ // word without flags or region
+ putc(BY_NOFLAGS, fd); // <byte>
}
else
{
if (np->wn_flags >= 0x100)
{
- putc(BY_FLAGS2, fd); /* <byte> */
- putc(flags, fd); /* <flags> */
- putc((unsigned)flags >> 8, fd); /* <flags2> */
+ putc(BY_FLAGS2, fd); // <byte>
+ putc(flags, fd); // <flags>
+ putc((unsigned)flags >> 8, fd); // <flags2>
}
else
{
- putc(BY_FLAGS, fd); /* <byte> */
- putc(flags, fd); /* <flags> */
+ putc(BY_FLAGS, fd); // <byte>
+ putc(flags, fd); // <flags>
}
if (flags & WF_REGION)
- putc(np->wn_region, fd); /* <region> */
+ putc(np->wn_region, fd); // <region>
if (flags & WF_AFX)
- putc(np->wn_affixID, fd); /* <affixID> */
+ putc(np->wn_affixID, fd); // <affixID>
}
}
}
@@ -5363,20 +5362,20 @@ put_node(
if (np->wn_child->wn_u1.index != 0
&& np->wn_child->wn_u2.wnode != node)
{
- /* The child is written elsewhere, write the reference. */
+ // The child is written elsewhere, write the reference.
if (fd != NULL)
{
- putc(BY_INDEX, fd); /* <byte> */
- /* <nodeidx> */
+ putc(BY_INDEX, fd); // <byte>
+ // <nodeidx>
put_bytes(fd, (long_u)np->wn_child->wn_u1.index, 3);
}
}
else if (np->wn_child->wn_u2.wnode == NULL)
- /* We will write the child below and give it an index. */
+ // We will write the child below and give it an index.
np->wn_child->wn_u2.wnode = node;
if (fd != NULL)
- if (putc(np->wn_byte, fd) == EOF) /* <byte> or <xbyte> */
+ if (putc(np->wn_byte, fd) == EOF) // <byte> or <xbyte>
{
emsg(_(e_write));
return 0;
@@ -5384,11 +5383,11 @@ put_node(
}
}
- /* Space used in the array when reading: one for each sibling and one for
- * the count. */
+ // Space used in the array when reading: one for each sibling and one for
+ // the count.
newindex += siblingcount + 1;
- /* Recursively dump the children of each sibling. */
+ // Recursively dump the children of each sibling.
for (np = node; np != NULL; np = np->wn_sibling)
if (np->wn_byte != 0 && np->wn_child->wn_u2.wnode == node)
newindex = put_node(fd, np->wn_child, newindex, regionmask,
@@ -5416,7 +5415,7 @@ ex_mkspell(exarg_T *eap)
arg = skipwhite(arg + 6);
}
- /* Expand all the remaining arguments (e.g., $VIMRUNTIME). */
+ // Expand all the remaining arguments (e.g., $VIMRUNTIME).
if (get_arglist_exp(arg, &fcount, &fnames, FALSE) == OK)
{
mkspell(fcount, fnames, ascii, eap->forceit, FALSE);
@@ -5461,7 +5460,7 @@ spell_make_sugfile(spellinfo_T *spin, char_u *wfname)
*/
spin->si_blocks = NULL;
spin->si_blocks_cnt = 0;
- spin->si_compress_cnt = 0; /* will stay at 0 all the time*/
+ spin->si_compress_cnt = 0; // will stay at 0 all the time
spin->si_free_count = 0;
spin->si_first_free = NULL;
spin->si_foldwcount = 0;
@@ -5531,12 +5530,12 @@ sug_filltree(spellinfo_T *spin, slang_T *slang)
unsigned words_done = 0;
int wordcount[MAXWLEN];
- /* We use si_foldroot for the soundfolded trie. */
+ // We use si_foldroot for the soundfolded trie.
spin->si_foldroot = wordtree_alloc(spin);
if (spin->si_foldroot == NULL)
return FAIL;
- /* let tree_add_word() know we're adding to the soundfolded tree */
+ // let tree_add_word() know we're adding to the soundfolded tree
spin->si_sugtree = TRUE;
/*
@@ -5555,7 +5554,7 @@ sug_filltree(spellinfo_T *spin, slang_T *slang)
{
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.
idxs[arridx[depth]] = wordcount[depth];
if (depth > 0)
wordcount[depth - 1] += wordcount[depth];
@@ -5566,19 +5565,19 @@ sug_filltree(spellinfo_T *spin, slang_T *slang)
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)
{
- /* Sound-fold the word. */
+ // Sound-fold the word.
tword[depth] = NUL;
spell_soundfold(slang, tword, TRUE, tsalword);
- /* We use the "flags" field for the MSB of the wordnr,
- * "region" for the LSB of the wordnr. */
+ // We use the "flags" field for the MSB of the wordnr,
+ // "region" for the LSB of the wordnr.
if (tree_add_word(spin, tsalword, spin->si_foldroot,
words_done >> 16, words_done & 0xffff,
0) == FAIL)
@@ -5587,12 +5586,12 @@ sug_filltree(spellinfo_T *spin, slang_T *slang)
++words_done;
++wordcount[depth];
- /* Reset the block count each time to avoid compression
- * kicking in. */
+ // Reset the block count each time to avoid compression
+ // kicking in.
spin->si_blocks_cnt = 0;
- /* Skip over any other NUL bytes (same word with different
- * flags). */
+ // Skip over any other NUL bytes (same word with different
+ // flags).
while (byts[n + 1] == 0)
{
++n;
@@ -5601,7 +5600,7 @@ sug_filltree(spellinfo_T *spin, slang_T *slang)
}
else
{
- /* Normal char, go one level deeper. */
+ // Normal char, go one level deeper.
tword[depth++] = c;
arridx[depth] = idxs[n];
curi[depth] = 1;
@@ -5628,17 +5627,17 @@ sug_maketable(spellinfo_T *spin)
garray_T ga;
int res = OK;
- /* Allocate a buffer, open a memline for it and create the swap file
- * (uses a temp file, not a .swp file). */
+ // Allocate a buffer, open a memline for it and create the swap file
+ // (uses a temp file, not a .swp file).
spin->si_spellbuf = open_spellbuf();
if (spin->si_spellbuf == NULL)
return FAIL;
- /* Use a buffer to store the line info, avoids allocating many small
- * pieces of memory. */
+ // Use a buffer to store the line info, avoids allocating many small
+ // pieces of memory.
ga_init2(&ga, 1, 100);
- /* recursively go through the tree */
+ // recursively go through the tree
if (sug_filltable(spin, spin->si_foldroot->wn_sibling, 0, &ga) == -1)
res = FAIL;
@@ -5656,7 +5655,7 @@ sug_filltable(
spellinfo_T *spin,
wordnode_T *node,
int startwordnr,
- garray_T *gap) /* place to store line of numbers */
+ garray_T *gap) // place to store line of numbers
{
wordnode_T *p, *np;
int wordnr = startwordnr;
@@ -5675,17 +5674,17 @@ sug_filltable(
return -1;
nr = (np->wn_flags << 16) + (np->wn_region & 0xffff);
- /* Compute the offset from the previous nr and store the
- * offset in a way that it takes a minimum number of bytes.
- * It's a bit like utf-8, but without the need to mark
- * following bytes. */
+ // Compute the offset from the previous nr and store the
+ // offset in a way that it takes a minimum number of bytes.
+ // It's a bit like utf-8, but without the need to mark
+ // following bytes.
nr -= prev_nr;
prev_nr += nr;
gap->ga_len += offset2bytes(nr,
(char_u *)gap->ga_data + gap->ga_len);
}
- /* add the NUL byte */
+ // add the NUL byte
((char_u *)gap->ga_data)[gap->ga_len++] = NUL;
if (ml_append_buf(spin->si_spellbuf, (linenr_T)wordnr,
@@ -5693,13 +5692,13 @@ sug_filltable(
return -1;
++wordnr;
- /* Remove extra NUL entries, we no longer need them. We don't
- * bother freeing the nodes, the won't be reused anyway. */
+ // Remove extra NUL entries, we no longer need them. We don't
+ // bother freeing the nodes, the won't be reused anyway.
while (p->wn_sibling != NULL && p->wn_sibling->wn_byte == NUL)
p->wn_sibling = p->wn_sibling->wn_sibling;
- /* Clear the flags on the remaining NUL node, so that compression
- * works a lot better. */
+ // Clear the flags on the remaining NUL node, so that compression
+ // works a lot better.
p->wn_flags = 0;
p->wn_region = 0;
}
@@ -5724,7 +5723,7 @@ offset2bytes(int nr, char_u *buf)
int rem;
int b1, b2, b3, b4;
- /* Split the number in parts of base 255. We need to avoid NUL bytes. */
+ // Split the number in parts of base 255. We need to avoid NUL bytes.
b1 = nr % 255 + 1;
rem = nr / 255;
b2 = rem % 255 + 1;
@@ -5732,7 +5731,7 @@ offset2bytes(int nr, char_u *buf)
b3 = rem % 255 + 1;
b4 = rem / 255 + 1;
- if (b4 > 1 || b3 > 0x1f) /* 4 bytes */
+ if (b4 > 1 || b3 > 0x1f) // 4 bytes
{
buf[0] = 0xe0 + b4;
buf[1] = b3;
@@ -5740,20 +5739,20 @@ offset2bytes(int nr, char_u *buf)
buf[3] = b1;
return 4;
}
- if (b3 > 1 || b2 > 0x3f ) /* 3 bytes */
+ if (b3 > 1 || b2 > 0x3f ) // 3 bytes
{
buf[0] = 0xc0 + b3;
buf[1] = b2;
buf[2] = b1;
return 3;
}
- if (b2 > 1 || b1 > 0x7f ) /* 2 bytes */
+ if (b2 > 1 || b1 > 0x7f ) // 2 bytes
{
buf[0] = 0x80 + b2;
buf[1] = b1;
return 2;
}
- /* 1 byte */
+ // 1 byte
buf[0] = b1;
return 1;
}
@@ -5772,7 +5771,7 @@ sug_write(spellinfo_T *spin, char_u *fname)
linenr_T lnum;
int len;
- /* Create the file. Note that an existing file is silently overwritten! */
+ // Create the file. Note that an existing file is silently overwritten!
fd = mch_fopen((char *)fname, "w");
if (fd == NULL)
{
@@ -5787,15 +5786,15 @@ sug_write(spellinfo_T *spin, char_u *fname)
/*
* <SUGHEADER>: <fileID> <versionnr> <timestamp>
*/
- if (fwrite(VIMSUGMAGIC, VIMSUGMAGICL, (size_t)1, fd) != 1) /* <fileID> */
+ if (fwrite(VIMSUGMAGIC, VIMSUGMAGICL, (size_t)1, fd) != 1) // <fileID>
{
emsg(_(e_write));
goto theend;
}
- putc(VIMSUGVERSION, fd); /* <versionnr> */
+ putc(VIMSUGVERSION, fd); // <versionnr>
- /* Write si_sugtime to the file. */
- put_time(fd, spin->si_sugtime); /* <timestamp> */
+ // Write si_sugtime to the file.
+ put_time(fd, spin->si_sugtime); // <timestamp>
/*
* <SUGWORDTREE>
@@ -5803,30 +5802,30 @@ sug_write(spellinfo_T *spin, char_u *fname)
spin->si_memtot = 0;
tree = spin->si_foldroot->wn_sibling;
- /* Clear the index and wnode fields in the tree. */
+ // Clear the index and wnode fields in the tree.
clear_node(tree);
- /* Count the number of nodes. Needed to be able to allocate the
- * memory when reading the nodes. Also fills in index for shared
- * nodes. */
+ // Count the number of nodes. Needed to be able to allocate the
+ // memory when reading the nodes. Also fills in index for shared
+ // nodes.
nodecount = put_node(NULL, tree, 0, 0, FALSE);
- /* number of nodes in 4 bytes */
- put_bytes(fd, (long_u)nodecount, 4); /* <nodecount> */
+ // number of nodes in 4 bytes
+ put_bytes(fd, (long_u)nodecount, 4); // <nodecount>
spin->si_memtot += nodecount + nodecount * sizeof(int);
- /* Write the nodes. */
+ // Write the nodes.
(void)put_node(fd, tree, 0, 0, FALSE);
/*
* <SUGTABLE>: <sugwcount> <sugline> ...
*/
wcount = spin->si_spellbuf->b_ml.ml_line_count;
- put_bytes(fd, (long_u)wcount, 4); /* <sugwcount> */
+ put_bytes(fd, (long_u)wcount, 4); // <sugwcount>
for (lnum = 1; lnum <= (linenr_T)wcount; ++lnum)
{
- /* <sugline>: <sugnr> ... NUL */
+ // <sugline>: <sugnr> ... NUL
line = ml_get_buf(spin->si_spellbuf, lnum, FALSE);
len = (int)STRLEN(line) + 1;
if (fwrite(line, (size_t)len, (size_t)1, fd) == 0)
@@ -5837,7 +5836,7 @@ sug_write(spellinfo_T *spin, char_u *fname)
spin->si_memtot += len;
}
- /* Write another byte to check for errors. */
+ // Write another byte to check for errors.
if (putc(0, fd) == EOF)
emsg(_(e_write));
@@ -5846,7 +5845,7 @@ sug_write(spellinfo_T *spin, char_u *fname)
spell_message(spin, IObuff);
theend:
- /* close the file */
+ // close the file
fclose(fd);
}
@@ -5862,9 +5861,9 @@ theend:
mkspell(
int fcount,
char_u **fnames,
- int ascii, /* -ascii argument given */
- int over_write, /* overwrite existing output file */
- int added_word) /* invoked through "zg" */
+ int ascii, // -ascii argument given
+ int over_write, // overwrite existing output file
+ int added_word) // invoked through "zg"
{
char_u *fname = NULL;
char_u *wfname;
@@ -5889,9 +5888,9 @@ mkspell(
ga_init2(&spin.si_comppat, (int)sizeof(char_u *), 20);
ga_init2(&spin.si_prefcond, (int)sizeof(char_u *), 50);
hash_init(&spin.si_commonwords);
- spin.si_newcompID = 127; /* start compound ID at first maximum */
+ spin.si_newcompID = 127; // start compound ID at first maximum
- /* default: fnames[0] is output file, following are input files */
+ // default: fnames[0] is output file, following are input files
innames = &fnames[1];
incount = fcount - 1;
@@ -5904,15 +5903,15 @@ mkspell(
len = (int)STRLEN(fnames[0]);
if (fcount == 1 && len > 4 && STRCMP(fnames[0] + len - 4, ".add") == 0)
{
- /* For ":mkspell path/en.latin1.add" output file is
- * "path/en.latin1.add.spl". */
+ // For ":mkspell path/en.latin1.add" output file is
+ // "path/en.latin1.add.spl".
innames = &fnames[0];
incount = 1;
vim_snprintf((char *)wfname, MAXPATHL, "%s.spl", fnames[0]);
}
else if (fcount == 1)
{
- /* For ":mkspell path/vim" output file is "path/vim.latin1.spl". */
+ // For ":mkspell path/vim" output file is "path/vim.latin1.spl".
innames = &fnames[0];
incount = 1;
vim_snprintf((char *)wfname, MAXPATHL, SPL_FNAME_TMPL,
@@ -5920,33 +5919,33 @@ mkspell(
}
else if (len > 4 && STRCMP(fnames[0] + len - 4, ".spl") == 0)
{
- /* Name ends in ".spl", use as the file name. */
+ // Name ends in ".spl", use as the file name.
vim_strncpy(wfname, fnames[0], MAXPATHL - 1);
}
else
- /* Name should be language, make the file name from it. */
+ // Name should be language, make the file name from it.
vim_snprintf((char *)wfname, MAXPATHL, SPL_FNAME_TMPL,
fnames[0], spin.si_ascii ? (char_u *)"ascii" : spell_enc());
- /* Check for .ascii.spl. */
+ // Check for .ascii.spl.
if (strstr((char *)gettail(wfname), SPL_FNAME_ASCII) != NULL)
spin.si_ascii = TRUE;
- /* Check for .add.spl. */
+ // Check for .add.spl.
if (strstr((char *)gettail(wfname), SPL_FNAME_ADD) != NULL)
spin.si_add = TRUE;
}
if (incount <= 0)
- emsg(_(e_invarg)); /* need at least output and input names */
+ emsg(_(e_invarg)); // need at least output and input names
else if (vim_strchr(gettail(wfname), '_') != NULL)
emsg(_("E751: Output file name must not have region name"));
else if (incount > MAXREGIONS)
semsg(_("E754: Only up to %d regions supported"), MAXREGIONS);
else
{
- /* Check for overwriting before doing things that may take a lot of
- * time. */
+ // Check for overwriting before doing things that may take a lot of
+ // time.
if (!over_write && mch_stat((char *)wfname, &st) >= 0)
{
emsg(_(e_exists));
@@ -5997,11 +5996,11 @@ mkspell(
goto theend;
}
- /* When not producing a .add.spl file clear the character table when
- * we encounter one in the .aff file. This means we dump the current
- * one in the .spl file if the .aff file doesn't define one. That's
- * better than guessing the contents, the table will match a
- * previously loaded spell file. */
+ // When not producing a .add.spl file clear the character table when
+ // we encounter one in the .aff file. This means we dump the current
+ // one in the .spl file if the .aff file doesn't define one. That's
+ // better than guessing the contents, the table will match a
+ // previously loaded spell file.
if (!spin.si_add)
spin.si_clear_chartab = TRUE;
@@ -6018,14 +6017,14 @@ mkspell(
vim_snprintf((char *)fname, MAXPATHL, "%s.aff", innames[i]);
if (mch_stat((char *)fname, &st) >= 0)
{
- /* Read the .aff file. Will init "spin->si_conv" based on the
- * "SET" line. */
+ // Read the .aff file. Will init "spin->si_conv" based on the
+ // "SET" line.
afile[i] = spell_read_aff(&spin, fname);
if (afile[i] == NULL)
error = TRUE;
else
{
- /* Read the .dic file and store the words in the trees. */
+ // Read the .dic file and store the words in the trees.
vim_snprintf((char *)fname, MAXPATHL, "%s.dic",
innames[i]);
if (spell_read_dic(&spin, fname, afile[i]) == FAIL)
@@ -6034,13 +6033,13 @@ mkspell(
}
else
{
- /* No .aff file, try reading the file as a word list. Store
- * the words in the trees. */
+ // No .aff file, try reading the file as a word list. Store
+ // the words in the trees.
if (spell_read_wordfile(&spin, innames[i]) == FAIL)
error = TRUE;
}
- /* Free any conversion stuff. */
+ // Free any conversion stuff.
convert_setup(&spin.si_conv, NULL, NULL);
}
@@ -6081,7 +6080,7 @@ mkspell(
spell_reload_one(wfname, added_word);
}
- /* Free the allocated memory. */
+ // Free the allocated memory.
ga_clear(&spin.si_rep);
ga_clear(&spin.si_repsal);
ga_clear(&spin.si_sal);
@@ -6090,12 +6089,12 @@ mkspell(
ga_clear(&spin.si_prefcond);
hash_clear_all(&spin.si_commonwords, 0);
- /* Free the .aff file structures. */
+ // Free the .aff file structures.
for (i = 0; i < incount; ++i)
if (afile[i] != NULL)
spell_free_aff(afile[i]);
- /* Free all the bits and pieces at once. */
+ // Free all the bits and pieces at once.
free_blocks(spin.si_blocks);
/*
@@ -6168,7 +6167,7 @@ spell_add_word(
int i;
char_u *spf;
- if (idx == 0) /* use internal wordlist */
+ if (idx == 0) // use internal wordlist
{
if (int_wordlist == NULL)
{
@@ -6180,7 +6179,7 @@ spell_add_word(
}
else
{
- /* If 'spellfile' isn't set figure out a good default value. */
+ // If 'spellfile' isn't set figure out a good default value.
if (*curwin->w_s->b_p_spf == NUL)
{
init_spellfile();
@@ -6209,7 +6208,7 @@ spell_add_word(
}
}
- /* Check that the user isn't editing the .add file somewhere. */
+ // Check that the user isn't editing the .add file somewhere.
buf = buflist_findname_exp(fnamebuf);
if (buf != NULL && buf->b_ml.ml_mfp == NULL)
buf = NULL;
@@ -6225,8 +6224,8 @@ spell_add_word(
if (what == SPELL_ADD_BAD || undo)
{
- /* When the word appears as good word we need to remove that one,
- * since its flags sort before the one with WF_BANNED. */
+ // When the word appears as good word we need to remove that one,
+ // since its flags sort before the one with WF_BANNED.
fd = mch_fopen((char *)fname, "r");
if (fd != NULL)
{
@@ -6237,9 +6236,9 @@ spell_add_word(
if (STRNCMP(word, line, len) == 0
&& (line[len] == '/' || line[len] < ' '))
{
- /* Found duplicate word. Remove it by writing a '#' at
- * the start of the line. Mixing reading and writing
- * doesn't work for all systems, close the file first. */
+ // Found duplicate word. Remove it by writing a '#' at
+ // the start of the line. Mixing reading and writing
+ // doesn't work for all systems, close the file first.
fclose(fd);
fd = mch_fopen((char *)fname, "r+");
if (fd == NULL)
@@ -6269,16 +6268,16 @@ spell_add_word(
{
char_u *p;
- /* We just initialized the 'spellfile' option and can't open the
- * file. We may need to create the "spell" directory first. We
- * already checked the runtime directory is writable in
- * init_spellfile(). */
+ // We just initialized the 'spellfile' option and can't open the
+ // file. We may need to create the "spell" directory first. We
+ // already checked the runtime directory is writable in
+ // init_spellfile().
if (!dir_of_file_exists(fname) && (p = gettail_sep(fname)) != fname)
{
int c = *p;
- /* The directory doesn't exist. Try creating it and opening
- * the file again. */
+ // The directory doesn't exist. Try creating it and opening
+ // the file again.
*p = NUL;
vim_mkdir(fname, 0755);
*p = c;
@@ -6305,10 +6304,10 @@ spell_add_word(
if (fd != NULL)
{
- /* Update the .add.spl file. */
+ // Update the .add.spl file.
mkspell(1, &fname, FALSE, TRUE, TRUE);
- /* If the .add file is edited somewhere, reload it. */
+ // If the .add file is edited somewhere, reload it.
if (buf != NULL)
buf_reload(buf, buf->b_orig_mode);
@@ -6337,8 +6336,8 @@ init_spellfile(void)
if (buf == NULL)
return;
- /* Find the end of the language name. Exclude the region. If there
- * is a path separator remember the start of the tail. */
+ // Find the end of the language name. Exclude the region. If there
+ // is a path separator remember the start of the tail.
for (lend = curwin->w_s->b_p_spl; *lend != NUL
&& vim_strchr((char_u *)",._", *lend) == NULL; ++lend)
if (vim_ispathsep(*lend))
@@ -6347,29 +6346,29 @@ init_spellfile(void)
lstart = lend + 1;
}
- /* Loop over all entries in 'runtimepath'. Use the first one where we
- * are allowed to write. */
+ // Loop over all entries in 'runtimepath'. Use the first one where we
+ // are allowed to write.
rtp = p_rtp;
while (*rtp != NUL)
{
if (aspath)
- /* Use directory of an entry with path, e.g., for
- * "/dir/lg.utf-8.spl" use "/dir". */
+ // Use directory of an entry with path, e.g., for
+ // "/dir/lg.utf-8.spl" use "/dir".
vim_strncpy(buf, curbuf->b_s.b_p_spl,
lstart - curbuf->b_s.b_p_spl - 1);
else
- /* Copy the path from 'runtimepath' to buf[]. */
+ // Copy the path from 'runtimepath' to buf[].
copy_option_part(&rtp, buf, MAXPATHL, ",");
if (filewritable(buf) == 2)
{
- /* Use the first language name from 'spelllang' and the
- * encoding used in the first loaded .spl file. */
+ // Use the first language name from 'spelllang' and the
+ // encoding used in the first loaded .spl file.
if (aspath)
vim_strncpy(buf, curbuf->b_s.b_p_spl,
lend - curbuf->b_s.b_p_spl);
else
{
- /* Create the "spell" directory if it doesn't exist yet. */
+ // Create the "spell" directory if it doesn't exist yet.
l = (int)STRLEN(buf);
vim_snprintf((char *)buf + l, MAXPATHL - l, "/spell");
if (filewritable(buf) != 2)
@@ -6404,8 +6403,8 @@ init_spellfile(void)
static int
set_spell_chartab(char_u *fol, char_u *low, char_u *upp)
{
- /* We build the new tables here first, so that we can compare with the
- * previous one. */
+ // We build the new tables here first, so that we can compare with the
+ // previous one.
spelltab_T new_st;
char_u *pf = fol, *pl = low, *pu = upp;
int f, l, u;
@@ -6423,7 +6422,7 @@ set_spell_chartab(char_u *fol, char_u *low, char_u *upp)
l = mb_ptr2char_adv(&pl);
u = mb_ptr2char_adv(&pu);
- /* Every character that appears is a word character. */
+ // Every character that appears is a word character.
if (f < 256)
new_st.st_isw[f] = TRUE;
if (l < 256)
@@ -6431,8 +6430,8 @@ set_spell_chartab(char_u *fol, char_u *low, char_u *upp)
if (u < 256)
new_st.st_isw[u] = TRUE;
- /* if "LOW" and "FOL" are not the same the "LOW" char needs
- * case-folding */
+ // if "LOW" and "FOL" are not the same the "LOW" char needs
+ // case-folding
if (l < 256 && l != f)
{
if (f >= 256)
@@ -6443,9 +6442,9 @@ set_spell_chartab(char_u *fol, char_u *low, char_u *upp)
new_st.st_fold[l] = f;
}
- /* if "UPP" and "FOL" are not the same the "UPP" char needs
- * case-folding, it's upper case and the "UPP" is the upper case of
- * "FOL" . */
+ // if "UPP" and "FOL" are not the same the "UPP" char needs
+ // case-folding, it's upper case and the "UPP" is the upper case of
+ // "FOL" .
if (u < 256 && u != f)
{
if (f >= 256)
@@ -6474,11 +6473,11 @@ set_spell_chartab(char_u *fol, char_u *low, char_u *upp)
static void
set_spell_charflags(
char_u *flags,
- int cnt, /* length of "flags" */
+ int cnt, // length of "flags"
char_u *fol)
{
- /* We build the new tables here first, so that we can compare with the
- * previous one. */
+ // We build the new tables here first, so that we can compare with the
+ // previous one.
spelltab_T new_st;
int i;
char_u *p = fol;
@@ -6513,7 +6512,7 @@ set_spell_finish(spelltab_T *new_st)
if (did_set_spelltab)
{
- /* check that it's the same table */
+ // check that it's the same table
for (i = 0; i < 256; ++i)
{
if (spelltab.st_isw[i] != new_st->st_isw[i]
@@ -6528,7 +6527,7 @@ set_spell_finish(spelltab_T *new_st)
}
else
{
- /* copy the new spelltab into the one being used */
+ // copy the new spelltab into the one being used
spelltab = *new_st;
did_set_spelltab = TRUE;
}
@@ -6547,16 +6546,16 @@ write_spell_prefcond(FILE *fd, garray_T *gap)
char_u *p;
int len;
int totlen;
- size_t x = 1; /* collect return value of fwrite() */
+ size_t x = 1; // collect return value of fwrite()
if (fd != NULL)
- put_bytes(fd, (long_u)gap->ga_len, 2); /* <prefcondcnt> */
+ put_bytes(fd, (long_u)gap->ga_len, 2); // <prefcondcnt>
- totlen = 2 + gap->ga_len; /* length of <prefcondcnt> and <condlen> bytes */
+ totlen = 2 + gap->ga_len; // length of <prefcondcnt> and <condlen> bytes
for (i = 0; i < gap->ga_len; ++i)
{
- /* <prefcond> : <condlen> <condstr> */
+ // <prefcond> : <condlen> <condstr>
p = ((char_u **)gap->ga_data)[i];
if (p != NULL)
{
@@ -6594,7 +6593,7 @@ set_map_str(slang_T *lp, char_u *map)
}
lp->sl_has_map = TRUE;
- /* Init the array and hash tables empty. */
+ // Init the array and hash tables empty.
for (i = 0; i < 256; ++i)
lp->sl_map_array[i] = 0;
hash_init(&lp->sl_map_hash);
@@ -6614,9 +6613,9 @@ set_map_str(slang_T *lp, char_u *map)
if (headc == 0)
headc = c;
- /* Characters above 255 don't fit in sl_map_array[], put them in
- * the hash table. Each entry is the char, a NUL the headchar and
- * a NUL. */
+ // Characters above 255 don't fit in sl_map_array[], put them in
+ // the hash table. Each entry is the char, a NUL the headchar and
+ // a NUL.
if (c >= 256)
{
int cl = mb_char2len(c);
@@ -6638,8 +6637,8 @@ set_map_str(slang_T *lp, char_u *map)
hash_add_item(&lp->sl_map_hash, hi, b, hash);
else
{
- /* This should have been checked when generating the .spl
- * file. */
+ // This should have been checked when generating the .spl
+ // file.
emsg(_("E783: duplicate char in MAP entry"));
vim_free(b);
}
@@ -6651,4 +6650,4 @@ set_map_str(slang_T *lp, char_u *map)
}
-#endif /* FEAT_SPELL */
+#endif // FEAT_SPELL