1
0
forked from aniani/vim

patch 8.2.1262: src/ex_cmds.c file is too big

Problem:    src/ex_cmds.c file is too big.
Solution:   Move help related code to src/help.c. (Yegappan Lakshmanan,
            closes #6506)
This commit is contained in:
Bram Moolenaar 2020-07-21 21:07:20 +02:00
parent c7db57788b
commit f868ba8903
14 changed files with 1344 additions and 1346 deletions

View File

@ -68,6 +68,7 @@ SRC_ALL = \
src/gui_beval.c \
src/hardcopy.c \
src/hashtab.c \
src/help.c \
src/highlight.c \
src/indent.c \
src/insexpand.c \
@ -240,6 +241,7 @@ SRC_ALL = \
src/proto/gui_beval.pro \
src/proto/hardcopy.pro \
src/proto/hashtab.pro \
src/proto/help.pro \
src/proto/highlight.pro \
src/proto/indent.pro \
src/proto/insexpand.pro \

View File

@ -744,6 +744,7 @@ OBJ = \
$(OUTDIR)/gui_xim.o \
$(OUTDIR)/hardcopy.o \
$(OUTDIR)/hashtab.o \
$(OUTDIR)/help.o \
$(OUTDIR)/highlight.o \
$(OUTDIR)/if_cscope.o \
$(OUTDIR)/indent.o \

View File

@ -64,6 +64,7 @@ SRC = arabic.c \
gui_xim.c \
hardcopy.c \
hashtab.c \
help.c \
highlight.c \
indent.c \
insexpand.c \

View File

@ -766,6 +766,7 @@ OBJ = \
$(OUTDIR)\gui_xim.obj \
$(OUTDIR)\hardcopy.obj \
$(OUTDIR)\hashtab.obj \
$(OUTDIR)\help.obj \
$(OUTDIR)\highlight.obj \
$(OBJDIR)\if_cscope.obj \
$(OUTDIR)\indent.obj \
@ -1608,6 +1609,8 @@ $(OUTDIR)/hardcopy.obj: $(OUTDIR) hardcopy.c $(INCL) version.h
$(OUTDIR)/hashtab.obj: $(OUTDIR) hashtab.c $(INCL)
$(OUTDIR)/help.obj: $(OUTDIR) help.c $(INCL)
$(OUTDIR)/highlight.obj: $(OUTDIR) highlight.c $(INCL)
$(OUTDIR)/indent.obj: $(OUTDIR) indent.c $(INCL)
@ -1930,6 +1933,7 @@ proto.h: \
proto/gui_xim.pro \
proto/hardcopy.pro \
proto/hashtab.pro \
proto/help.pro \
proto/highlight.pro \
proto/indent.pro \
proto/insexpand.pro \

View File

@ -337,6 +337,7 @@ SRC = \
gui_xim.c \
hardcopy.c \
hashtab.c \
help.c \
highlight.c \
if_cscope.c \
if_xcmdsrv.c \
@ -450,6 +451,7 @@ OBJ = \
gui_xim.obj \
hardcopy.obj \
hashtab.obj \
help.obj \
highlight.obj \
if_cscope.obj \
if_mzsch.obj \
@ -834,6 +836,10 @@ hashtab.obj : hashtab.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 \
globals.h
help.obj : help.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 \
globals.h
highlight.obj : highlight.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 \

View File

@ -404,7 +404,7 @@ CClink = $(CC)
# Use --with-luajit if you want to use LuaJIT instead of Lua.
# Set PATH environment variable to find lua or luajit executable.
# This requires at least "normal" features, "tiny" and "small" don't work.
#CONF_OPT_LUA = --enable-luainterp
CONF_OPT_LUA = --enable-luainterp
#CONF_OPT_LUA = --enable-luainterp=dynamic
#CONF_OPT_LUA = --enable-luainterp --with-luajit
#CONF_OPT_LUA = --enable-luainterp=dynamic --with-luajit
@ -447,10 +447,10 @@ CClink = $(CC)
# dlopen(), dlsym(), dlclose(), i.e. pythonX.Y.so must be available
# However, this may still cause problems, such as "import termios" failing.
# Build two separate versions of Vim in that case.
#CONF_OPT_PYTHON = --enable-pythoninterp
CONF_OPT_PYTHON = --enable-pythoninterp
#CONF_OPT_PYTHON = --enable-pythoninterp --with-python-command=python2.7
#CONF_OPT_PYTHON = --enable-pythoninterp=dynamic
#CONF_OPT_PYTHON3 = --enable-python3interp
CONF_OPT_PYTHON3 = --enable-python3interp
#CONF_OPT_PYTHON3 = --enable-python3interp --with-python3-command=python3.6
#CONF_OPT_PYTHON3 = --enable-python3interp=dynamic
@ -472,7 +472,7 @@ CClink = $(CC)
# CSCOPE
# Uncomment this when you want to include the Cscope interface.
#CONF_OPT_CSCOPE = --enable-cscope
CONF_OPT_CSCOPE = --enable-cscope
# NETBEANS - NetBeans interface. Only works with Motif, GTK, and gnome.
# Motif version must have XPM libraries (see |netbeans-xpm|).
@ -540,7 +540,7 @@ CClink = $(CC)
#CONF_OPT_FEAT = --with-features=small
#CONF_OPT_FEAT = --with-features=normal
#CONF_OPT_FEAT = --with-features=big
#CONF_OPT_FEAT = --with-features=huge
CONF_OPT_FEAT = --with-features=huge
# COMPILED BY - For including a specific e-mail address for ":version".
#CONF_OPT_COMPBY = "--with-compiledby=John Doe <JohnDoe@yahoo.com>"
@ -614,7 +614,7 @@ CClink = $(CC)
# Use this with GCC to check for mistakes, unused arguments, etc.
# Note: If you use -Wextra and get warnings in GTK code about function
# parameters, you can add -Wno-cast-function-type
#CFLAGS = -g -Wall -Wextra -Wshadow -Wmissing-prototypes -Wunreachable-code -Wno-cast-function-type -Wno-deprecated-declarations -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
CFLAGS = -g -Wall -Wextra -Wshadow -Wmissing-prototypes -Wunreachable-code -Wno-cast-function-type -Wno-deprecated-declarations -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
# Add -Wpedantic to find // comments and other C99 constructs.
# Better disable Perl and Python to avoid a lot of warnings.
#CFLAGS = -g -Wall -Wextra -Wshadow -Wmissing-prototypes -Wpedantic -Wunreachable-code -Wunused-result -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
@ -709,7 +709,7 @@ SANITIZER_LIBS = $(SANITIZER_CFLAGS)
# Configuration is in the .ccmalloc or ~/.ccmalloc file.
# Doesn't work very well, since memory linked to from global variables
# (in libraries) is also marked as leaked memory.
#LEAK_CFLAGS = -DEXITFREE
LEAK_CFLAGS = -DEXITFREE
#LEAK_LIBS = -lccmalloc
# Uncomment this line to have Vim call abort() when an internal error is
@ -1639,6 +1639,7 @@ BASIC_SRC = \
gui_xim.c \
hardcopy.c \
hashtab.c \
help.c \
highlight.c \
if_cscope.c \
if_xcmdsrv.c \
@ -1790,6 +1791,7 @@ OBJ_COMMON = \
objects/gui_xim.o \
objects/hardcopy.o \
objects/hashtab.o \
objects/help.o \
objects/highlight.o \
objects/if_cscope.o \
objects/if_xcmdsrv.o \
@ -1958,6 +1960,7 @@ PRO_AUTO = \
gui_beval.pro \
hardcopy.pro \
hashtab.pro \
help.pro \
highlight.pro \
if_cscope.pro \
if_lua.pro \
@ -3264,6 +3267,9 @@ objects/hardcopy.o: hardcopy.c
objects/hashtab.o: hashtab.c
$(CCC) -o $@ hashtab.c
objects/help.o: help.c
$(CCC) -o $@ help.c
objects/gui.o: gui.c
$(CCC) -o $@ gui.c
@ -3930,6 +3936,10 @@ objects/hashtab.o: hashtab.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/help.o: help.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/highlight.o: highlight.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 \

View File

@ -48,6 +48,7 @@ filepath.c | dealing with file names and paths
findfile.c | search for files in 'path'
fold.c | folding
getchar.c | getting characters and key mapping
help.c | vim help related functions
highlight.c | syntax highlighting
indent.c | text indentation
insexpand.c | Insert mode completion

View File

@ -1887,62 +1887,6 @@ expand_cmdline(
return EXPAND_OK;
}
#ifdef FEAT_MULTI_LANG
/*
* Cleanup matches for help tags:
* Remove "@ab" if the top of 'helplang' is "ab" and the language of the first
* tag matches it. Otherwise remove "@en" if "en" is the only language.
*/
static void
cleanup_help_tags(int num_file, char_u **file)
{
int i, j;
int len;
char_u buf[4];
char_u *p = buf;
if (p_hlg[0] != NUL && (p_hlg[0] != 'e' || p_hlg[1] != 'n'))
{
*p++ = '@';
*p++ = p_hlg[0];
*p++ = p_hlg[1];
}
*p = NUL;
for (i = 0; i < num_file; ++i)
{
len = (int)STRLEN(file[i]) - 3;
if (len <= 0)
continue;
if (STRCMP(file[i] + len, "@en") == 0)
{
// Sorting on priority means the same item in another language may
// be anywhere. Search all items for a match up to the "@en".
for (j = 0; j < num_file; ++j)
if (j != i && (int)STRLEN(file[j]) == len + 3
&& STRNCMP(file[i], file[j], len + 1) == 0)
break;
if (j == num_file)
// item only exists with @en, remove it
file[i][len] = NUL;
}
}
if (*buf != NUL)
for (i = 0; i < num_file; ++i)
{
len = (int)STRLEN(file[i]) - 3;
if (len <= 0)
continue;
if (STRCMP(file[i] + len, buf) == 0)
{
// remove the default language
file[i][len] = NUL;
}
}
}
#endif
/*
* Function given to ExpandGeneric() to obtain the possible arguments of the
* ":behave {mswin,xterm}" command.

File diff suppressed because it is too large Load Diff

1295
src/help.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -95,6 +95,7 @@ extern int _stricoll(char *a, char *b);
# include "gui_xim.pro"
# include "hardcopy.pro"
# include "hashtab.pro"
# include "help.pro"
# include "highlight.pro"
# include "indent.pro"
# include "insexpand.pro"

View File

@ -35,15 +35,6 @@ char_u *get_old_sub(void);
void set_old_sub(char_u *val);
void free_old_sub(void);
int prepare_tagpreview(int undo_sync, int use_previewpopup, use_popup_T use_popup);
void ex_help(exarg_T *eap);
void ex_helpclose(exarg_T *eap);
char_u *check_help_lang(char_u *arg);
int help_heuristic(char_u *matched_string, int offset, int wrong_case);
int find_help_tags(char_u *arg, int *num_matches, char_u ***matches, int keep_lang);
void fix_help_buffer(void);
void ex_exusage(exarg_T *eap);
void ex_viusage(exarg_T *eap);
void ex_helptags(exarg_T *eap);
void ex_smile(exarg_T *eap);
void ex_drop(exarg_T *eap);
char_u *skip_vimgrep_pat(char_u *p, char_u **s, int *flags);

14
src/proto/help.pro Normal file
View File

@ -0,0 +1,14 @@
/* help.c */
void ex_help(exarg_T *eap);
void ex_helpclose(exarg_T *eap);
char_u *check_help_lang(char_u *arg);
int help_heuristic(char_u *matched_string, int offset, int wrong_case);
int find_help_tags(char_u *arg, int *num_matches, char_u ***matches, int keep_lang);
void cleanup_help_tags(int num_file, char_u **file);
void prepare_help_buffer(void);
void fix_help_buffer(void);
void ex_exusage(exarg_T *eap);
void ex_viusage(exarg_T *eap);
void ex_helptags(exarg_T *eap);
/* vim: set ft=c : */

View File

@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1262,
/**/
1261,
/**/