1 | #ifndef DEFINE_FUNC_ATTRIBUTES |
2 | # define DEFINE_FUNC_ATTRIBUTES |
3 | #endif |
4 | #include "nvim/func_attr.h" |
5 | #undef DEFINE_FUNC_ATTRIBUTES |
6 | static inline int spell_check_magic_string(FILE *const fd) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_ALWAYS_INLINE; |
7 | static void tree_count_words(char_u *byts, idx_T *idxs); |
8 | static char_u *read_cnt_string(FILE *fd, int cnt_bytes, int *cntp); |
9 | static int read_region_section(FILE *fd, slang_T *lp, int len); |
10 | static int read_charflags_section(FILE *fd); |
11 | static int read_prefcond_section(FILE *fd, slang_T *lp); |
12 | static int read_rep_section(FILE *fd, garray_T *gap, int16_t *first); |
13 | static int read_sal_section(FILE *fd, slang_T *slang); |
14 | static int read_words_section(FILE *fd, slang_T *lp, int len); |
15 | static int read_sofo_section(FILE *fd, slang_T *slang); |
16 | static int read_compound(FILE *fd, slang_T *slang, int len); |
17 | static int set_sofo(slang_T *lp, char_u *from, char_u *to); |
18 | static void set_sal_first(slang_T *lp); |
19 | static int *mb_str2wide(char_u *s); |
20 | static int spell_read_tree(FILE *fd, char_u **bytsp, idx_T **idxsp, _Bool prefixtree, int prefixcnt ); |
21 | static idx_T read_tree_node(FILE *fd, char_u *byts, idx_T *idxs, int maxidx, idx_T startidx, _Bool prefixtree, int maxprefcondnr ); |
22 | static void spell_reload_one(char_u *fname, _Bool added_word ); |
23 | static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname); |
24 | static _Bool is_aff_rule(char_u **items, int itemcnt, char *rulename, int mincount); |
25 | static void aff_process_flags(afffile_T *affile, affentry_T *entry); |
26 | static _Bool spell_info_item(char_u *s); |
27 | static unsigned affitem2flag(int flagtype, char_u *item, char_u *fname, int lnum); |
28 | static unsigned get_affitem(int flagtype, char_u **pp); |
29 | static void process_compflags(spellinfo_T *spin, afffile_T *aff, char_u *compflags); |
30 | static void check_renumber(spellinfo_T *spin); |
31 | static _Bool flag_in_afflist(int flagtype, char_u *afflist, unsigned flag); |
32 | static void aff_check_number(int spinval, int affval, char *name); |
33 | static void aff_check_string(char_u *spinval, char_u *affval, char *name); |
34 | static _Bool str_equal(char_u *s1, char_u *s2); |
35 | static void add_fromto(spellinfo_T *spin, garray_T *gap, char_u *from, char_u *to); |
36 | static _Bool sal_to_bool(char_u *s); |
37 | static void spell_free_aff(afffile_T *aff); |
38 | static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile); |
39 | static int get_affix_flags(afffile_T *affile, char_u *afflist); |
40 | static int get_pfxlist(afffile_T *affile, char_u *afflist, char_u *store_afflist); |
41 | static void get_compflags(afffile_T *affile, char_u *afflist, char_u *store_afflist); |
42 | static int store_aff_word(spellinfo_T *spin, char_u *word, char_u *afflist, afffile_T *affile, hashtab_T *ht, hashtab_T *xht, int condit, int flags, char_u *pfxlist, int pfxlen ); |
43 | static int spell_read_wordfile(spellinfo_T *spin, char_u *fname); |
44 | static void *getroom(spellinfo_T *spin, size_t len, _Bool align) FUNC_ATTR_NONNULL_RET; |
45 | static char_u *getroom_save(spellinfo_T *spin, char_u *s); |
46 | static void free_blocks(sblock_T *bl); |
47 | static wordnode_T *wordtree_alloc(spellinfo_T *spin) FUNC_ATTR_NONNULL_RET; |
48 | static int store_word(spellinfo_T *spin, char_u *word, int flags, int region, char_u *pfxlist, _Bool need_affix ); |
49 | static int tree_add_word(spellinfo_T *spin, char_u *word, wordnode_T *root, int flags, int region, int affixID); |
50 | static wordnode_T *get_wordnode(spellinfo_T *spin); |
51 | static int deref_wordnode(spellinfo_T *spin, wordnode_T *node); |
52 | static void free_wordnode(spellinfo_T *spin, wordnode_T *n); |
53 | static void wordtree_compress(spellinfo_T *spin, wordnode_T *root); |
54 | static int node_compress(spellinfo_T *spin, wordnode_T *node, hashtab_T *ht, int *tot ); |
55 | static _Bool node_equal(wordnode_T *n1, wordnode_T *n2); |
56 | static int rep_compare(const void *s1, const void *s2); |
57 | static int write_vim_spell(spellinfo_T *spin, char_u *fname); |
58 | static void clear_node(wordnode_T *node); |
59 | static int put_node(FILE *fd, wordnode_T *node, int idx, int regionmask, _Bool prefixtree ); |
60 | static void spell_make_sugfile(spellinfo_T *spin, char_u *wfname); |
61 | static int sug_filltree(spellinfo_T *spin, slang_T *slang); |
62 | static int sug_maketable(spellinfo_T *spin); |
63 | static int sug_filltable(spellinfo_T *spin, wordnode_T *node, int startwordnr, garray_T *gap ); |
64 | static int offset2bytes(int nr, char_u *buf); |
65 | static void sug_write(spellinfo_T *spin, char_u *fname); |
66 | static void mkspell(int fcount, char_u **fnames, _Bool ascii, _Bool over_write, _Bool added_word ); |
67 | static void spell_message(spellinfo_T *spin, char_u *str); |
68 | static void init_spellfile(void); |
69 | static int set_spell_chartab(char_u *fol, char_u *low, char_u *upp); |
70 | static void set_spell_charflags(char_u *flags, int cnt, char_u *fol ); |
71 | static int set_spell_finish(spelltab_T *new_st); |
72 | static int write_spell_prefcond(FILE *fd, garray_T *gap); |
73 | static void set_map_str(slang_T *lp, char_u *map); |
74 | #include "nvim/func_attr.h" |
75 | |