0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

updated for version 7.0092

This commit is contained in:
Bram Moolenaar
2005-06-24 23:01:23 +00:00
parent c4def13f8b
commit 0a5fe2140d
14 changed files with 192 additions and 52 deletions

View File

@@ -2,7 +2,12 @@
" Language: Pyrex " Language: Pyrex
" Maintainer: Marco Barisione <marco.bari@people.it> " Maintainer: Marco Barisione <marco.bari@people.it>
" URL: http://marcobari.altervista.org/pyrex_vim.html " URL: http://marcobari.altervista.org/pyrex_vim.html
" Last Change: 2004 May 16 " Last Change: 2005 Jun 24
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
" Use Python formatting rules " Use Python formatting rules
runtime! indent/python.vim runtime! indent/python.vim

Binary file not shown.

View File

@@ -533,6 +533,14 @@ LINT_OPTIONS = -beprxzF
#PROFILE_CFLAGS = -pg -g #PROFILE_CFLAGS = -pg -g
#PROFILE_LIBS = -pg #PROFILE_LIBS = -pg
# MEMORY LEAK DETECTION
# Requires installing the ccmalloc library.
# Configuration is in the .ccmalloc file.
# Doesn't work very well, since memory linked to from global variables
# (indirectly) is also marked as leaked memory.
#PROFILE_CFLAGS = -DEXITFREE
#PROFILE_LIBS = -lccmalloc
##################################################### #####################################################
### Specific systems, check if yours is listed! ### {{{ ### Specific systems, check if yours is listed! ### {{{
##################################################### #####################################################

View File

@@ -46,7 +46,6 @@ static garray_T ucmds = {0, 0, sizeof(ucmd_T), 4, NULL};
static void do_ucmd __ARGS((exarg_T *eap)); static void do_ucmd __ARGS((exarg_T *eap));
static void ex_command __ARGS((exarg_T *eap)); static void ex_command __ARGS((exarg_T *eap));
static void ex_comclear __ARGS((exarg_T *eap));
static void ex_delcommand __ARGS((exarg_T *eap)); static void ex_delcommand __ARGS((exarg_T *eap));
# ifdef FEAT_CMDL_COMPL # ifdef FEAT_CMDL_COMPL
static char_u *get_user_command_name __ARGS((int idx)); static char_u *get_user_command_name __ARGS((int idx));
@@ -5390,12 +5389,10 @@ ex_command(eap)
/* /*
* ":comclear" * ":comclear"
*/
/*ARGSUSED*/
/*
* Clear all user commands, global and for current buffer. * Clear all user commands, global and for current buffer.
*/ */
static void /*ARGSUSED*/
void
ex_comclear(eap) ex_comclear(eap)
exarg_T *eap; exarg_T *eap;
{ {

View File

@@ -7093,6 +7093,17 @@ do_augroup(arg, del_group)
} }
} }
#if defined(EXITFREE) || defined(PROTO)
void
free_all_autocmds()
{
for (current_augroup = -1; current_augroup < augroups.ga_len;
++current_augroup)
do_autocmd((char_u *)"", TRUE);
ga_clear_strings(&augroups);
}
#endif
/* /*
* Return the event number for event name "start". * Return the event number for event name "start".
* Return NUM_EVENTS if the event name was not found. * Return NUM_EVENTS if the event name was not found.
@@ -7632,9 +7643,9 @@ do_autocmd_event(event, pat, nested, cmd, forceit, group)
&ap->allow_dirs, TRUE); &ap->allow_dirs, TRUE);
if (reg_pat != NULL) if (reg_pat != NULL)
ap->reg_prog = vim_regcomp(reg_pat, RE_MAGIC); ap->reg_prog = vim_regcomp(reg_pat, RE_MAGIC);
vim_free(reg_pat);
if (reg_pat == NULL || ap->reg_prog == NULL) if (reg_pat == NULL || ap->reg_prog == NULL)
{ {
vim_free(reg_pat);
vim_free(ap->pat); vim_free(ap->pat);
vim_free(ap); vim_free(ap);
return FAIL; return FAIL;

View File

@@ -743,13 +743,8 @@ add_msg_hist(s, len, attr)
/* Don't let the message history get too big */ /* Don't let the message history get too big */
while (msg_hist_len > 20) while (msg_hist_len > 20)
{ (void)delete_first_msg();
p = first_msg_hist;
first_msg_hist = p->next;
vim_free(p->msg);
vim_free(p);
--msg_hist_len;
}
/* allocate an entry and add the message at the end of the history */ /* allocate an entry and add the message at the end of the history */
p = (struct msg_hist *)alloc((int)sizeof(struct msg_hist)); p = (struct msg_hist *)alloc((int)sizeof(struct msg_hist));
if (p != NULL) if (p != NULL)
@@ -776,6 +771,25 @@ add_msg_hist(s, len, attr)
} }
} }
/*
* Delete the first (oldest) message from the history.
* Returns FAIL if there are no messages.
*/
int
delete_first_msg()
{
struct msg_hist *p;
if (msg_hist_len <= 0)
return FAIL;
p = first_msg_hist;
first_msg_hist = p->next;
vim_free(p->msg);
vim_free(p);
--msg_hist_len;
return OK;
}
/* /*
* ":messages" command. * ":messages" command.
*/ */

