diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-01-25 22:18:08 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-01-25 22:18:08 +0000 |
commit | 7df2d6629f7cfb05e33a1e27cd7fda943afbbba9 (patch) | |
tree | 06b43379638af7a02741262c8d236b2a43b44916 /src | |
parent | dad6b69c00a16f06624aeca1353a7aa53f631893 (diff) | |
download | vim-7df2d6629f7cfb05e33a1e27cd7fda943afbbba9.zip |
updated for version 7.0044
Diffstat (limited to 'src')
-rw-r--r-- | src/hashtable.c | 77 | ||||
-rw-r--r-- | src/if_python.c | 10 | ||||
-rw-r--r-- | src/if_tcl.c | 22 | ||||
-rw-r--r-- | src/misc1.c | 8 | ||||
-rw-r--r-- | src/proto/hashtable.pro | 17 |
5 files changed, 72 insertions, 62 deletions
diff --git a/src/hashtable.c b/src/hashtable.c index 11cb469e9..1dea06790 100644 --- a/src/hashtable.c +++ b/src/hashtable.c @@ -38,22 +38,19 @@ /* Magic value for algorithm that walks through the array. */ #define PERTURB_SHIFT 5 -static hashitem *hash_lookup __ARGS((hashtable *ht, char_u *key, long_u hash)); -static int hash_add_item __ARGS((hashtable *ht, hashitem *hi, char_u *key, long_u hash)); -static int hash_may_resize __ARGS((hashtable *ht)); -static long_u hash_hash __ARGS((char_u *key)); +static int hash_may_resize __ARGS((hashtab_T *ht)); #if 0 /* not used */ /* * Create an empty hash table. * Returns NULL when out of memory. */ - hashtable * + hashtab_T * hash_create() { - hashtable *ht; + hashtab_T *ht; - ht = (hashtable *)alloc(sizeof(hashtable)); + ht = (hashtab_T *)alloc(sizeof(hashtab_T)); if (ht != NULL) hash_init(ht); return ht; @@ -65,10 +62,10 @@ hash_create() */ void hash_init(ht) - hashtable *ht; + hashtab_T *ht; { /* This zeroes all "ht_" entries and all the "hi_key" in "ht_smallarray". */ - vim_memset(ht, 0, sizeof(hashtable)); + vim_memset(ht, 0, sizeof(hashtab_T)); ht->ht_array = ht->ht_smallarray; ht->ht_mask = HT_INIT_SIZE - 1; } @@ -79,7 +76,7 @@ hash_init(ht) */ void hash_clear(ht) - hashtable *ht; + hashtab_T *ht; { if (ht->ht_array != ht->ht_smallarray) vim_free(ht->ht_array); @@ -93,9 +90,9 @@ hash_clear(ht) * WARNING: The returned pointer becomes invalid when the hashtable is changed * (adding, setting or removing an item)! */ - hashitem * + hashitem_T * hash_find(ht, key) - hashtable *ht; + hashtab_T *ht; char_u *key; { return hash_lookup(ht, key, hash_hash(key)); @@ -104,15 +101,15 @@ hash_find(ht, key) /* * Like hash_find(), but caller computes "hash". */ - static hashitem * + hashitem_T * hash_lookup(ht, key, hash) - hashtable *ht; + hashtab_T *ht; char_u *key; - long_u hash; + hash_T hash; { - long_u perturb; - hashitem *freeitem; - hashitem *hi; + hash_T perturb; + hashitem_T *freeitem; + hashitem_T *hi; int idx; /* @@ -163,11 +160,11 @@ hash_lookup(ht, key, hash) */ int hash_add(ht, key) - hashtable *ht; + hashtab_T *ht; char_u *key; { - long_u hash = hash_hash(key); - hashitem *hi; + hash_T hash = hash_hash(key); + hashitem_T *hi; hi = hash_lookup(ht, key, hash); if (!HASHITEM_EMPTY(hi)) @@ -184,12 +181,12 @@ hash_add(ht, key) * "hi" is invalid after this! * Returns OK or FAIL (out of memory). */ - static int + int hash_add_item(ht, hi, key, hash) - hashtable *ht; - hashitem *hi; + hashtab_T *ht; + hashitem_T *hi; char_u *key; - long_u hash; + hash_T hash; { /* If resizing failed before and it fails again we can't add an item. */ if (ht->ht_error && hash_may_resize(ht) == FAIL) @@ -217,7 +214,7 @@ hash_add_item(ht, hi, key, hash) */ void hash_set(hi, key) - hashitem *hi; + hashitem_T *hi; char_u *key; { hi->hi_key = key; @@ -231,8 +228,8 @@ hash_set(hi, key) */ void hash_remove(ht, hi) - hashtable *ht; - hashitem *hi; + hashtab_T *ht; + hashitem_T *hi; { --ht->ht_used; hi->hi_key = HI_KEY_REMOVED; @@ -246,7 +243,7 @@ hash_remove(ht, hi) */ void hash_lock(ht) - hashtable *ht; + hashtab_T *ht; { ++ht->ht_locked; } @@ -258,7 +255,7 @@ hash_lock(ht) */ void hash_unlock(ht) - hashtable *ht; + hashtab_T *ht; { --ht->ht_locked; (void)hash_may_resize(ht); @@ -271,17 +268,17 @@ hash_unlock(ht) */ static int hash_may_resize(ht) - hashtable *ht; + hashtab_T *ht; { - hashitem temparray[HT_INIT_SIZE]; - hashitem *oldarray, *newarray; - hashitem *olditem, *newitem; + hashitem_T temparray[HT_INIT_SIZE]; + hashitem_T *oldarray, *newarray; + hashitem_T *olditem, *newitem; int newi; int todo; long_u oldsize, newsize; long_u minsize; long_u newmask; - long_u perturb; + hash_T perturb; /* Don't resize a locked table. */ if (ht->ht_locked > 0) @@ -339,7 +336,7 @@ hash_may_resize(ht) else { /* Allocate an array. */ - newarray = (hashitem *)alloc((unsigned)(sizeof(hashitem) * newsize)); + newarray = (hashitem_T *)alloc((unsigned)(sizeof(hashitem_T) * newsize)); if (newarray == NULL) { /* Out of memory. When there are NULL items still return OK. @@ -352,7 +349,7 @@ hash_may_resize(ht) } oldarray = ht->ht_array; } - vim_memset(newarray, 0, (size_t)(sizeof(hashitem) * newsize)); + vim_memset(newarray, 0, (size_t)(sizeof(hashitem_T) * newsize)); /* * Move all the items from the old array to the new one, placing them in @@ -398,12 +395,12 @@ hash_may_resize(ht) * Get the hash number for a key. Uses the ElfHash algorithm, which is * supposed to have an even distribution (suggested by Charles Campbell). */ - static long_u + hash_T hash_hash(key) char_u *key; { - long_u hash = 0; - long_u g; + hash_T hash = 0; + hash_T g; char_u *p = key; while (*p != NUL) diff --git a/src/if_python.c b/src/if_python.c index 511378a0d..04a8d179a 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -891,8 +891,8 @@ PythonIO_Init(void) /* Fixups... */ OutputType.ob_type = &PyType_Type; - PySys_SetObject("stdout", (PyObject *)(&Output)); - PySys_SetObject("stderr", (PyObject *)(&Error)); + PySys_SetObject("stdout", (PyObject *)(void *)&Output); + PySys_SetObject("stderr", (PyObject *)(void *)&Error); if (PyErr_Occurred()) { @@ -2190,9 +2190,9 @@ PythonMod_Init(void) VimError = Py_BuildValue("s", "vim.error"); PyDict_SetItemString(dict, "error", VimError); - PyDict_SetItemString(dict, "buffers", (PyObject *)(&TheBufferList)); - PyDict_SetItemString(dict, "current", (PyObject *)(&TheCurrent)); - PyDict_SetItemString(dict, "windows", (PyObject *)(&TheWindowList)); + PyDict_SetItemString(dict, "buffers", (PyObject *)(void *)&TheBufferList); + PyDict_SetItemString(dict, "current", (PyObject *)(void *)&TheCurrent); + PyDict_SetItemString(dict, "windows", (PyObject *)(void *)&TheWindowList); if (PyErr_Occurred()) return -1; diff --git a/src/if_tcl.c b/src/if_tcl.c index 61b1fb9da..3c08325a2 100644 --- a/src/if_tcl.c +++ b/src/if_tcl.c @@ -106,6 +106,11 @@ static tcl_info tclinfo = { NULL, 0, 0, 0, NULL, NULL }; #define VIMOUT ((ClientData)1) #define VIMERR ((ClientData)2) +/* This appears to be new in Tcl 8.4. */ +#ifndef CONST84 +# define CONST84 +#endif + /* * List of Tcl interpreters who reference a vim window or buffer. * Each buffer and window has it's own list in the tcl_ref struct member. @@ -384,9 +389,8 @@ buffercmd(dummy, interp, objc, objv) buf_T *buf; Tcl_Obj *resobj; int err, n, idx; - enum {BCMD_EXISTS, BCMD_LIST}; - static char *bcmdoptions[] = + static CONST84 char *bcmdoptions[] = { "exists", "list", (char *)0 }; @@ -533,7 +537,7 @@ bufselfcmd(ref, interp, objc, objv) BUF_GET, BUF_INSERT, BUF_LAST, BUF_MARK, BUF_NAME, BUF_NUMBER, BUF_OPTION, BUF_SET, BUF_WINDOWS }; - static char *bufoptions[] = + static CONST84 char *bufoptions[] = { "append", "command", "count", "delcmd", "delete", "expr", "get", "insert", "last", "mark", "name", "number", @@ -966,7 +970,7 @@ winselfcmd(ref, interp, objc, objv) WIN_BUFFER, WIN_COMMAND, WIN_CURSOR, WIN_DELCMD, WIN_EXPR, WIN_HEIGHT, WIN_OPTION }; - static char *winoptions[] = + static CONST84 char *winoptions[] = { "buffer", "command", "cursor", "delcmd", "expr", "height", "option", (char *)0 @@ -1179,7 +1183,7 @@ tclgetlinenum(interp, obj, valueP, buf) enum { LN_BEGIN, LN_BOTTOM, LN_END, LN_FIRST, LN_LAST, LN_START, LN_TOP }; - static char *keyw[] = + static CONST84 char *keyw[] = { "begin", "bottom", "end", "first", "last", "start", "top", (char *)0 }; @@ -1311,7 +1315,7 @@ tclsetoption(interp, objc, objv, objn) Tcl_Obj *resobj; enum { OPT_OFF, OPT_ON, OPT_TOGGLE }; - static char *optkw[] = { "off", "on", "toggle", (char *)0 }; + static CONST84 char *optkw[] = { "off", "on", "toggle", (char *)0 }; nobjs = objc - objn; if (nobjs != 1 && nobjs != 2) @@ -1905,7 +1909,7 @@ tclexit(error) { char *result; - result = Tcl_GetStringResult(tclinfo.interp); + result = (char *)Tcl_GetStringResult(tclinfo.interp); if (error == TCL_OK) { tclmsg(result); @@ -2013,7 +2017,7 @@ ex_tcldo(eap) err = Tcl_Eval(tclinfo.interp, script); if (err != TCL_OK) break; - line = Tcl_GetVar(tclinfo.interp, var_line, 0); + line = (char *)Tcl_GetVar(tclinfo.interp, var_line, 0); if (line) { if (ml_replace((linenr_T)rs, (char_u *)line, TRUE) != OK) @@ -2059,7 +2063,7 @@ tcldelallrefs(ref) err = Tcl_GlobalEvalObj(ref->interp, ref->delcmd); if (err != TCL_OK) { - result = Tcl_GetStringResult(ref->interp); + result = (char *)Tcl_GetStringResult(ref->interp); if (result) tclerrmsg(result); } diff --git a/src/misc1.c b/src/misc1.c index 4c2b55e91..4d7cf6028 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -3092,10 +3092,15 @@ msgmore(n) long pn; if (global_busy /* no messages now, wait until global is finished */ - || keep_msg != NULL /* there is a message already, skip this one */ || !messaging()) /* 'lazyredraw' set, don't do messages now */ return; + /* We don't want to overwrite another important message, but do overwrite + * a previous "more lines" or "fewer lines" message, so that "5dd" and + * then "put" reports the last action. */ + if (keep_msg != NULL && !keep_msg_more) + return; + if (n > 0) pn = n; else @@ -3123,6 +3128,7 @@ msgmore(n) { set_keep_msg(msg_buf); keep_msg_attr = 0; + keep_msg_more = TRUE; } } } diff --git a/src/proto/hashtable.pro b/src/proto/hashtable.pro index 6cc8041d9..cc4164796 100644 --- a/src/proto/hashtable.pro +++ b/src/proto/hashtable.pro @@ -1,9 +1,12 @@ /* 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)); +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)); +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)); +void hash_lock __ARGS((hashtab_T *ht)); +void hash_unlock __ARGS((hashtab_T *ht)); +hash_T hash_hash __ARGS((char_u *key)); /* vim: set ft=c : */ |