diff options
-rw-r--r-- | Filelist | 4 | ||||
-rw-r--r-- | runtime/doc/spell.txt | 28 | ||||
-rw-r--r-- | runtime/doc/tags | 1 | ||||
-rw-r--r-- | runtime/doc/todo.txt | 31 | ||||
-rw-r--r-- | runtime/doc/version7.txt | 5 | ||||
-rw-r--r-- | runtime/lang/menu_de_de.latin1.vim | 11 | ||||
-rw-r--r-- | runtime/spell/en.ascii.spl | bin | 0 -> 1193528 bytes | |||
-rw-r--r-- | runtime/spell/en.latin1.spl | bin | 1196250 -> 1196252 bytes | |||
-rw-r--r-- | runtime/syntax/make.vim | 6 | ||||
-rw-r--r-- | src/Makefile | 8 | ||||
-rw-r--r-- | src/globals.h | 2 | ||||
-rw-r--r-- | src/hashtable.c | 60 | ||||
-rw-r--r-- | src/if_python.c | 11 | ||||
-rw-r--r-- | src/main.c | 7 | ||||
-rw-r--r-- | src/proto/hashtable.pro | 1 | ||||
-rw-r--r-- | src/version.h | 4 |
16 files changed, 132 insertions, 47 deletions
@@ -682,6 +682,10 @@ LANG_GEN = \ runtime/tutor/tutor.ru.* \ runtime/tutor/tutor.zh.* \ runtime/spell/README.txt \ + +# generic language files, binary +LANG_GEN_BIN = \ + runtime/spell/en.ascii.spl \ runtime/spell/en.latin1.spl \ runtime/spell/en.utf-8.spl \ diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index 04e1cfd0b..b33dec220 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -1,4 +1,4 @@ -*spell.txt* For Vim version 7.0aa. Last change: 2005 Apr 15 +*spell.txt* For Vim version 7.0aa. Last change: 2005 Apr 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -75,23 +75,24 @@ Vim searches for spell files in the "spell" subdirectory of the directories in -XXX optional addition EEE the value of 'encoding' -Exception: Vim uses "latin1" when 'encoding' is "iso-8859-15". The euro sign -doesn't matter for spelling. +Exceptions: +- Vim uses "latin1" when 'encoding' is "iso-8859-15". The euro sign doesn't + matter for spelling. +- When no spell file for 'encoding' is found "ascii" is tried. This only + works for languages where nearly all words are ASCII, such as English. It + helps when 'encoding' is not "latin1", such as iso-8859-2, and English text + is being edited. Spelling for EBCDIC is currently not supported. A spell file might not be available in the current 'encoding'. See |spell-mkspell| about how to create a spell file. Converting a spell file -with "iconv" will NOT work. - -If a spell file only uses ASCII characters the encoding can be omitted. This -is useful for English: "en.spl" The file with encoding is checked first, thus -you could have one with encoding that includes words with non-ASCII characters -and use the ASCII file as a fall-back. +with "iconv" will NOT work! *E758* *E759* When loading a spell file Vim checks that it is properly formatted. If you -get an error the file may be truncated, modified or for another Vim version. +get an error the file may be truncated, modified or intended for another Vim +version. WORDS @@ -126,9 +127,14 @@ uses. Myspell is used by OpenOffice.org and Mozilla. You should be able to find them here: http://lingucomponent.openoffice.org/spell_dic.html -:mksp[ell] {outname} {inname} ... *:mksp* *:mkspell* +:mksp[ell] [-ascii] {outname} {inname} ... *:mksp* *:mkspell* Generate spell file {outname}.spl from Myspell files {inname}.aff and {inname}.dic. + When the [-ascii] argument is present, words with + non-ascii characters are skipped. The resulting file + ends in "ascii.spl". Otherwise the resulting file + ends in "ENC.spl", where ENC is the value of + 'encoding'. Multiple {inname} arguments can be given to combine regions into one Vim spell file. Example: > :mkspell ~/.vim/spell/en /tmp/en_US /tmp/en_CA /tmp/en_AU diff --git a/runtime/doc/tags b/runtime/doc/tags index c89e2b368..bcbe4ba48 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -5111,7 +5111,6 @@ hebrew hebrew.txt /*hebrew* hebrew.txt hebrew.txt /*hebrew.txt* help various.txt /*help* help-context help.txt /*help-context* -help-tags tags 1 help-translated various.txt /*help-translated* help-xterm-window various.txt /*help-xterm-window* help.txt help.txt /*help.txt* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 33c1f8f5d..411e00179 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.0aa. Last change: 2005 Apr 15 +*todo.txt* For Vim version 7.0aa. Last change: 2005 Apr 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -98,7 +98,14 @@ PLANNED FOR VERSION 7.0: - Add SPELLCHECKER, with support for many languages. - Use "engspchk" from Charles Campbell for ideas. - Spell checking code todo's: - - BWF_ADDS and BWF_ADDSM for more than 256, only one byte for count. + - For French, prefixes with single quotes result in many additions. + How to do this more efficiently? Both storing and checking. + Put addition up to end of word also in hashtab, so that "s'aaa" + is found by "'aaa", s-bbb by "-bbb", etc. Put rest in table (search + longest match). + - use BWF_ADDS and BWF_ADDSM for more than 256, only one byte for count. + - Implement user and project word lists. Commands to add words and to + mark words as wrong. - Case folding only works when locale is set properly. E.g., when C locale is active then 'enc' is "latin1" but Ångström isn't seen as a ONECAP. @@ -107,29 +114,21 @@ PLANNED FOR VERSION 7.0: Put the character tables in the .aff file? - Implement = flag in .dic: KEEPCASE for lower case word. 's morgens/= does not match 'S morgens - - Merge en_US, en_CA, en_AU, etc. - Implement compound words? - - Make matching additions faster somehow? - - More efficient way to store additions? - remove fw_prefix and fw_suffix, use fw_len (word length) and put prefixes and suffixes right after it. - Make "en-rare" spell file. Convention: use en_US (language_region) and en-rare (language-field) - - Need to check for affixes of zero length? - - specify word characters in .aff file? + Add hl groups to 'spelllang'? + :set spelllang=en_us,en-rare/SpellRare,en-math/SpellMath - Polish: Anio and Hanio are wrong words, even though Myspell allows them. Problem with not ignoring case in conditions. - - Put addition up to end of word also in hashtab, so that "s'aaa" - is found by "'aaa", s-bbb by "-bbb", etc. Put rest in table (search - longest match). - - Rare words: use another dictionary. Add hl groups to 'spelllang'? - :set spelllang=en_us,en.rare/SpellRare,en.math/SpellMath - References MySpell library (in OpenOffice.org). http://spellchecker.mozdev.org/source.html http://whiteboard.openoffice.org/source/browse/whiteboard/lingucomponent/source/spellcheck/myspell/ author: Kevin Hendricks <kevin.hendricks@sympatico.ca> - Alternative: use aspell library. - ispell is replaced by aspell, thus forget about it. + ispell is replaced by aspell, thus forget about ispell. - More complicated: Regions with different languages? E.g. comments in English, strings in German (po file). - Commands required: @@ -139,11 +138,13 @@ PLANNED FOR VERSION 7.0: [s move to previous spell error [S also rare word ]s move to next spell error ]S also rare word (only "]s" is currently implemented) + Make this work like displaying, check @Spell in syntax. + Support a count. - Update option window for 'spell' and 'spelllang'. - Use an external program like aspell for suggestions to correct the - spelling? Or include the myspell/spell code in Vim? + spelling? Or include the myspell suggestion code in Vim? - Distribution: Need wordlists for many languages; "language pack" - - Work together with OpenOffic.org to update the wordlists. (Adri + - Work together with OpenOffice.org to update the wordlists. (Adri Verhoef, Aad Nales) - Support for approximate-regexps will help with finding similar words (agrep http://www.tgries.de/agrep/). diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt index ff3bfd667..e60b54496 100644 --- a/runtime/doc/version7.txt +++ b/runtime/doc/version7.txt @@ -1,4 +1,4 @@ -*version7.txt* For Vim version 7.0aa. Last change: 2005 Apr 05 +*version7.txt* For Vim version 7.0aa. Last change: 2005 Apr 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1042,4 +1042,7 @@ an error message when the argument isn't recognized. In gui_mch_draw_string() in gui_w32.c "unibuflen" wasn't static, resulting in reallocating the buffer every time. (Alexei Alexandrov) +When using a Python "atexit" function it was not invoked when Vim exits. Now +call Py_Finalize() for that. (Ugo Di Girolamo) + vim:tw=78:ts=8:ft=help:norl: diff --git a/runtime/lang/menu_de_de.latin1.vim b/runtime/lang/menu_de_de.latin1.vim index f0ed55f04..12488930a 100644 --- a/runtime/lang/menu_de_de.latin1.vim +++ b/runtime/lang/menu_de_de.latin1.vim @@ -1,7 +1,8 @@ " Menu Translations: German / Deutsch -" Maintainer: Johannes Zellner <johannes@zellner.org> -" Originally By: Marcin Dalecki <martin@dalecki.de> -" Last Change: Sat, 20 Apr 2002 19:02:42 CEST +" Maintainer: Georg Dahn <gorgyd@yahoo.co.uk> +" Originally By: Marcin Dalecki <dalecki@cs.net.pl> +" Johannes Zellner <johannes@zellner.org> +" Last Change: Sun, 17 Apr 2005 18:28:58 CEST " vim:set foldmethod=marker tabstop=8: " Quit when menu translations have already been done. @@ -44,7 +45,8 @@ menutrans &Copy<Tab>"+y &Kopieren<Tab>"+y menutrans &Paste<Tab>"+gP Ein&fügen<Tab>"+gP menutrans Put\ &Before<Tab>[p Da&vor\ Einfügen<Tab>[p menutrans Put\ &After<Tab>]p Da&nach\ Einfügen<Tab>]p -menutrans &Select\ all<Tab>ggVG Alles\ &Markieren<Tab>ggVG +menutrans &Delete<Tab>x &Löschen<Tab>x +menutrans &Select\ All<Tab>ggVG Alles\ &Markieren<Tab>ggVG menutrans &Find\.\.\. &Suchen\.\.\. menutrans Find\ and\ Rep&lace\.\.\. Suchen\ und\ &Ersetzen\.\.\. @@ -156,6 +158,7 @@ menutrans Conve&rt\ back<Tab>:%!xxd\ -r Zurück\ konvertieren<Tab>:%!xxd\ -r " {{{ SYNTAX / SYNTAX menutrans &Syntax &Syntax +menutrans &Show\ filetypes\ in\ menu Dateitypen\ an&zeigen menutrans Set\ '&syntax'\ only Nur\ '&syntax'\ Setzen menutrans Set\ '&filetype'\ too Auch\ '&filetype'\ Setzen menutrans &Off &Aus diff --git a/runtime/spell/en.ascii.spl b/runtime/spell/en.ascii.spl Binary files differnew file mode 100644 index 000000000..e489e1f15 --- /dev/null +++ b/runtime/spell/en.ascii.spl diff --git a/runtime/spell/en.latin1.spl b/runtime/spell/en.latin1.spl Binary files differindex 25c67de67..c65db0e3f 100644 --- a/runtime/spell/en.latin1.spl +++ b/runtime/spell/en.latin1.spl diff --git a/runtime/syntax/make.vim b/runtime/syntax/make.vim index 85da9800e..aba073ee5 100644 --- a/runtime/syntax/make.vim +++ b/runtime/syntax/make.vim @@ -2,7 +2,7 @@ " Language: Makefile " Maintainer: Claudio Fleiner <claudio@fleiner.com> " URL: http://www.fleiner.com/vim/syntax/make.vim -" Last Change: 2004 Apr 30 +" Last Change: 2005 Apr 17 " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded @@ -67,9 +67,9 @@ syn match makeStatement contained "(\(subst\|addprefix\|addsuffix\|basename\|cal " Comment if exists("make_microsoft") - syn match makeComment "#.*" contains=makeTodo + syn match makeComment "#.*" contains=makeTodo,@Spell else - syn region makeComment start="#" end="^$" end="[^\\]$" keepend contains=makeTodo + syn region makeComment start="#" end="^$" end="[^\\]$" keepend contains=makeTodo,@Spell syn match makeComment "#$" endif syn keyword makeTodo TODO FIXME XXX contained diff --git a/src/Makefile b/src/Makefile index 16d3338ec..f609466c0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -370,6 +370,8 @@ CClink = $(CC) # PYTHON # Uncomment this when you want to include the Python interface. +# NOTE: This may cause threading to be enabled, which has side effects (such +# as using different libraries and debugging becomes more difficult). #CONF_OPT_PYTHON = --enable-pythoninterp # TCL @@ -1810,7 +1812,11 @@ installtutor: $(DEST_VIM) $(DEST_RT) $(DEST_TUTOR) # Install the spell files, if they exist. installspell: $(DEST_VIM) $(DEST_RT) $(DEST_SPELL) - if test -f $(SPELLSOURCE)/en.spl; then \ + if test -f $(SPELLSOURCE)/en.latin1.spl; then \ + $(INSTALL_DATA) $(SPELLSOURCE)/*.spl $(DEST_SPELL); \ + chmod $(HELPMOD) $(DEST_SPELL)/*.spl; \ + fi + if test -f $(SPELLSOURCE)/en.utf-8.spl; then \ $(INSTALL_DATA) $(SPELLSOURCE)/*.spl $(DEST_SPELL); \ chmod $(HELPMOD) $(DEST_SPELL)/*.spl; \ fi diff --git a/src/globals.h b/src/globals.h index 81c1f7ec7..bbb0f1a69 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1297,7 +1297,7 @@ EXTERN char_u e_invexpr2[] INIT(=N_("E15: Invalid expression: %s")); #endif EXTERN char_u e_invrange[] INIT(=N_("E16: Invalid range")); EXTERN char_u e_invcmd[] INIT(=N_("E476: Invalid command")); -#ifdef UNIX +#if defined(UNIX) || (defined(FEAT_SYN_HL) && defined(FEAT_MBYTE)) EXTERN char_u e_isadir2[] INIT(=N_("E17: \"%s\" is a directory")); #endif #ifdef FEAT_LIBCALL diff --git a/src/hashtable.c b/src/hashtable.c index 0263f6f73..a8cd1b7d1 100644 --- a/src/hashtable.c +++ b/src/hashtable.c @@ -32,7 +32,10 @@ #if defined(FEAT_EVAL) || defined(FEAT_SYN_HL) || defined(PROTO) #if 0 -# define HT_DEBUG /* extra checks for table consistency */ +# define HT_DEBUG /* extra checks for table consistency and statistics */ + +static long hash_count_lookup = 0; /* count number of hashtab lookups */ +static long hash_count_perturb = 0; /* count number of "misses" */ #endif /* Magic value for algorithm that walks through the array. */ @@ -40,7 +43,7 @@ static int hash_may_resize __ARGS((hashtab_T *ht, int minitems)); -#if defined(FEAT_SYN_HL) || defined(PROTO) +#if 0 /* currently not used */ /* * Create an empty hash table. * Returns NULL when out of memory. @@ -112,6 +115,10 @@ hash_lookup(ht, key, hash) hashitem_T *hi; int idx; +#ifdef HT_DEBUG + ++hash_count_lookup; +#endif + /* * Quickly handle the most common situations: * - return if there is no item at all @@ -141,6 +148,9 @@ hash_lookup(ht, key, hash) */ for (perturb = hash; ; perturb >>= PERTURB_SHIFT) { +#ifdef HT_DEBUG + ++hash_count_perturb; /* count a "miss" for hashtab lookup */ +#endif idx = (idx << 2) + idx + perturb + 1; hi = &ht->ht_array[idx & ht->ht_mask]; if (hi->hi_key == NULL) @@ -155,6 +165,23 @@ hash_lookup(ht, key, hash) } /* + * Print the efficiency of hashtable lookups. + * Useful when trying different hash algorithms. + * Called when exiting. + */ + void +hash_debug_results() +{ +#ifdef HT_DEBUG + fprintf(stderr, "\r\n\r\n\r\n\r\n"); + fprintf(stderr, "Number of hashtable lookups: %ld\r\n", hash_count_lookup); + fprintf(stderr, "Number of perturb loops: %ld\r\n", hash_count_perturb); + fprintf(stderr, "Percentage of perturb loops: %ld%%\r\n", + hash_count_perturb * 100 / hash_count_lookup); +#endif +} + +/* * Add item with key "key" to hashtable "ht". * Returns FAIL when out of memory or the key is already present. */ @@ -332,7 +359,7 @@ hash_may_resize(ht, minitems) else { /* Use specified size. */ - if (minitems < ht->ht_used) /* just in case... */ + if ((long_u)minitems < ht->ht_used) /* just in case... */ minitems = ht->ht_used; minsize = minitems * 3 / 2; /* array is up to 2/3 full */ } @@ -420,16 +447,28 @@ hash_may_resize(ht, minitems) } /* - * Get the hash number for a key. Uses the ElfHash algorithm, which is - * supposed to have an even distribution (suggested by Charles Campbell). + * Get the hash number for a key. + * If you think you know a better hash function: Compile with HT_DEBUG set and + * run a script that uses hashtables a lot. Vim will then print statistics + * when exiting. Try that with the current hash algorithm and yours. The + * lower the percentage the better. */ hash_T hash_hash(key) char_u *key; { - hash_T hash = 0; + hash_T hash; + char_u *p; + + if ((hash = *key) == 0) + return (hash_T)0; /* Empty keys are not allowed, but we don't + want to crash if we get one. */ + p = key + 1; + +#if 0 + /* ElfHash algorithm, which is supposed to have an even distribution. + * Suggested by Charles Campbell. */ hash_T g; - char_u *p = key; while (*p != NUL) { @@ -438,6 +477,13 @@ hash_hash(key) if (g != 0) hash ^= g >> 24; /* xor g's high 4 bits into hash */ } +#else + + /* A simplistic algorithm that appears to do very well. + * Suggested by George Reilly. */ + while (*p != NUL) + hash = hash * 101 + *p++; +#endif return hash; } diff --git a/src/if_python.c b/src/if_python.c index 04a8d179a..02d6ac18f 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -115,6 +115,8 @@ struct PyMethodDef { int a; }; # define Py_FindMethod dll_Py_FindMethod # define Py_InitModule4 dll_Py_InitModule4 # define Py_Initialize dll_Py_Initialize +# define Py_Finalize dll_Py_Finalize +# define Py_IsInitialized dll_Py_IsInitialized # define _PyObject_New dll__PyObject_New # define _Py_NoneStruct (*dll__Py_NoneStruct) # define PyObject_Init dll__PyObject_Init @@ -169,6 +171,8 @@ static PyObject*(*dll_Py_BuildValue)(char *, ...); static PyObject*(*dll_Py_FindMethod)(struct PyMethodDef[], PyObject *, char *); static PyObject*(*dll_Py_InitModule4)(char *, struct PyMethodDef *, char *, PyObject *, int); static void(*dll_Py_Initialize)(void); +static void(*dll_Py_Finalize)(void); +static int(*dll_Py_IsInitialized)(void); static PyObject*(*dll__PyObject_New)(PyTypeObject *, PyObject *); static PyObject*(*dll__PyObject_Init)(PyObject *, PyTypeObject *); static PyObject* dll__Py_NoneStruct; @@ -245,6 +249,8 @@ static struct {"Py_FindMethod", (PYTHON_PROC*)&dll_Py_FindMethod}, {"Py_InitModule4", (PYTHON_PROC*)&dll_Py_InitModule4}, {"Py_Initialize", (PYTHON_PROC*)&dll_Py_Initialize}, + {"Py_Finalize", (PYTHON_PROC*)&dll_Py_Finalize}, + {"Py_IsInitialized", (PYTHON_PROC*)&dll_Py_IsInitialized}, {"_PyObject_New", (PYTHON_PROC*)&dll__PyObject_New}, {"PyObject_Init", (PYTHON_PROC*)&dll__PyObject_Init}, {"_Py_NoneStruct", (PYTHON_PROC*)&dll__Py_NoneStruct}, @@ -423,7 +429,12 @@ static void Python_Release_Vim(void) python_end() { #ifdef DYNAMIC_PYTHON + if (hinstPython && Py_IsInitialized()) + Py_Finalize(); end_dynamic_python(); +#else + if (Py_IsInitialized()) + Py_Finalize(); #endif } diff --git a/src/main.c b/src/main.c index 8e03524d6..eb9aa2863 100644 --- a/src/main.c +++ b/src/main.c @@ -15,7 +15,7 @@ #include "vim.h" #ifdef SPAWNO -# include <spawno.h> /* special MSDOS swapping library */ +# include <spawno.h> /* special MS-DOS swapping library */ #endif #ifdef HAVE_FCNTL_H @@ -2312,6 +2312,11 @@ getout(exitval) #endif windgoto((int)Rows - 1, 0); +#if defined(FEAT_EVAL) || defined(FEAT_SYN_HL) + /* Optionally print hashtable efficiency. */ + hash_debug_results(); +#endif + #ifdef FEAT_GUI msg_didany = FALSE; #endif diff --git a/src/proto/hashtable.pro b/src/proto/hashtable.pro index 3a3818ea7..cacd7a333 100644 --- a/src/proto/hashtable.pro +++ b/src/proto/hashtable.pro @@ -4,6 +4,7 @@ void hash_init __ARGS((hashtab_T *ht)); void hash_clear __ARGS((hashtab_T *ht)); hashitem_T *hash_find __ARGS((hashtab_T *ht, char_u *key)); hashitem_T *hash_lookup __ARGS((hashtab_T *ht, char_u *key, hash_T hash)); +void hash_debug_results __ARGS((void)); int hash_add __ARGS((hashtab_T *ht, char_u *key)); int hash_add_item __ARGS((hashtab_T *ht, hashitem_T *hi, char_u *key, hash_T hash)); void hash_remove __ARGS((hashtab_T *ht, hashitem_T *hi)); diff --git a/src/version.h b/src/version.h index 5a8c7c2c2..70630b6df 100644 --- a/src/version.h +++ b/src/version.h @@ -36,5 +36,5 @@ #define VIM_VERSION_NODOT "vim70aa" #define VIM_VERSION_SHORT "7.0aa" #define VIM_VERSION_MEDIUM "7.0aa ALPHA" -#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Apr 15)" -#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Apr 15, compiled " +#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Apr 17)" +#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Apr 17, compiled " |