View File

@@ -2699,6 +2699,24 @@ mch_early_init()
#endif #endif
} }
#if defined(EXITFREE) || defined(PROTO)
void
mch_free_mem()
{
# if defined(HAVE_SIGALTSTACK) || defined(HAVE_SIGSTACK)
vim_free(signal_stack);
# endif
# if (defined(FEAT_X11) && defined(FEAT_XCLIPBOARD)) || defined(PROTO)
if (xterm_Shell != (Widget)0)
XtDestroyWidget(xterm_Shell);
if (xterm_dpy != NULL)
XtCloseDisplay(xterm_dpy);
if (app_context != (XtAppContext)NULL)
XtDestroyApplicationContext(app_context);
# endif
}
#endif
static void exit_scroll __ARGS((void)); static void exit_scroll __ARGS((void));
/* /*
@@ -2796,6 +2814,11 @@ mch_exit(r)
if (usingNetbeans) if (usingNetbeans)
netbeans_send_disconnect(); netbeans_send_disconnect();
#endif #endif
#ifdef EXITFREE
free_all_mem();
#endif
exit(r); exit(r);
} }

View File

@@ -15,6 +15,7 @@ int ends_excmd __ARGS((int c));
char_u *find_nextcmd __ARGS((char_u *p)); char_u *find_nextcmd __ARGS((char_u *p));
char_u *check_nextcmd __ARGS((char_u *p)); char_u *check_nextcmd __ARGS((char_u *p));
char_u *get_command_name __ARGS((expand_T *xp, int idx)); char_u *get_command_name __ARGS((expand_T *xp, int idx));
void ex_comclear __ARGS((exarg_T *eap));
void uc_clear __ARGS((garray_T *gap)); void uc_clear __ARGS((garray_T *gap));
char_u *get_user_commands __ARGS((expand_T *xp, int idx)); char_u *get_user_commands __ARGS((expand_T *xp, int idx));
char_u *get_user_cmd_flags __ARGS((expand_T *xp, int idx)); char_u *get_user_cmd_flags __ARGS((expand_T *xp, int idx));

View File

@@ -25,6 +25,7 @@ void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col));
int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches)); int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches));
int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int)))); int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int))));
char_u *globpath __ARGS((char_u *path, char_u *file)); char_u *globpath __ARGS((char_u *path, char_u *file));
void init_history __ARGS((void));
int get_histtype __ARGS((char_u *name)); int get_histtype __ARGS((char_u *name));
void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep)); void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep));
int get_history_idx __ARGS((int histype)); int get_history_idx __ARGS((int histype));

View File

@@ -11,6 +11,7 @@ int emsg2 __ARGS((char_u *s, char_u *a1));
void emsg_invreg __ARGS((int name)); void emsg_invreg __ARGS((int name));
char_u *msg_trunc_attr __ARGS((char_u *s, int force, int attr)); char_u *msg_trunc_attr __ARGS((char_u *s, int force, int attr));
char_u *msg_may_trunc __ARGS((int force, char_u *s)); char_u *msg_may_trunc __ARGS((int force, char_u *s));
int delete_first_msg __ARGS((void));
void ex_messages __ARGS((exarg_T *eap)); void ex_messages __ARGS((exarg_T *eap));
void msg_end_prompt __ARGS((void)); void msg_end_prompt __ARGS((void));
void wait_return __ARGS((int redraw)); void wait_return __ARGS((int redraw));
@@ -34,7 +35,6 @@ void str2specialbuf __ARGS((char_u *sp, char_u *buf, int len));
void msg_prt_line __ARGS((char_u *s, int list)); void msg_prt_line __ARGS((char_u *s, int list));
void msg_puts __ARGS((char_u *s)); void msg_puts __ARGS((char_u *s));
void msg_puts_title __ARGS((char_u *s)); void msg_puts_title __ARGS((char_u *s));
void msg_puts_long __ARGS((char_u *longstr));
void msg_puts_long_attr __ARGS((char_u *longstr, int attr)); void msg_puts_long_attr __ARGS((char_u *longstr, int attr));
void msg_puts_long_len_attr __ARGS((char_u *longstr, int len, int attr)); void msg_puts_long_len_attr __ARGS((char_u *longstr, int len, int attr));
void msg_puts_attr __ARGS((char_u *s, int attr)); void msg_puts_attr __ARGS((char_u *s, int attr));

View File

@@ -29,6 +29,7 @@ int swapchar __ARGS((int op_type, pos_T *pos));
void op_insert __ARGS((oparg_T *oap, long count1)); void op_insert __ARGS((oparg_T *oap, long count1));
int op_change __ARGS((oparg_T *oap)); int op_change __ARGS((oparg_T *oap));
void init_yank __ARGS((void)); void init_yank __ARGS((void));
void clear_registers __ARGS((void));
int op_yank __ARGS((oparg_T *oap, int deleting, int mess)); int op_yank __ARGS((oparg_T *oap, int deleting, int mess));
void do_put __ARGS((int regname, int dir, long count, int flags)); void do_put __ARGS((int regname, int dir, long count, int flags));
int preprocs_left __ARGS((void)); int preprocs_left __ARGS((void));

View File

@@ -15,13 +15,14 @@ int syn_get_foldlevel __ARGS((win_T *wp, long lnum));
void init_highlight __ARGS((int both, int reset)); void init_highlight __ARGS((int both, int reset));
int load_colors __ARGS((char_u *name)); int load_colors __ARGS((char_u *name));
void do_highlight __ARGS((char_u *line, int forceit, int init)); void do_highlight __ARGS((char_u *line, int forceit, int init));
void free_highlight __ARGS((void));
void restore_cterm_colors __ARGS((void)); void restore_cterm_colors __ARGS((void));
void set_normal_colors __ARGS((void)); void set_normal_colors __ARGS((void));
char_u *hl_get_font_name __ARGS((void)); char_u *hl_get_font_name __ARGS((void));
void hl_set_font_name __ARGS((char_u *font_name)); void hl_set_font_name __ARGS((char_u *font_name));
void hl_set_bg_color_name __ARGS((char_u *name)); void hl_set_bg_color_name __ARGS((char_u *name));
void hl_set_fg_color_name __ARGS((char_u *name)); void hl_set_fg_color_name __ARGS((char_u *name));
int hl_combine_attr __ARGS((int char_attr, int spell_attr)); int hl_combine_attr __ARGS((int char_attr, int prim_attr));
attrentry_T *syn_gui_attr2entry __ARGS((int attr)); attrentry_T *syn_gui_attr2entry __ARGS((int attr));
attrentry_T *syn_term_attr2entry __ARGS((int attr)); attrentry_T *syn_term_attr2entry __ARGS((int attr));
attrentry_T *syn_cterm_attr2entry __ARGS((int attr)); attrentry_T *syn_cterm_attr2entry __ARGS((int attr));

View File

@@ -2098,6 +2098,7 @@ did_set_spelllang(buf)
garray_T ga; garray_T ga;
char_u *splp; char_u *splp;
char_u *region; char_u *region;
int filename;
int region_mask; int region_mask;
slang_T *lp; slang_T *lp;
int c; int c;
@@ -2125,34 +2126,55 @@ did_set_spelllang(buf)
/* Get one language name. */ /* Get one language name. */
copy_option_part(&splp, lang, MAXWLEN, ","); copy_option_part(&splp, lang, MAXWLEN, ",");
/* If there is a region name let "region" point to it and remove it
* from the name. */
region = NULL; region = NULL;
len = STRLEN(lang); len = STRLEN(lang);
if (len > 3 && lang[len - 3] == '_')
{
region = lang + len - 2;
len -= 3;
lang[len] = NUL;
}
/* Check if we loaded this language before. */ /* If the name ends in ".spl" use it as the name of the spell file.
for (lp = first_lang; lp != NULL; lp = lp->sl_next) * If there is a region name let "region" point to it and remove it
if (STRICMP(lp->sl_name, lang) == 0) * from the name. */
break; if (len > 4 && fnamecmp(lang + len - 4, ".spl") == 0)
{
filename = TRUE;
/* Check if we loaded this language before. */
for (lp = first_lang; lp != NULL; lp = lp->sl_next)
if (fullpathcmp(lang, lp->sl_fname, FALSE) == FPC_SAME)
break;
}
else
{
filename = FALSE;
if (len > 3 && lang[len - 3] == '_')
{
region = lang + len - 2;
len -= 3;
lang[len] = NUL;
}
/* Check if we loaded this language before. */
for (lp = first_lang; lp != NULL; lp = lp->sl_next)
if (STRICMP(lang, lp->sl_name) == 0)
break;
}
/* If not found try loading the language now. */ /* If not found try loading the language now. */
if (lp == NULL) if (lp == NULL)
spell_load_lang(lang); {
if (filename)
(void)spell_load_file(lang, lang, NULL, FALSE);
else
spell_load_lang(lang);
}
/* /*
* Loop over the languages, there can be several files for "lang". * Loop over the languages, there can be several files for "lang".
*/ */
for (lp = first_lang; lp != NULL; lp = lp->sl_next) for (lp = first_lang; lp != NULL; lp = lp->sl_next)
if (STRICMP(lp->sl_name, lang) == 0) if (filename ? fullpathcmp(lang, lp->sl_fname, FALSE) == FPC_SAME
: STRICMP(lang, lp->sl_name) == 0)
{ {
region_mask = REGION_ALL; region_mask = REGION_ALL;
if (region != NULL) if (!filename && region != NULL)
{ {
/* find region in sl_regions */ /* find region in sl_regions */
c = find_region(lp->sl_regions, region); c = find_region(lp->sl_regions, region);
@@ -2311,6 +2333,29 @@ captype(word, end)
return 0; return 0;
} }
# if defined(FEAT_MBYTE) || defined(EXITFREE) || defined(PROTO)
/*
* Free all languages.
*/
void
spell_free_all()
{
slang_T *lp;
buf_T *buf;
/* Go through all buffers and handle 'spelllang'. */
for (buf = firstbuf; buf != NULL; buf = buf->b_next)
ga_clear(&buf->b_langp);
while (first_lang != NULL)
{
lp = first_lang;
first_lang = lp->sl_next;
slang_free(lp);
}
}
# endif
# if defined(FEAT_MBYTE) || defined(PROTO) # if defined(FEAT_MBYTE) || defined(PROTO)
/* /*
* Clear all spelling tables and reload them. * Clear all spelling tables and reload them.
@@ -2320,25 +2365,17 @@ captype(word, end)
spell_reload() spell_reload()
{ {
buf_T *buf; buf_T *buf;
slang_T *lp;
win_T *wp; win_T *wp;
/* Initialize the table for SPELL_ISWORDP(). */ /* Initialize the table for SPELL_ISWORDP(). */
init_spell_chartab(); init_spell_chartab();
/* Unload all allocated memory. */ /* Unload all allocated memory. */
while (first_lang != NULL) spell_free_all();
{
lp = first_lang;
first_lang = lp->sl_next;
slang_free(lp);
}
/* Go through all buffers and handle 'spelllang'. */ /* Go through all buffers and handle 'spelllang'. */
for (buf = firstbuf; buf != NULL; buf = buf->b_next) for (buf = firstbuf; buf != NULL; buf = buf->b_next)
{ {
ga_clear(&buf->b_langp);
/* Only load the wordlists when 'spelllang' is set and there is a /* Only load the wordlists when 'spelllang' is set and there is a
* window for this buffer in which 'spell' is set. */ * window for this buffer in which 'spell' is set. */
if (*buf->b_p_spl != NUL) if (*buf->b_p_spl != NUL)
@@ -5290,6 +5327,8 @@ spell_find_suggest(badptr, su, maxcount)
vim_memset(su, 0, sizeof(suginfo_T)); vim_memset(su, 0, sizeof(suginfo_T));
ga_init2(&su->su_ga, (int)sizeof(suggest_T), 10); ga_init2(&su->su_ga, (int)sizeof(suggest_T), 10);
ga_init2(&su->su_sga, (int)sizeof(suggest_T), 10); ga_init2(&su->su_sga, (int)sizeof(suggest_T), 10);
if (*badptr == NUL)
return;
hash_init(&su->su_banned); hash_init(&su->su_banned);
su->su_badptr = badptr; su->su_badptr = badptr;
@@ -7047,6 +7086,8 @@ add_banned(su, word)
hi = hash_lookup(&su->su_banned, s, hash); hi = hash_lookup(&su->su_banned, s, hash);
if (HASHITEM_EMPTY(hi)) if (HASHITEM_EMPTY(hi))
hash_add_item(&su->su_banned, hi, s, hash); hash_add_item(&su->su_banned, hi, s, hash);
else
vim_free(s);
} }
} }
@@ -7920,10 +7961,15 @@ ex_spelldump(eap)
& lp->lp_region) != 0)) & lp->lp_region) != 0))
{ {
word[depth] = NUL; word[depth] = NUL;
dump_word(word, round, flags, lnum++);
/* Dump the basic word if there is no prefix or
* when it's the first one. */
c = (unsigned)flags >> 16;
if (c == 0 || curi[depth] == 2)
dump_word(word, round, flags, lnum++);
/* Apply the prefix, if there is one. */ /* Apply the prefix, if there is one. */
if ((unsigned)flags >> 16 != 0) if (c != 0)
lnum = apply_prefixes(slang, word, round, lnum = apply_prefixes(slang, word, round,
flags, lnum); flags, lnum);
} }

