diff options
-rw-r--r-- | runtime/doc/eval.txt | 9 | ||||
-rw-r--r-- | runtime/doc/quickfix.txt | 6 | ||||
-rw-r--r-- | runtime/doc/starting.txt | 4 | ||||
-rw-r--r-- | runtime/doc/tags | 5 | ||||
-rw-r--r-- | runtime/doc/todo.txt | 8 | ||||
-rw-r--r-- | runtime/doc/various.txt | 5 | ||||
-rw-r--r-- | runtime/doc/version7.txt | 10 | ||||
-rw-r--r-- | src/ex_cmds2.c | 28 | ||||
-rw-r--r-- | src/fileio.c | 42 | ||||
-rw-r--r-- | src/hashtable.c | 43 | ||||
-rw-r--r-- | src/main.c | 3 | ||||
-rw-r--r-- | src/proto/eval.pro | 5 | ||||
-rw-r--r-- | src/proto/fileio.pro | 2 | ||||
-rw-r--r-- | src/proto/hashtable.pro | 3 | ||||
-rw-r--r-- | src/quickfix.c | 73 | ||||
-rw-r--r-- | src/structs.h | 75 | ||||
-rw-r--r-- | src/testdir/test55.in | 36 | ||||
-rw-r--r-- | src/testdir/test55.ok | 9 | ||||
-rw-r--r-- | src/version.h | 4 |
19 files changed, 262 insertions, 108 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index bcd71c0a1..3eeb98fd7 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.0aa. Last change: 2005 Jan 19 +*eval.txt* For Vim version 7.0aa. Last change: 2005 Jan 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -4413,7 +4413,12 @@ This would call the function "my_func_whizz(parameter)". List item. *E106* :let {var-name} .. List the value of variable {var-name}. Multiple - variable names may be given. + variable names may be given. Special names recognized + here: *E738* + g: global variables. + b: local buffer variables. + w: local window variables. + v: Vim variables. :let List the values of all variables. The type of the variable is indicated before the value: diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index 57ea91f9a..efec7966c 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -1,4 +1,4 @@ -*quickfix.txt* For Vim version 7.0aa. Last change: 2005 Jan 10 +*quickfix.txt* For Vim version 7.0aa. Last change: 2005 Jan 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -288,6 +288,8 @@ advantages are: - Uses Vim search patterns. Multi-line patterns can be used. - When plugins are enabled: compressed and remote files can be searched. |gzip| |netrw| +- When 'hidden' is set the files are kept loaded, thus repeating a search is + much faster. Uses a lot of memory though! 5.1 using Vim's internal grep @@ -303,6 +305,8 @@ advantages are: 'ignorecase' applies. To overrule it use |/\c| to ignore case or |/\C| to match case. 'smartcase' is not used. + Every second or so the searched file name is displayed + to give you an idea of the progress made. Examples: > :vimgrep /an error/ *.c :vimgrep /\<FileName\>/ *.h include/* diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 705b50fa2..39fbd44cf 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -1,4 +1,4 @@ -*starting.txt* For Vim version 7.0aa. Last change: 2005 Jan 07 +*starting.txt* For Vim version 7.0aa. Last change: 2005 Jan 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1193,7 +1193,7 @@ This saves the current Session, and starts off the command to load another. When [file] is omitted or is a number from 1 to 9, a name is generated and 'viewdir' prepended. When last directory name in 'viewdir' does not exist, this - directory is created. + directory is created. *E738* An existing file is always overwritten then. Use |:loadview| to load this view again. When [file] is the name of a file ('viewdir' is not diff --git a/runtime/doc/tags b/runtime/doc/tags index 49d0f2dce..894441871 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -2036,13 +2036,16 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :lefta windows.txt /*:lefta* :leftabove windows.txt /*:leftabove* :let eval.txt /*:let* +:let+= eval.txt /*:let+=* :let-$ eval.txt /*:let-$* +:let-= eval.txt /*:let-=* :let-@ eval.txt /*:let-@* :let-environment eval.txt /*:let-environment* :let-option eval.txt /*:let-option* :let-register eval.txt /*:let-register* :let-star eval.txt /*:let-star* :let-unpack eval.txt /*:let-unpack* +:let.= eval.txt /*:let.=* :list various.txt /*:list* :lm map.txt /*:lm* :lmap map.txt /*:lmap* @@ -3634,6 +3637,7 @@ E732 eval.txt /*E732* E733 eval.txt /*E733* E735 eval.txt /*E735* E736 eval.txt /*E736* +E737 eval.txt /*E737* E74 message.txt /*E74* E75 vi_diff.txt /*E75* E76 pattern.txt /*E76* @@ -5034,7 +5038,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 70a783d67..06186f976 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 Jan 19 +*todo.txt* For Vim version 7.0aa. Last change: 2005 Jan 21 VIM REFERENCE MANUAL by Bram Moolenaar @@ -30,10 +30,12 @@ be worked on, but only if you sponsor Vim development. See |sponsor|. *known-bugs* -------------------- Known bugs and current work ----------------------- +Dict member: use dict..foo instead of dict.foo to avoid confusion with string +concatenation? + Hashtable implementation: -- Use hashtable for variables and syntax keywords. +- Use hashtable for syntax keywords. -":grep": display progress (filename, every second or so) Can ":grep" made faster somehow? Do profiling. Sanity check of eval.c: diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 964016ae6..a04dd30cb 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -1,4 +1,4 @@ -*various.txt* For Vim version 7.0aa. Last change: 2004 Dec 23 +*various.txt* For Vim version 7.0aa. Last change: 2005 Jan 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -387,10 +387,13 @@ N *+X11* Unix only: can restore window title |X11| :redi[r] @{a-zA-Z} Redirect messages to register {a-z}. Append to the contents of the register if its name is given uppercase {A-Z}. {not in Vi} +:redi[r] @{a-z}> Append messages to register {a-z}. {not in Vi} :redi[r] @* Redirect messages to the clipboard. {not in Vi} +:redi[r] @*> Append messages to the clipboard. {not in Vi} :redi[r] @" Redirect messages to the unnamed register. {not in Vi} +:redi[r] @"> Append messages to the unnamed register. {not in Vi} :redi[r] END End redirecting messages. {not in Vi} diff --git a/runtime/doc/version7.txt b/runtime/doc/version7.txt index f2ca9674d..4865bb534 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 Jan 17 +*version7.txt* For Vim version 7.0aa. Last change: 2005 Jan 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -418,6 +418,14 @@ When a register is empty it is not stored in the viminfo file. Removed the tcltags script, it's obsolete. +":redir @*>" and ":redir @+>" append to the clipboard. Better check for +invalid characters after the register name. + +":let g:" lists global variables. +":let b:" lists buffer-local variables. +":let w:" lists window-local variables. +":let v:" lists Vim variables. + ============================================================================== COMPILE TIME CHANGES *compile-changes-7* diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 2600a1b24..8ba1744d0 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -1618,7 +1618,6 @@ ex_listdo(eap) int next_fnum = 0; #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) char_u *save_ei = NULL; - char_u *new_ei; #endif char_u *p_shm_save; @@ -1632,22 +1631,9 @@ ex_listdo(eap) #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) if (eap->cmdidx != CMD_windo) - { - /* Add "Syntax" to 'eventignore' to skip loading syntax highlighting - * for every buffer loaded into the window. A considerable speed - * improvement. */ - save_ei = vim_strsave(p_ei); - if (save_ei != NULL) - { - new_ei = vim_strnsave(p_ei, (int)STRLEN(p_ei) + 8); - if (new_ei != NULL) - { - STRCAT(new_ei, ",Syntax"); - set_string_option_direct((char_u *)"ei", -1, new_ei, OPT_FREE); - vim_free(new_ei); - } - } - } + /* Don't do syntax HL autocommands. Skipping the syntax file is a + * great speed improvement. */ + save_ei = au_event_disable(",Syntax"); #endif if (eap->cmdidx == CMD_windo @@ -1755,13 +1741,7 @@ ex_listdo(eap) } #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) - if (save_ei != NULL) - { - set_string_option_direct((char_u *)"ei", -1, save_ei, OPT_FREE); - apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn, - curbuf->b_fname, TRUE, curbuf); - vim_free(save_ei); - } + au_event_restore(save_ei); #endif } diff --git a/src/fileio.c b/src/fileio.c index accd81cf0..c888f3533 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -7132,6 +7132,48 @@ check_ei() return OK; } +# if defined(FEAT_SYN_HL) || defined(PROTO) + +/* + * Add "what" to 'eventignore' to skip loading syntax highlighting for every + * buffer loaded into the window. "what" must start with a comma. + * Returns the old value of 'eventignore' in allocated memory. + */ + char_u * +au_event_disable(what) + char *what; +{ + char_u *new_ei; + char_u *save_ei; + + save_ei = vim_strsave(p_ei); + if (save_ei != NULL) + { + new_ei = vim_strnsave(p_ei, (int)STRLEN(p_ei) + 8); + if (new_ei != NULL) + { + STRCAT(new_ei, what); + set_string_option_direct((char_u *)"ei", -1, new_ei, OPT_FREE); + vim_free(new_ei); + } + } + return save_ei; +} + + void +au_event_restore(old_ei) + char_u *old_ei; +{ + if (old_ei != NULL) + { + set_string_option_direct((char_u *)"ei", -1, old_ei, OPT_FREE); + apply_autocmds(EVENT_SYNTAX, curbuf->b_p_syn, + curbuf->b_fname, TRUE, curbuf); + vim_free(old_ei); + } +} +# endif /* FEAT_SYN_HL */ + /* * do_autocmd() -- implements the :autocmd command. Can be used in the * following ways: diff --git a/src/hashtable.c b/src/hashtable.c index 4b378aa0c..11cb469e9 100644 --- a/src/hashtable.c +++ b/src/hashtable.c @@ -73,19 +73,17 @@ hash_init(ht) ht->ht_mask = HT_INIT_SIZE - 1; } -#if 0 /* not used */ /* - * Free a hash table. Does not free the items it contains! + * Free the array of a hash table. Does not free the items it contains! + * If "ht" is not freed then you should call hash_init() next! */ void -hash_free(ht) +hash_clear(ht) hashtable *ht; { if (ht->ht_array != ht->ht_smallarray) vim_free(ht->ht_array); - vim_free(ht); } -#endif /* * Find "key" in hashtable "ht". "key" must not be NULL. @@ -228,8 +226,8 @@ hash_set(hi, key) /* * Remove item "hi" from hashtable "ht". "hi" must have been obtained with - * hash_lookup() and point to a used empty item. - * The caller must take care of freeing the item. + * hash_lookup() and point to an empty item. + * The caller must take care of freeing the item itself. */ void hash_remove(ht, hi) @@ -242,6 +240,31 @@ hash_remove(ht, hi) } /* + * Lock a hashtable: prevent that ht_array changes. + * Don't use this when items are to be added! + * Must call hash_unlock() later. + */ + void +hash_lock(ht) + hashtable *ht; +{ + ++ht->ht_locked; +} + +/* + * Unlock a hashtable: allow ht_array changes again. + * Table will be resized (shrink) when necessary. + * This must balance a call to hash_lock(). + */ + void +hash_unlock(ht) + hashtable *ht; +{ + --ht->ht_locked; + (void)hash_may_resize(ht); +} + +/* * Shrink a hashtable when there is too much empty space. * Grow a hashtable when there is not enough empty space. * Returns OK or FAIL (out of memory). @@ -260,6 +283,10 @@ hash_may_resize(ht) long_u newmask; long_u perturb; + /* Don't resize a locked table. */ + if (ht->ht_locked > 0) + return OK; + #ifdef HT_DEBUG if (ht->ht_used > ht->ht_filled) EMSG("hash_may_resize(): more used than filled"); @@ -282,7 +309,7 @@ hash_may_resize(ht) if (ht->ht_filled * 3 < oldsize * 2 && ht->ht_used > oldsize / 5) return OK; - if (ht->ht_used > 10000) + if (ht->ht_used > 1000) minsize = ht->ht_used * 2; /* it's big, don't make too much room */ else minsize = ht->ht_used * 4; /* make plenty of room */ diff --git a/src/main.c b/src/main.c index 7ab914cb5..3b888f278 100644 --- a/src/main.c +++ b/src/main.c @@ -177,6 +177,9 @@ main #ifdef FEAT_MBYTE (void)mb_init(); /* init mb_bytelen_tab[] to ones */ #endif +#ifdef FEAT_EVAL + eval_init(); /* init global variables */ +#endif #ifdef __QNXNTO__ qnx_init(); /* PhAttach() for clipboard, (and gui) */ diff --git a/src/proto/eval.pro b/src/proto/eval.pro index 64fb62a52..19d993552 100644 --- a/src/proto/eval.pro +++ b/src/proto/eval.pro @@ -1,4 +1,5 @@ /* eval.c */ +void eval_init __ARGS((void)); char_u *func_name __ARGS((void *cookie)); linenr_T *func_breakpoint __ARGS((void *cookie)); int *func_dbg_tick __ARGS((void *cookie)); @@ -41,8 +42,8 @@ char_u *v_throwpoint __ARGS((char_u *oldval)); char_u *set_cmdarg __ARGS((exarg_T *eap, char_u *oldarg)); char_u *get_var_value __ARGS((char_u *name)); void new_script_vars __ARGS((scid_T id)); -void vars_init __ARGS((garray_T *gap)); -void vars_clear __ARGS((garray_T *gap)); +void vars_init __ARGS((hashtable *ht)); +void vars_clear __ARGS((hashtable *ht)); void ex_echo __ARGS((exarg_T *eap)); void ex_echohl __ARGS((exarg_T *eap)); void ex_execute __ARGS((exarg_T *eap)); diff --git a/src/proto/fileio.pro b/src/proto/fileio.pro index c3a872c58..d7c80956c 100644 --- a/src/proto/fileio.pro +++ b/src/proto/fileio.pro @@ -23,6 +23,8 @@ void forward_slash __ARGS((char_u *fname)); void aubuflocal_remove __ARGS((buf_T *buf)); void do_augroup __ARGS((char_u *arg, int del_group)); int check_ei __ARGS((void)); +char_u *au_event_disable __ARGS((char *what)); +void au_event_restore __ARGS((char_u *old_ei)); void do_autocmd __ARGS((char_u *arg, int forceit)); int do_doautocmd __ARGS((char_u *arg, int do_msg)); void ex_doautoall __ARGS((exarg_T *eap)); diff --git a/src/proto/hashtable.pro b/src/proto/hashtable.pro index f6cb77ad9..6cc8041d9 100644 --- a/src/proto/hashtable.pro +++ b/src/proto/hashtable.pro @@ -1,6 +1,9 @@ /* hashtable.c */ void hash_init __ARGS((hashtable *ht)); +void hash_clear __ARGS((hashtable *ht)); hashitem *hash_find __ARGS((hashtable *ht, char_u *key)); int hash_add __ARGS((hashtable *ht, char_u *key)); void hash_remove __ARGS((hashtable *ht, hashitem *hi)); +void hash_lock __ARGS((hashtable *ht)); +void hash_unlock __ARGS((hashtable *ht)); /* vim: set ft=c : */ diff --git a/src/quickfix.c b/src/quickfix.c index 8bb2bbe76..0c5a050d9 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -2269,7 +2269,12 @@ ex_vimgrep(eap) int duplicate_name = FALSE; int using_dummy; int found_match; - int first_match = TRUE; + buf_T *first_match_buf = NULL; + time_t seconds = 0; +#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) + char_u *save_ei = NULL; + aco_save_T aco; +#endif /* Make 'cpoptions' empty, the 'l' flag should not be used here. */ save_cpo = p_cpo; @@ -2330,24 +2335,59 @@ ex_vimgrep(eap) goto theend; } + seconds = (time_t)0; for (fi = 0; fi < fcount && !got_int; ++fi) { + if (time(NULL) > seconds) + { + /* Display the file name every second or so. */ + seconds = time(NULL); + msg_start(); + p = msg_strtrunc(fnames[fi]); + if (p == NULL) + msg_outtrans(fnames[fi]); + else + { + msg_outtrans(p); + vim_free(p); + } + msg_clr_eos(); + msg_didout = FALSE; /* overwrite this message */ + msg_nowait = TRUE; /* don't wait for this message */ + msg_col = 0; + out_flush(); + } + buf = buflist_findname_exp(fnames[fi]); if (buf == NULL || buf->b_ml.ml_mfp == NULL) { /* Remember that a buffer with this name already exists. */ duplicate_name = (buf != NULL); + using_dummy = TRUE; + +#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) + /* Don't do Filetype autocommands to avoid loading syntax and + * indent scripts, a great speed improvement. */ + save_ei = au_event_disable(",Filetype"); +#endif /* Load file into a buffer, so that 'fileencoding' is detected, * autocommands applied, etc. */ buf = load_dummy_buffer(fnames[fi]); - using_dummy = TRUE; + +#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) + au_event_restore(save_ei); +#endif } else /* Use existing, loaded buffer. */ using_dummy = FALSE; + if (buf == NULL) - smsg((char_u *)_("Cannot open file \"%s\""), fnames[fi]); + { + if (!got_int) + smsg((char_u *)_("Cannot open file \"%s\""), fnames[fi]); + } else { found_match = FALSE; @@ -2382,10 +2422,15 @@ ex_vimgrep(eap) if (using_dummy) { + if (found_match && first_match_buf == NULL) + first_match_buf = buf; if (duplicate_name) + { /* Never keep a dummy buffer if there is another buffer * with the same name. */ wipe_dummy_buffer(buf); + buf = NULL; + } else if (!buf_hide(buf)) { /* When not hiding the buffer and no match was found we @@ -2393,13 +2438,29 @@ ex_vimgrep(eap) * there was a match and it wasn't the first one: only * unload the buffer. */ if (!found_match) + { wipe_dummy_buffer(buf); - else if (!first_match) + buf = NULL; + } + else if (buf != first_match_buf) + { unload_dummy_buffer(buf); + buf = NULL; + } + } + +#if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) + if (buf != NULL) + { + /* The buffer is still loaded, the Filetype autocommands + * need to be done now, in that buffer. */ + aucmd_prepbuf(&aco, buf); + apply_autocmds(EVENT_FILETYPE, buf->b_p_ft, + buf->b_fname, TRUE, buf); + aucmd_restbuf(&aco); } +#endif } - if (found_match) - first_match = FALSE; } } diff --git a/src/structs.h b/src/structs.h index 051eb2df0..a5e9e8d9c 100644 --- a/src/structs.h +++ b/src/structs.h @@ -910,6 +910,42 @@ struct stl_hlrec int userhl; }; +/* Item for a hashtable. "hi_key" can be one of three values: + * NULL: Never been used + * HI_KEY_REMOVED: Entry was removed + * Otherwise: Used item, pointer to the actual key; this usually is + * inside the item, subtract an offset to locate the item. + * This reduces the size of hashitem by 1/3. + */ +typedef struct hashitem_S +{ + long_u hi_hash; /* cached hash number of hi_key */ + char_u *hi_key; +} hashitem; + +/* The address of "hash_removed" is used as a magic number for hi_key to + * indicate a removed item. */ +#define HI_KEY_REMOVED &hash_removed +#define HASHITEM_EMPTY(hi) ((hi)->hi_key == NULL || (hi)->hi_key == &hash_removed) + +/* Initial size for a hashtable. Our items are relatively small and growing + * is expensive, thus use 16 as a start. Must be a power of 2. */ +#define HT_INIT_SIZE 16 + +typedef struct hashtable_S +{ + long_u ht_mask; /* mask used for hash value (nr of items in + * array is "ht_mask" + 1) */ + int ht_used; /* number of items used */ + int ht_filled; /* number of items used + removed */ + int ht_locked; /* counter for hash_lock() */ + int ht_error; /* when set growing failed, can't add more + items before growing works */ + hashitem *ht_array; /* points to the array, allocated when it's + not "ht_smallarray" */ + hashitem ht_smallarray[HT_INIT_SIZE]; /* initial array */ +} hashtable; + /* * buffer: structure that holds information about one file * @@ -1223,7 +1259,7 @@ struct file_buffer #endif #ifdef FEAT_EVAL - garray_T b_vars; /* internal variables, local to buffer */ + hashtable b_vars; /* internal variables, local to buffer */ #endif /* When a buffer is created, it starts without a swap file. b_may_swap is @@ -1567,7 +1603,7 @@ struct window #endif #ifdef FEAT_EVAL - garray_T w_vars; /* internal variables, local to window */ + hashtable w_vars; /* internal variables, local to window */ #endif #if defined(FEAT_RIGHTLEFT) && defined(FEAT_FKMAP) @@ -1929,38 +1965,3 @@ typedef struct } prt_settings_T; #define PRINT_NUMBER_WIDTH 8 - -/* Item for a hashtable. "hi_key" can be one of three values: - * NULL: Never been used - * HI_KEY_REMOVED: Entry was removed - * Otherwise: Used item, pointer to the actual key; this usually is - * inside the item, subtract an offset to locate the item. - * This reduces the size of hashitem by 1/3. - */ -typedef struct hashitem_S -{ - long_u hi_hash; /* cached hash number of hi_key */ - char_u *hi_key; -} hashitem; - -/* The address of "hash_removed" is used as a magic number for hi_key to - * indicate a removed item. */ -#define HI_KEY_REMOVED &hash_removed -#define HASHITEM_EMPTY(hi) ((hi)->hi_key == NULL || (hi)->hi_key == &hash_removed) - -/* Initial size for a hashtable. Our items are relatively small and growing - * is expensive, thus use 16 as a start. Must be a power of 2. */ -#define HT_INIT_SIZE 16 - -typedef struct hashtable_S -{ - long_u ht_mask; /* mask used for hash value (nr of items in - * array is "ht_mask" + 1) */ - int ht_used; /* number of items used */ - int ht_filled; /* number of items used + removed */ - int ht_error; /* when set growing failed, can't add more - items before growing works */ - hashitem *ht_array; /* points to the array, allocated when it's - not "ht_smallarray" */ - hashitem ht_smallarray[HT_INIT_SIZE]; /* initial array */ -} hashtable; diff --git a/src/testdir/test55.in b/src/testdir/test55.in index a757dae12..2fa26bf90 100644 --- a/src/testdir/test55.in +++ b/src/testdir/test55.in @@ -76,20 +76,20 @@ STARTTEST :unlet d[-1] :$put =string(d) :" -:" manipulating a big Dictionary +:" manipulating a big Dictionary (hashtable.c has a border of 1000 entries) :let d = {} -:for i in range(15000) -: let d[i] = 30000 - i +:for i in range(1500) +: let d[i] = 3000 - i :endfor -:$put =d[0] . ' ' . d[100] . ' ' . d[999] . ' ' . d[14000] . ' ' . d[14999] +:$put =d[0] . ' ' . d[100] . ' ' . d[999] . ' ' . d[1400] . ' ' . d[1499] :try -: let n = d[15000] +: let n = d[1500] :catch -: $put =v:exception[:14] . v:exception[-5:-1] +: $put =v:exception[:14] . v:exception[-4:-1] :endtry :" lookup each items -:for i in range(15000) -: if d[i] != 30000 - i +:for i in range(1500) +: if d[i] != 3000 - i : $put =d[i] : endif :endfor @@ -99,12 +99,12 @@ STARTTEST : let i -= 2 : unlet d[i] :endwhile -:$put =get(d, 15000 - 100, 'NONE') . ' ' . d[1] +:$put =get(d, 1500 - 100, 'NONE') . ' ' . d[1] :" delete odd items, checking value, one intentionally wrong :let d[33] = 999 :let i = 1 -:while i < 15000 -: if d[i] != 30000 - i +:while i < 1500 +: if d[i] != 3000 - i : $put =i . '=' . d[i] : else : unlet d[i] @@ -121,14 +121,22 @@ STARTTEST :endfunc :let dict.data = [1,2,3] :call dict.func("len: ") -:echo dict.func("again: ") +:let x = dict.func("again: ") :try : let Fn = dict.func : call Fn('xxx') :catch : $put =v:exception[:15] :endtry -:sleep 5 +:" +:" Function in script-local List or Dict +:let g:dict = {} +:function g:dict.func() dict +: $put ='g:dict.func'.self.foo[1].self.foo[0]('asdf') +:endfunc +:let g:dict.foo = ['-', 2, 3] +:call insert(g:dict.foo, function('strlen')) +:call g:dict.func() :" :" Nasty: remove func from Dict that's being called (works) :let d = {1:1} @@ -148,7 +156,7 @@ STARTTEST :endtry :" :endfun -:call Test() +:call Test() " This may take a while :" :/^start:/,$wq! test.out ENDTEST diff --git a/src/testdir/test55.ok b/src/testdir/test55.ok index 407b7a1b5..868b116fb 100644 --- a/src/testdir/test55.ok +++ b/src/testdir/test55.ok @@ -19,13 +19,14 @@ Vim(let):E706: l [1, 'as''d', {'a': 1}] [4] {'1': 99, '3': 33} -30000 29900 29001 16000 15001 -Vim(let):E716: 15000 -NONE 29999 +3000 2900 2001 1600 1501 +Vim(let):E716: 1500 +NONE 2999 33=999 {'33': 999} len: 3 again: 3 Vim(call):E725: -a:function('2') +g:dict.func-4 +a:function('3') Vim(let):E698: diff --git a/src/version.h b/src/version.h index 18f33b7d4..8b531751d 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 (2004 Jan 19)" -#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2004 Jan 19, compiled " +#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2004 Jan 20)" +#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2004 Jan 20, compiled " |