annotate src/spell.h @ 25559:4b07859e1646 v8.2.3316

patch 8.2.3316: float test fails Commit: https://github.com/vim/vim/commit/80a070c36125662556232ab6e83da373e22953d8 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 8 15:51:10 2021 +0200 patch 8.2.3316: float test fails Problem: Float test fails. Solution: Add missing change.
author Bram Moolenaar <Bram@vim.org>
date Sun, 08 Aug 2021 16:00:03 +0200
parents 11055d5b74a7
children d92e0d85923f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10042
4aead6a9b7a9 commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents: 9583
diff changeset
1 /* vi:set ts=8 sts=4 sw=4 noet:
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2 *
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 *
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 * See README.txt for an overview of the Vim source code.
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 */
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 /*
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 * spell.h: common code for spell checking, used by spell.c and spellfile.c.
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 */
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
14 // Use SPELL_PRINTTREE for debugging: dump the word tree after adding a word.
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
15 // Only use it for small word lists!
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 #if 0
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 # define SPELL_PRINTTREE
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 #endif
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
20 // Use SPELL_COMPRESS_ALLWAYS for debugging: compress the word tree after
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
21 // adding a word. Only use it for small word lists!
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 #if 0
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 # define SPELL_COMPRESS_ALLWAYS
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 #endif
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
26 // Use DEBUG_TRIEWALK to print the changes made in suggest_trie_walk() for a
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
27 // specific word.
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 #if 0
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 # define DEBUG_TRIEWALK
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 #endif
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
32 #define MAXWLEN 254 // Assume max. word len is this many bytes.
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
33 // Some places assume a word length fits in a
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
34 // byte, thus it can't be above 255.
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
35 // Must be >= PFD_NOTSPECIAL.
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
37 #define MAXREGIONS 8 // Number of regions supported.
13232
d11bbd3440b0 patch 8.0.1490: number of spell regions is spread out through the code
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
38
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
39 // Type used for indexes in the word tree need to be at least 4 bytes. If int
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
40 // is 8 bytes we could use something smaller, but what?
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 typedef int idx_T;
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 typedef int salfirst_T;
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 /*
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 * Structure used to store words and other info for one language, loaded from
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 * a .spl file.
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 * The main access is through the tree in "sl_fbyts/sl_fidxs", storing the
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 * case-folded words. "sl_kbyts/sl_kidxs" is for keep-case words.
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 *
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 * The "byts" array stores the possible bytes in each tree node, preceded by
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 * the number of possible bytes, sorted on byte value:
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 * <len> <byte1> <byte2> ...
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 * The "idxs" array stores the index of the child node corresponding to the
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55 * byte in "byts".
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 * Exception: when the byte is zero, the word may end here and "idxs" holds
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 * the flags, region mask and affixID for the word. There may be several
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 * zeros in sequence for alternative flag/region/affixID combinations.
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59 */
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 typedef struct slang_S slang_T;
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 struct slang_S
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 {
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
63 slang_T *sl_next; // next language
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
64 char_u *sl_name; // language name "en", "en.rare", "nl", etc.
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
65 char_u *sl_fname; // name of .spl file
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
66 int sl_add; // TRUE if it's a .add file.
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
68 char_u *sl_fbyts; // case-folded word bytes
21943
11055d5b74a7 patch 8.2.1521: reading past end of buffer when reading spellfile
Bram Moolenaar <Bram@vim.org>
parents: 18753
diff changeset
69 long sl_fbyts_len; // length of sl_fbyts
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
70 idx_T *sl_fidxs; // case-folded word indexes
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
71 char_u *sl_kbyts; // keep-case word bytes
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
72 idx_T *sl_kidxs; // keep-case word indexes
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
73 char_u *sl_pbyts; // prefix tree word bytes
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
74 idx_T *sl_pidxs; // prefix tree word indexes
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
76 char_u *sl_info; // infotext string or NULL
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77
13232
d11bbd3440b0 patch 8.0.1490: number of spell regions is spread out through the code
Christian Brabandt <cb@256bit.org>
parents: 10042
diff changeset
78 char_u sl_regions[MAXREGIONS * 2 + 1];
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
79 // table with up to 8 region names plus NUL
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
81 char_u *sl_midword; // MIDWORD string or NULL
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
83 hashtab_T sl_wordcount; // hashtable with word count, wordcount_T
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
85 int sl_compmax; // COMPOUNDWORDMAX (default: MAXWLEN)
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
86 int sl_compminlen; // COMPOUNDMIN (default: 0)
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
87 int sl_compsylmax; // COMPOUNDSYLMAX (default: MAXWLEN)
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
88 int sl_compoptions; // COMP_* flags
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
89 garray_T sl_comppat; // CHECKCOMPOUNDPATTERN items
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
90 regprog_T *sl_compprog; // COMPOUNDRULE turned into a regexp progrm
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
91 // (NULL when no compounding)
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
92 char_u *sl_comprules; // all COMPOUNDRULE concatenated (or NULL)
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
93 char_u *sl_compstartflags; // flags for first compound word
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
94 char_u *sl_compallflags; // all flags for compound words
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
95 char_u sl_nobreak; // When TRUE: no spaces between words
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
96 char_u *sl_syllable; // SYLLABLE repeatable chars or NULL
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
97 garray_T sl_syl_items; // syllable items
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
99 int sl_prefixcnt; // number of items in "sl_prefprog"
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
100 regprog_T **sl_prefprog; // table with regprogs for prefixes
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
102 garray_T sl_rep; // list of fromto_T entries from REP lines
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
103 short sl_rep_first[256]; // indexes where byte first appears, -1 if
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
104 // there is none
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
105 garray_T sl_sal; // list of salitem_T entries from SAL lines
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
106 salfirst_T sl_sal_first[256]; // indexes where byte first appears, -1 if
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
107 // there is none
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
108 int sl_followup; // SAL followup
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
109 int sl_collapse; // SAL collapse_result
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
110 int sl_rem_accents; // SAL remove_accents
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
111 int sl_sofo; // SOFOFROM and SOFOTO instead of SAL items:
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
112 // "sl_sal_first" maps chars, when has_mbyte
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
113 // "sl_sal" is a list of wide char lists.
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
114 garray_T sl_repsal; // list of fromto_T entries from REPSAL lines
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
115 short sl_repsal_first[256]; // sl_rep_first for REPSAL lines
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
116 int sl_nosplitsugs; // don't suggest splitting a word
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
117 int sl_nocompoundsugs; // don't suggest compounding
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
119 // Info from the .sug file. Loaded on demand.
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
120 time_t sl_sugtime; // timestamp for .sug file
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
121 char_u *sl_sbyts; // soundfolded word bytes
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
122 idx_T *sl_sidxs; // soundfolded word indexes
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
123 buf_T *sl_sugbuf; // buffer with word number table
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
124 int sl_sugloaded; // TRUE when .sug file was loaded or failed to
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
125 // load
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
127 int sl_has_map; // TRUE if there is a MAP line
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
128 hashtab_T sl_map_hash; // MAP for multi-byte chars
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
129 int sl_map_array[256]; // MAP for first 256 chars
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
130 hashtab_T sl_sounddone; // table with soundfolded words that have
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
131 // handled, see add_sound_suggest()
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 };
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134 #ifdef VMS
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 # define SPL_FNAME_TMPL "%s_%s.spl"
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 # define SPL_FNAME_ADD "_add."
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 # define SPL_FNAME_ASCII "_ascii."
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 #else
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 # define SPL_FNAME_TMPL "%s.%s.spl"
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 # define SPL_FNAME_ADD ".add."
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141 # define SPL_FNAME_ASCII ".ascii."
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 #endif
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
144 // Flags used for a word. Only the lowest byte can be used, the region byte
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
145 // comes above it.
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
146 #define WF_REGION 0x01 // region byte follows
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
147 #define WF_ONECAP 0x02 // word with one capital (or all capitals)
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
148 #define WF_ALLCAP 0x04 // word must be all capitals
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
149 #define WF_RARE 0x08 // rare word
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
150 #define WF_BANNED 0x10 // bad word
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
151 #define WF_AFX 0x20 // affix ID follows
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
152 #define WF_FIXCAP 0x40 // keep-case word, allcap not allowed
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
153 #define WF_KEEPCAP 0x80 // keep-case word
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154
18172
6e53d83e021d patch 8.1.2081: the spell.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17682
diff changeset
155 #define WF_CAPMASK (WF_ONECAP | WF_ALLCAP | WF_KEEPCAP | WF_FIXCAP)
6e53d83e021d patch 8.1.2081: the spell.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17682
diff changeset
156
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
157 // for <flags2>, shifted up one byte to be used in wn_flags
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
158 #define WF_HAS_AFF 0x0100 // word includes affix
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
159 #define WF_NEEDCOMP 0x0200 // word only valid in compound
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
160 #define WF_NOSUGGEST 0x0400 // word not to be suggested
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
161 #define WF_COMPROOT 0x0800 // already compounded word, COMPOUNDROOT
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
162 #define WF_NOCOMPBEF 0x1000 // no compounding before this word
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
163 #define WF_NOCOMPAFT 0x2000 // no compounding after this word
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
165 // flags for <pflags>
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
166 #define WFP_RARE 0x01 // rare prefix
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
167 #define WFP_NC 0x02 // prefix is not combining
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
168 #define WFP_UP 0x04 // to-upper prefix
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
169 #define WFP_COMPPERMIT 0x08 // prefix with COMPOUNDPERMITFLAG
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
170 #define WFP_COMPFORBID 0x10 // prefix with COMPOUNDFORBIDFLAG
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
172 // Flags for postponed prefixes in "sl_pidxs". Must be above affixID (one
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
173 // byte) and prefcondnr (two bytes).
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
174 #define WF_RAREPFX (WFP_RARE << 24) // rare postponed prefix
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
175 #define WF_PFX_NC (WFP_NC << 24) // non-combining postponed prefix
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
176 #define WF_PFX_UP (WFP_UP << 24) // to-upper postponed prefix
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
177 #define WF_PFX_COMPPERMIT (WFP_COMPPERMIT << 24) // postponed prefix with
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
178 // COMPOUNDPERMITFLAG
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
179 #define WF_PFX_COMPFORBID (WFP_COMPFORBID << 24) // postponed prefix with
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
180 // COMPOUNDFORBIDFLAG
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
182 // flags for <compoptions>
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
183 #define COMP_CHECKDUP 1 // CHECKCOMPOUNDDUP
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
184 #define COMP_CHECKREP 2 // CHECKCOMPOUNDREP
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
185 #define COMP_CHECKCASE 4 // CHECKCOMPOUNDCASE
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
186 #define COMP_CHECKTRIPLE 8 // CHECKCOMPOUNDTRIPLE
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
188 // Info from "REP", "REPSAL" and "SAL" entries in ".aff" file used in si_rep,
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
189 // si_repsal, sl_rep, and si_sal. Not for sl_sal!
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
190 // One replacement: from "ft_from" to "ft_to".
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191 typedef struct fromto_S
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
192 {
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193 char_u *ft_from;
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194 char_u *ft_to;
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195 } fromto_T;
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
197 // Info from "SAL" entries in ".aff" file used in sl_sal.
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
198 // The info is split for quick processing by spell_soundfold().
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
199 // Note that "sm_oneof" and "sm_rules" point into sm_lead.
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200 typedef struct salitem_S
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
201 {
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
202 char_u *sm_lead; // leading letters
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
203 int sm_leadlen; // length of "sm_lead"
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
204 char_u *sm_oneof; // letters from () or NULL
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
205 char_u *sm_rules; // rules like ^, $, priority
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
206 char_u *sm_to; // replacement.
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
207 int *sm_lead_w; // wide character copy of "sm_lead"
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
208 int *sm_oneof_w; // wide character copy of "sm_oneof"
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
209 int *sm_to_w; // wide character copy of "sm_to"
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 } salitem_T;
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
212 // Values for SP_*ERROR are negative, positive values are used by
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
213 // read_cnt_string().
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
214 #define SP_TRUNCERROR -1 // spell file truncated error
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
215 #define SP_FORMERROR -2 // format error in spell file
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
216 #define SP_OTHERERROR -3 // other error while reading spell file
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
217
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
218 /*
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219 * Structure used in "b_langp", filled from 'spelllang'.
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
220 */
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 typedef struct langp_S
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222 {
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
223 slang_T *lp_slang; // info for this language
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
224 slang_T *lp_sallang; // language used for sound folding or NULL
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
225 slang_T *lp_replang; // language used for REP items or NULL
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
226 int lp_region; // bitmask for region or REGION_ALL
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227 } langp_T;
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229 #define LANGP_ENTRY(ga, i) (((langp_T *)(ga).ga_data) + (i))
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
231 #define VIMSUGMAGIC "VIMsug" // string at start of Vim .sug file
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
232 #define VIMSUGMAGICL 6
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 #define VIMSUGVERSION 1
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235 /*
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236 * The tables used for recognizing word characters according to spelling.
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
237 * These are only used for the first 256 characters of 'encoding'.
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238 */
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239 typedef struct spelltab_S
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
240 {
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
241 char_u st_isw[256]; // flags: is word char
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
242 char_u st_isu[256]; // flags: is uppercase char
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
243 char_u st_fold[256]; // chars: folded case
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
244 char_u st_upper[256]; // chars: upper case
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
245 } spelltab_T;
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
247 /*
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
248 * Use our own character-case definitions, because the current locale may
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
249 * differ from what the .spl file uses.
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
250 * These must not be called with negative number!
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
251 */
15605
62b3805506b3 patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 13232
diff changeset
252 #if defined(HAVE_WCHAR_H)
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
253 # include <wchar.h> // for towupper() and towlower()
15605
62b3805506b3 patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 13232
diff changeset
254 #endif
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
255 // Multi-byte implementation. For Unicode we can call utf_*(), but don't do
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
256 // that for ASCII, because we don't want to use 'casemap' here. Otherwise use
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
257 // the "w" library function for characters above 255 if available.
15605
62b3805506b3 patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 13232
diff changeset
258 #ifdef HAVE_TOWLOWER
62b3805506b3 patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 13232
diff changeset
259 # define SPELL_TOFOLD(c) (enc_utf8 && (c) >= 128 ? utf_fold(c) \
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
260 : (c) < 256 ? (int)spelltab.st_fold[c] : (int)towlower(c))
15605
62b3805506b3 patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 13232
diff changeset
261 #else
62b3805506b3 patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 13232
diff changeset
262 # define SPELL_TOFOLD(c) (enc_utf8 && (c) >= 128 ? utf_fold(c) \
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
263 : (c) < 256 ? (int)spelltab.st_fold[c] : (c))
15605
62b3805506b3 patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 13232
diff changeset
264 #endif
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
265
15605
62b3805506b3 patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 13232
diff changeset
266 #ifdef HAVE_TOWUPPER
62b3805506b3 patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 13232
diff changeset
267 # define SPELL_TOUPPER(c) (enc_utf8 && (c) >= 128 ? utf_toupper(c) \
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
268 : (c) < 256 ? (int)spelltab.st_upper[c] : (int)towupper(c))
15605
62b3805506b3 patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 13232
diff changeset
269 #else
62b3805506b3 patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 13232
diff changeset
270 # define SPELL_TOUPPER(c) (enc_utf8 && (c) >= 128 ? utf_toupper(c) \
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
271 : (c) < 256 ? (int)spelltab.st_upper[c] : (c))
15605
62b3805506b3 patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 13232
diff changeset
272 #endif
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
273
15605
62b3805506b3 patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 13232
diff changeset
274 #ifdef HAVE_ISWUPPER
62b3805506b3 patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 13232
diff changeset
275 # define SPELL_ISUPPER(c) (enc_utf8 && (c) >= 128 ? utf_isupper(c) \
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
276 : (c) < 256 ? spelltab.st_isu[c] : iswupper(c))
15605
62b3805506b3 patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 13232
diff changeset
277 #else
62b3805506b3 patch 8.1.0810: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents: 13232
diff changeset
278 # define SPELL_ISUPPER(c) (enc_utf8 && (c) >= 128 ? utf_isupper(c) \
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
279 : (c) < 256 ? spelltab.st_isu[c] : (FALSE))
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
280 #endif
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
281
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
282 #ifdef FEAT_SPELL
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
283 // First language that is loaded, start of the linked list of loaded
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
284 // languages.
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
285 # ifdef IN_SPELL_C
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
286 # define SPELL_EXTERN
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
287 # define SPELL_INIT(x) x
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
288 # else
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
289 # define SPELL_EXTERN extern
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
290 # define SPELL_INIT(x)
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
291 # endif
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
292
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
293 SPELL_EXTERN slang_T *first_lang SPELL_INIT(= NULL);
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
294
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
295 // file used for "zG" and "zW"
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
296 SPELL_EXTERN char_u *int_wordlist SPELL_INIT(= NULL);
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
297
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
298
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
299 SPELL_EXTERN char e_format[] SPELL_INIT(= N_("E759: Format error in spell file"));
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
300
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
301 SPELL_EXTERN spelltab_T spelltab;
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
302 SPELL_EXTERN int did_set_spelltab;
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
303
17682
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
304 // Values for "what" argument of spell_add_word()
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
305 #define SPELL_ADD_GOOD 0
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
306 #define SPELL_ADD_BAD 1
3dbff5d37520 patch 8.1.1838: there is :spellwrong and :spellgood but not :spellrare
Bram Moolenaar <Bram@vim.org>
parents: 15607
diff changeset
307 #define SPELL_ADD_RARE 2
18172
6e53d83e021d patch 8.1.2081: the spell.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17682
diff changeset
308
6e53d83e021d patch 8.1.2081: the spell.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17682
diff changeset
309 typedef struct wordcount_S
6e53d83e021d patch 8.1.2081: the spell.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17682
diff changeset
310 {
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
311 short_u wc_count; // nr of times word was seen
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
312 char_u wc_word[1]; // word, actually longer
18172
6e53d83e021d patch 8.1.2081: the spell.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17682
diff changeset
313 } wordcount_T;
6e53d83e021d patch 8.1.2081: the spell.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17682
diff changeset
314
6e53d83e021d patch 8.1.2081: the spell.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17682
diff changeset
315 #define WC_KEY_OFF offsetof(wordcount_T, wc_word)
6e53d83e021d patch 8.1.2081: the spell.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17682
diff changeset
316 #define HI2WC(hi) ((wordcount_T *)((hi)->hi_key - WC_KEY_OFF))
6e53d83e021d patch 8.1.2081: the spell.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17682
diff changeset
317 #define MAXWORDCOUNT 0xffff
6e53d83e021d patch 8.1.2081: the spell.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17682
diff changeset
318
18753
6e3dc2d630c2 patch 8.1.2366: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents: 18172
diff changeset
319 // Remember what "z?" replaced.
18172
6e53d83e021d patch 8.1.2081: the spell.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17682
diff changeset
320 SPELL_EXTERN char_u *repl_from SPELL_INIT(= NULL);
6e53d83e021d patch 8.1.2081: the spell.c file is too big
Bram Moolenaar <Bram@vim.org>
parents: 17682
diff changeset
321 SPELL_EXTERN char_u *repl_to SPELL_INIT(= NULL);
9583
b0c7061d6439 commit https://github.com/vim/vim/commit/9ccfebddc3ff2a3c2853cf706fd4c26f639bf381
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
322 #endif