mirror of https://github.com/vim/vim.git
patch 8.1.2081: the spell.c file is too big
Problem: The spell.c file is too big. Solution: Move the code for spell suggestions to a separate file. (Yegappan Lakshmanan, closes #4988)
This commit is contained in:
parent
d2842ea60b
commit
46a426c9ac
2
Filelist
2
Filelist
|
@ -111,6 +111,7 @@ SRC_ALL = \
|
|||
src/spell.c \
|
||||
src/spell.h \
|
||||
src/spellfile.c \
|
||||
src/spellsuggest.c \
|
||||
src/structs.h \
|
||||
src/syntax.c \
|
||||
src/tag.c \
|
||||
|
@ -255,6 +256,7 @@ SRC_ALL = \
|
|||
src/proto/sound.pro \
|
||||
src/proto/spell.pro \
|
||||
src/proto/spellfile.pro \
|
||||
src/proto/spellsuggest.pro \
|
||||
src/proto/syntax.pro \
|
||||
src/proto/tag.pro \
|
||||
src/proto/term.pro \
|
||||
|
|
|
@ -778,6 +778,7 @@ OBJ = \
|
|||
$(OUTDIR)/sign.o \
|
||||
$(OUTDIR)/spell.o \
|
||||
$(OUTDIR)/spellfile.o \
|
||||
$(OUTDIR)/spellsuggest.o \
|
||||
$(OUTDIR)/syntax.o \
|
||||
$(OUTDIR)/tag.o \
|
||||
$(OUTDIR)/term.o \
|
||||
|
|
|
@ -94,6 +94,7 @@ SRC = arabic.c \
|
|||
sign.c \
|
||||
spell.c \
|
||||
spellfile.c \
|
||||
spellsuggest.c \
|
||||
syntax.c \
|
||||
tag.c \
|
||||
term.c \
|
||||
|
|
|
@ -785,6 +785,7 @@ OBJ = \
|
|||
$(OUTDIR)\sign.obj \
|
||||
$(OUTDIR)\spell.obj \
|
||||
$(OUTDIR)\spellfile.obj \
|
||||
$(OUTDIR)\spellsuggest.obj \
|
||||
$(OUTDIR)\syntax.obj \
|
||||
$(OUTDIR)\tag.obj \
|
||||
$(OUTDIR)\term.obj \
|
||||
|
@ -1670,6 +1671,8 @@ $(OUTDIR)/spell.obj: $(OUTDIR) spell.c $(INCL)
|
|||
|
||||
$(OUTDIR)/spellfile.obj: $(OUTDIR) spellfile.c $(INCL)
|
||||
|
||||
$(OUTDIR)/spellsuggest.obj: $(OUTDIR) spellsuggest.c $(INCL)
|
||||
|
||||
$(OUTDIR)/syntax.obj: $(OUTDIR) syntax.c $(INCL)
|
||||
|
||||
$(OUTDIR)/tag.obj: $(OUTDIR) tag.c $(INCL)
|
||||
|
@ -1852,6 +1855,7 @@ proto.h: \
|
|||
proto/sign.pro \
|
||||
proto/spell.pro \
|
||||
proto/spellfile.pro \
|
||||
proto/spellsuggest.pro \
|
||||
proto/syntax.pro \
|
||||
proto/tag.pro \
|
||||
proto/term.pro \
|
||||
|
|
|
@ -320,7 +320,8 @@ SRC = arabic.c arglist.c autocmd.c beval.c blob.c blowfish.c buffer.c \
|
|||
ops.c \
|
||||
option.c optionstr.c popupmnu.c popupwin.c profiler.c quickfix.c \
|
||||
regexp.c register.c scriptfile.c \
|
||||
search.c session.c sha256.c sign.c spell.c spellfile.c syntax.c tag.c \
|
||||
search.c session.c sha256.c sign.c spell.c spellfile.c spellsuggest.c \
|
||||
syntax.c tag.c \
|
||||
term.c termlib.c testing.c textprop.c ui.c undo.c usercmd.c \
|
||||
userfunc.c version.c viminfo.c screen.c window.c os_unix.c os_vms.c \
|
||||
pathdef.c \
|
||||
|
@ -342,7 +343,8 @@ OBJ = arabic.obj arglist.obj autocmd.obj beval.obj blob.obj blowfish.obj \
|
|||
optionstr.obj popupmnu.obj popupwin.obj profiler.obj quickfix.obj \
|
||||
regexp.obj register.obj scriptfile.obj \
|
||||
search.obj session.obj sha256.obj sign.obj spell.obj spellfile.obj \
|
||||
syntax.obj tag.obj term.obj termlib.obj testing.obj textprop.obj \
|
||||
spellsuggest.obj syntax.obj tag.obj term.obj termlib.obj testing.obj \
|
||||
textprop.obj \
|
||||
ui.obj undo.obj usercmd.obj userfunc.obj screen.obj version.obj \
|
||||
viminfo.obj window.obj os_unix.obj os_vms.obj pathdef.obj if_mzsch.obj \
|
||||
$(GUI_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(TCL_OBJ) \
|
||||
|
@ -791,6 +793,10 @@ spellfile.obj : spellfile.c vim.h [.auto]config.h feature.h os_unix.h \
|
|||
ascii.h keymap.h term.h macros.h option.h structs.h \
|
||||
regexp.h gui.h beval.h [.proto]gui_beval.pro alloc.h ex_cmds.h spell.h \
|
||||
proto.h globals.h
|
||||
spellsuggest.obj : spellsuggest.c vim.h [.auto]config.h feature.h os_unix.h \
|
||||
ascii.h keymap.h term.h macros.h option.h structs.h \
|
||||
regexp.h gui.h beval.h [.proto]gui_beval.pro alloc.h ex_cmds.h spell.h \
|
||||
proto.h globals.h
|
||||
syntax.obj : syntax.c vim.h [.auto]config.h feature.h os_unix.h \
|
||||
ascii.h keymap.h term.h macros.h structs.h regexp.h \
|
||||
gui.h beval.h [.proto]gui_beval.pro option.h ex_cmds.h proto.h \
|
||||
|
|
10
src/Makefile
10
src/Makefile
|
@ -1654,6 +1654,7 @@ BASIC_SRC = \
|
|||
sound.c \
|
||||
spell.c \
|
||||
spellfile.c \
|
||||
spellsuggest.c \
|
||||
syntax.c \
|
||||
tag.c \
|
||||
term.c \
|
||||
|
@ -1789,6 +1790,7 @@ OBJ_COMMON = \
|
|||
objects/sound.o \
|
||||
objects/spell.o \
|
||||
objects/spellfile.o \
|
||||
objects/spellsuggest.o \
|
||||
objects/syntax.o \
|
||||
objects/tag.o \
|
||||
objects/term.o \
|
||||
|
@ -1949,6 +1951,7 @@ PRO_AUTO = \
|
|||
sound.pro \
|
||||
spell.pro \
|
||||
spellfile.pro \
|
||||
spellsuggest.pro \
|
||||
syntax.pro \
|
||||
tag.pro \
|
||||
term.pro \
|
||||
|
@ -3386,6 +3389,9 @@ objects/spell.o: spell.c
|
|||
objects/spellfile.o: spellfile.c
|
||||
$(CCC) -o $@ spellfile.c
|
||||
|
||||
objects/spellsuggest.o: spellsuggest.c
|
||||
$(CCC) -o $@ spellsuggest.c
|
||||
|
||||
objects/syntax.o: syntax.c
|
||||
$(CCC) -o $@ syntax.c
|
||||
|
||||
|
@ -3881,6 +3887,10 @@ objects/spellfile.o: spellfile.c vim.h protodef.h auto/config.h feature.h \
|
|||
os_unix.h auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
||||
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
||||
proto.h globals.h
|
||||
objects/spellsuggest.o: spellsuggest.c vim.h protodef.h auto/config.h feature.h \
|
||||
os_unix.h auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
||||
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
||||
proto.h globals.h
|
||||
objects/syntax.o: syntax.c vim.h protodef.h auto/config.h feature.h os_unix.h \
|
||||
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
|
||||
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
|
||||
|
|
|
@ -69,7 +69,9 @@ screen.c | lower level screen functions
|
|||
search.c | pattern searching
|
||||
session.c | sessions and views
|
||||
sign.c | signs
|
||||
spell.c | spell checking
|
||||
spell.c | spell checking core
|
||||
spellfile.c | spell file handling
|
||||
spellsuggest.c | spell correction suggestions
|
||||
syntax.c | syntax and other highlighting
|
||||
tag.c | tags
|
||||
term.c | terminal handling, termcap codes
|
||||
|
|
|
@ -202,6 +202,7 @@ void qsort(void *base, size_t elm_count, size_t elm_size, int (*cmp)(const void
|
|||
# include "sound.pro"
|
||||
# include "spell.pro"
|
||||
# include "spellfile.pro"
|
||||
# include "spellsuggest.pro"
|
||||
# include "syntax.pro"
|
||||
# include "tag.pro"
|
||||
# include "term.pro"
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
/* spell.c */
|
||||
int spell_check(win_T *wp, char_u *ptr, hlf_T *attrp, int *capcol, int docount);
|
||||
int match_checkcompoundpattern(char_u *ptr, int wlen, garray_T *gap);
|
||||
int can_compound(slang_T *slang, char_u *word, char_u *flags);
|
||||
int match_compoundrule(slang_T *slang, char_u *compflags);
|
||||
int valid_word_prefix(int totprefcnt, int arridx, int flags, char_u *word, slang_T *slang, int cond_req);
|
||||
int spell_valid_case(int wordflags, int treeflags);
|
||||
int no_spell_checking(win_T *wp);
|
||||
int spell_move_to(win_T *wp, int dir, int allwords, int curline, hlf_T *attrp);
|
||||
void spell_cat_line(char_u *buf, char_u *line, int maxlen);
|
||||
char_u *spell_enc(void);
|
||||
|
@ -19,12 +25,15 @@ buf_T *open_spellbuf(void);
|
|||
void close_spellbuf(buf_T *buf);
|
||||
void clear_spell_chartab(spelltab_T *sp);
|
||||
void init_spell_chartab(void);
|
||||
int spell_iswordp(char_u *p, win_T *wp);
|
||||
int spell_iswordp_nmw(char_u *p, win_T *wp);
|
||||
int spell_casefold(char_u *str, int len, char_u *buf, int buflen);
|
||||
int spell_check_sps(void);
|
||||
void spell_suggest(int count);
|
||||
int check_need_cap(linenr_T lnum, colnr_T col);
|
||||
void ex_spellrepall(exarg_T *eap);
|
||||
void spell_suggest_list(garray_T *gap, char_u *word, int maxcount, int need_cap, int interactive);
|
||||
void onecap_copy(char_u *word, char_u *wcopy, int upper);
|
||||
void allcap_copy(char_u *word, char_u *wcopy);
|
||||
int nofold_len(char_u *fword, int flen, char_u *word);
|
||||
void make_case_word(char_u *fword, char_u *cword, int flags);
|
||||
char_u *eval_soundfold(char_u *word);
|
||||
void spell_soundfold(slang_T *slang, char_u *inword, int folded, char_u *res);
|
||||
void ex_spellinfo(exarg_T *eap);
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
/* spellsuggest.c */
|
||||
int spell_check_sps(void);
|
||||
void spell_suggest(int count);
|
||||
void spell_suggest_list(garray_T *gap, char_u *word, int maxcount, int need_cap, int interactive);
|
||||
/* vim: set ft=c : */
|
4554
src/spell.c
4554
src/spell.c
File diff suppressed because it is too large
Load Diff
16
src/spell.h
16
src/spell.h
|
@ -151,6 +151,8 @@ struct slang_S
|
|||
#define WF_FIXCAP 0x40 /* keep-case word, allcap not allowed */
|
||||
#define WF_KEEPCAP 0x80 /* keep-case word */
|
||||
|
||||
#define WF_CAPMASK (WF_ONECAP | WF_ALLCAP | WF_KEEPCAP | WF_FIXCAP)
|
||||
|
||||
/* for <flags2>, shifted up one byte to be used in wn_flags */
|
||||
#define WF_HAS_AFF 0x0100 /* word includes affix */
|
||||
#define WF_NEEDCOMP 0x0200 /* word only valid in compound */
|
||||
|
@ -302,4 +304,18 @@ SPELL_EXTERN int did_set_spelltab;
|
|||
#define SPELL_ADD_GOOD 0
|
||||
#define SPELL_ADD_BAD 1
|
||||
#define SPELL_ADD_RARE 2
|
||||
|
||||
typedef struct wordcount_S
|
||||
{
|
||||
short_u wc_count; /* nr of times word was seen */
|
||||
char_u wc_word[1]; /* word, actually longer */
|
||||
} wordcount_T;
|
||||
|
||||
#define WC_KEY_OFF offsetof(wordcount_T, wc_word)
|
||||
#define HI2WC(hi) ((wordcount_T *)((hi)->hi_key - WC_KEY_OFF))
|
||||
#define MAXWORDCOUNT 0xffff
|
||||
|
||||
/* Remember what "z?" replaced. */
|
||||
SPELL_EXTERN char_u *repl_from SPELL_INIT(= NULL);
|
||||
SPELL_EXTERN char_u *repl_to SPELL_INIT(= NULL);
|
||||
#endif
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -757,6 +757,8 @@ static char *(features[]) =
|
|||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
2081,
|
||||
/**/
|
||||
2080,
|
||||
/**/
|
||||
|
|
Loading…
Reference in New Issue