View File

@@ -26,6 +26,7 @@ static void win_exchange __ARGS((long));
static void win_rotate __ARGS((int, int)); static void win_rotate __ARGS((int, int));
static void win_totop __ARGS((int size, int flags)); static void win_totop __ARGS((int size, int flags));
static void win_equal_rec __ARGS((win_T *next_curwin, int current, frame_T *topfr, int dir, int col, int row, int width, int height)); static void win_equal_rec __ARGS((win_T *next_curwin, int current, frame_T *topfr, int dir, int col, int row, int width, int height));
static win_T *win_free_mem __ARGS((win_T *win, int *dirp));
static win_T *winframe_remove __ARGS((win_T *win, int *dirp)); static win_T *winframe_remove __ARGS((win_T *win, int *dirp));
static frame_T *win_altframe __ARGS((win_T *win)); static frame_T *win_altframe __ARGS((win_T *win));
static win_T *frame2win __ARGS((frame_T *frp)); static win_T *frame2win __ARGS((frame_T *frp));
@@ -1808,7 +1809,6 @@ win_close(win, free_buf)
int other_buffer = FALSE; int other_buffer = FALSE;
#endif #endif
int close_curwin = FALSE; int close_curwin = FALSE;
frame_T *frp;
int dir; int dir;
int help_window = FALSE; int help_window = FALSE;
@@ -1864,14 +1864,8 @@ win_close(win, free_buf)
if (!win_valid(win) || firstwin == lastwin) if (!win_valid(win) || firstwin == lastwin)
return; return;
/* reduce the reference count to the argument list. */ /* Free the memory used for the window. */
alist_unlink(win->w_alist); wp = win_free_mem(win, &dir);
/* remove the window and its frame from the tree of frames. */
frp = win->w_frame;
wp = winframe_remove(win, &dir);
vim_free(frp);
win_free(win);
/* Make sure curwin isn't invalid. It can cause severe trouble when /* Make sure curwin isn't invalid. It can cause severe trouble when
* printing an error message. For win_equal() curbuf needs to be valid * printing an error message. For win_equal() curbuf needs to be valid
@@ -1949,6 +1943,41 @@ win_close(win, free_buf)
redraw_all_later(NOT_VALID); redraw_all_later(NOT_VALID);
} }
/*
* Free the memory used for a window.
* Returns a pointer to the window that got the freed up space.
*/
static win_T *
win_free_mem(win, dirp)
win_T *win;
int *dirp; /* set to 'v' or 'h' for direction if 'ea' */
{
frame_T *frp;
win_T *wp;
/* reduce the reference count to the argument list. */
alist_unlink(win->w_alist);
/* remove the window and its frame from the tree of frames. */
frp = win->w_frame;
wp = winframe_remove(win, dirp);
vim_free(frp);
win_free(win);
return wp;
}
#if defined(EXITFREE) || defined(PROTO)
void
win_free_all()
{
int dummy;
while (firstwin != NULL)
(void)win_free_mem(firstwin, &dummy);
}
#endif
/* /*
* Remove a window and its frame from the tree of frames. * Remove a window and its frame from the tree of frames.
* Returns a pointer to the window that got the freed up space. * Returns a pointer to the window that got the freed up space.
@@ -1968,6 +1997,9 @@ winframe_remove(win, dirp)
* Remove the window from its frame. * Remove the window from its frame.
*/ */
frp2 = win_altframe(win); frp2 = win_altframe(win);
if (frp2 == NULL)
return NULL; /* deleted the last frame */
wp = frame2win(frp2); wp = frame2win(frp2);
/* Remove this frame from the list of frames. */ /* Remove this frame from the list of frames. */
@@ -2068,7 +2100,7 @@ win_altframe(win)
frp = win->w_frame; frp = win->w_frame;
#ifdef FEAT_VERTSPLIT #ifdef FEAT_VERTSPLIT
if (frp->fr_parent->fr_layout == FR_ROW) if (frp->fr_parent != NULL && frp->fr_parent->fr_layout == FR_ROW)
b = p_spr; b = p_spr;
else else
#endif #endif