Permalink
Browse files

updated for version 7.0084

  • Loading branch information...
1 parent ca1096e commit 00f9950fcc7609adf254e9902e784fb0061c9135 vimboss committed Jun 13, 2005
View
4 runtime/bugreport.vim
@@ -2,7 +2,7 @@
:" information about the environment of a possible bug in Vim.
:"
:" Maintainer: Bram Moolenaar <Bram@vim.org>
-:" Last change: 2001 Feb 02
+:" Last change: 2005 Jun 12
:"
:" To use inside Vim:
:" :so $VIMRUNTIME/bugreport.vim
@@ -49,6 +49,8 @@
: call <SID>CheckFile($VIMRUNTIME . "/syntax/synload.vim")
: delfun <SID>CheckDir
: delfun <SID>CheckFile
+: echo "--- Scripts sourced ---"
+: scriptnames
:endif
:set all
:set termcap
View
10 runtime/doc/develop.txt
@@ -1,4 +1,4 @@
-*develop.txt* For Vim version 7.0aa. Last change: 2005 Jun 04
+*develop.txt* For Vim version 7.0aa. Last change: 2005 Jun 13
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -375,8 +375,10 @@ checking engine in Vim, for various reasons:
- Missing support for multi-byte encodings. At least UTF-8 must be supported,
so that more than one language can be used in the same file.
+ Doing on-the-fly conversion is not always possible (would require iconv
+ support).
- For the programs and libraries: Using them as-is would require installing
- them separately from Vim. That's not impossible, but a drawback.
+ them separately from Vim. That's mostly not impossible, but a drawback.
- Performance: A few tests showed that it's possible to check spelling on the
fly (while redrawing), just like syntax highlighting. But the mechanisms
used by other code are much slower. Myspell uses a simplistic hashtable,
@@ -392,7 +394,9 @@ checking engine in Vim, for various reasons:
all English words and highlight non-Canadian words differently.
- Missing support for rare words. Many words are correct but hardly ever used
and could be a misspelled often-used word.
-
+- For making suggestions the speed is less important and requiring to install
+ another program or library would be acceptable. But the word lists probably
+ differ, the suggestions may be wrong words.
==============================================================================
4. Assumptions *design-assumptions*
View
20 runtime/doc/eval.txt
@@ -1,4 +1,4 @@
-*eval.txt* For Vim version 7.0aa. Last change: 2005 Jun 07
+*eval.txt* For Vim version 7.0aa. Last change: 2005 Jun 11
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -235,6 +235,18 @@ the same value. >
:echo alist == blist
< 1
+Note about comparing lists: Two lists are considered equal if they have the
+same length and all items compare equal, as with using "==". There is one
+exception: When comparing a number with a string and the string contains extra
+characters beside the number they are not equal. Example: >
+ echo 4 == "4x"
+< 1 >
+ echo [4] == ["4x"]
+< 0
+
+This is to fix the odd behavior of == that can't be changed for backward
+compatibility reasons.
+
List unpack ~
@@ -2593,7 +2605,8 @@ getwinposy() The result is a Number, which is the Y coordinate in pixels of
getwinvar({nr}, {varname}) *getwinvar()*
The result is the value of option or local window variable
- {varname} in window {nr}.
+ {varname} in window {nr}. When {nr} is zero the current
+ window is used.
This also works for a global option, buffer-local option and
window-local option, but it doesn't work for a global variable
or buffer-local variable.
@@ -3692,7 +3705,7 @@ setreg({regname}, {value} [,{options}])
setwinvar({nr}, {varname}, {val}) *setwinvar()*
Set option or local variable {varname} in window {nr} to
- {val}.
+ {val}. When {nr} is zero the current window is used.
This also works for a global or local buffer option, but it
doesn't work for a global or local buffer variable.
For a local buffer option the global value is unchanged.
@@ -3804,6 +3817,7 @@ string({expr}) Return {expr} converted to a String. If {expr} is a Number,
Number 123
Funcref function('name')
List [item, item]
+ Dictionary {key: value, key: value}
Note that in String values the ' character is doubled.
*strlen()*
View
4 runtime/doc/intro.txt
@@ -1,4 +1,4 @@
-*intro.txt* For Vim version 7.0aa. Last change: 2005 Mar 29
+*intro.txt* For Vim version 7.0aa. Last change: 2005 Jun 12
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -198,7 +198,7 @@ The user may create scripts for Vim that use external commands. These might
introduce Y2K problems, but those are not really part of Vim itself.
==============================================================================
-3. Credits *credits* *author*
+3. Credits *credits* *author* *Bram* *Moolenaar*
Most of Vim was written by Bram Moolenaar <Bram@vim.org>.
View
75 runtime/doc/spell.txt
@@ -1,4 +1,4 @@
-*spell.txt* For Vim version 7.0aa. Last change: 2005 Jun 08
+*spell.txt* For Vim version 7.0aa. Last change: 2005 Jun 13
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -51,7 +51,7 @@ To search for the next misspelled word:
[S Like "]S" but search backwards.
-To add words to your own word list:
+To add words to your own word list: *E764*
*zg*
zg Add word under the cursor as a good word to
@@ -73,6 +73,21 @@ automatically be updated. More details about the 'spellfile' format below
|spell-wordlist-format|.
+Finding suggestions for bad words:
+
+ *z?*
+z? For the badly spelled word under the cursor suggest
+ the correctly spelled word.
+ When there is no badly spelled word under the cursor
+ use the one after the cursor, in the same line.
+ The results are sorted on similarity to the badly
+ spelled word.
+ This may take a long time. Hit CTRL-C when you are
+ bored.
+ You can enter the number of your choice or press
+ <Enter> if you don't want to replace.
+
+
PERFORMANCE
Note that Vim does on-the-fly spell checking. To make this work fast the
@@ -170,6 +185,10 @@ Vim uses a fixed method to recognize a word. This is independent of
include characters like '-' in 'iskeyword'. The word characters do depend on
'encoding'.
+The table with word characters is stored in the main .spl file. Therefore it
+matters what the current locale is when generating it! A .add.spl file does
+not contain a word table.
+
A word that starts with a digit is always ignored. That includes hex numbers
in the form 0xff and 0XFF.
@@ -224,6 +243,9 @@ You can also use a plain word list.
< This combines the English word lists for US, CA and AU
into one en.spl file.
Up to eight regions can be combined. *E754* *755*
+ The REP and SAL items of the first .aff file where
+ they appear are used. |spell-affix-REP|
+ |spell-affix-SAL|
When the spell file was written all currently used
spell files will be reloaded.
@@ -452,4 +474,53 @@ words that are correct for the language, but are hardly ever used and could be
a typing mistake anyway.
+REPLACEMENTS *spell-affix-REP*
+
+In the affix file REP items can be used to define common mistakes. This is
+used to make spelling suggestions. The items define the "from" text and the
+"to" replacement. Example:
+
+ REP 4 ~
+ REP f ph ~
+ REP ph f ~
+ REP k ch ~
+ REP ch k ~
+
+The first line specifies the number of REP lines following. Vim ignores it.
+
+
+SIMILAR CHARACTERS *spell-affix-MAP*
+
+In the affix file MAP items can be used to define letters that very much
+alike. This is mostly used for a letter with different accents. This is used
+to prefer suggestions with these letters substituted. Example:
+
+ MAP 2 ~
+ MAP e���� ~
+ MAP u���� ~
+
+The first line specifies the number of MAP lines following. Vim ignores it.
+
+
+SOUNDS-A-LIKE *spell-affix-SAL*
+
+In the affix file SAL items can be used to define the sounds-a-like mechanism
+to be used. The main items define the "from" text and the "to" replacement.
+Example:
+
+ SAL CIA X ~
+ SAL CH X ~
+ SAL C K ~
+ SAL K K ~
+
+TODO: explain how it works.
+
+There are a few special items:
+
+ SAL followup true ~
+ SAL collapse_result true ~
+ SAL remove_accents true ~
+
+"1" has the same meaning as "true". Any other value means "false".
+
vim:tw=78:sw=4:ts=8:ft=help:norl:
View
7 runtime/doc/tags
@@ -2835,6 +2835,7 @@ Athena gui_x11.txt /*Athena*
B motion.txt /*B*
BeBox os_beos.txt /*BeBox*
BeOS os_beos.txt /*BeOS*
+Bram intro.txt /*Bram*
BufAdd autocmd.txt /*BufAdd*
BufCreate autocmd.txt /*BufCreate*
BufDelete autocmd.txt /*BufDelete*
@@ -3805,6 +3806,7 @@ Mac-format-write editing.txt /*Mac-format-write*
Macintosh os_mac.txt /*Macintosh*
Mark motion.txt /*Mark*
MiNT os_mint.txt /*MiNT*
+Moolenaar intro.txt /*Moolenaar*
MorphOS os_amiga.txt /*MorphOS*
Motif gui_x11.txt /*Motif*
MzScheme if_mzsch.txt /*MzScheme*
@@ -5125,6 +5127,7 @@ 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*
@@ -6250,9 +6253,12 @@ speed-up tips.txt /*speed-up*
spell spell.txt /*spell*
spell-affix-KEP spell.txt /*spell-affix-KEP*
spell-affix-RAR spell.txt /*spell-affix-RAR*
+spell-affix-REP spell.txt /*spell-affix-REP*
+spell-affix-SAL spell.txt /*spell-affix-SAL*
spell-affix-chars spell.txt /*spell-affix-chars*
spell-affix-mbyte spell.txt /*spell-affix-mbyte*
spell-affix-vim spell.txt /*spell-affix-vim*
+spell-dic-format spell.txt /*spell-dic-format*
spell-file-format spell.txt /*spell-file-format*
spell-mkspell spell.txt /*spell-mkspell*
spell-quickstart spell.txt /*spell-quickstart*
@@ -7070,6 +7076,7 @@ z/OS os_390.txt /*z\/OS*
z<CR> scroll.txt /*z<CR>*
z<Left> scroll.txt /*z<Left>*
z<Right> scroll.txt /*z<Right>*
+z? spell.txt /*z?*
zA fold.txt /*zA*
zC fold.txt /*zC*
zD fold.txt /*zD*
View
47 runtime/doc/todo.txt
@@ -1,4 +1,4 @@
-*todo.txt* For Vim version 7.0aa. Last change: 2005 Jun 08
+*todo.txt* For Vim version 7.0aa. Last change: 2005 Jun 13
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -30,7 +30,15 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
*known-bugs*
-------------------- Known bugs and current work -----------------------
-New menu file doesn't work with older vim. exists("spell") doesn't work?
+Range(0) should return an empty list (Servatius Brandt).
+
+a few builtin functions call set_var() internally to set a variable. They do
+not check for a valid variable name. Example: setbufvar(1, ";", 1) sets a
+variable named ";". (Servatius Brandt)
+
+Patch for if_python to make exit work better with threads. (ugo)
+Still seems to fail 15% of the time.
+Vim 7 breaks, works OK with 6.3 version of if_python (Thakkar)
Add extra list of file locations. Can be used with:
:ltag list of matching tags, like :tselect
@@ -86,18 +94,25 @@ Awaiting response:
- Win32: tearoff menu window should have a scrollbar when it's taller than
the screen.
-Patch for if_python to make exit work better with threads. (ugo)
-Still seems to fail 15% of the time.
PLANNED FOR VERSION 7.0:
- Add SPELLCHECKER, with support for many languages.
- Spell checking code todo's:
- - How about making suggestions? Use an external program like aspell?
- Or include the myspell suggestion code in Vim?
- - Support for approximate-regexps will help with finding similar words
- (agrep http://www.tgries.de/agrep/).
+ - Code for making suggestions:
+ - Also need to store "toupper" in the .spl file.
+ - Give better score for words that sound like the bad word?
+ - "sounds-like" matching: Also try variants of the soundslike word.
+ - Aspell has the "special" character, useful?
+ - Support for approximate-regexps will help with finding similar
+ words (agrep http://www.tgries.de/agrep/).
+ - Give a warning for ":mkspell it_IT wordfile", thus using a region
+ name with only one input file.
+ - Also put list of word characters in word list file. Otherwise the
+ one for Italian may differ from the one used for English.
+ - Somehow mark "frequent" words, so that suggestions with "a" and
+ "the" can be preferred?
- Make "en-rare" spell file.
Convention: use en_US (language_region) and en-rare (language-field)
Add hl groups to 'spelllang'?
@@ -130,7 +145,8 @@ PLANNED FOR VERSION 7.0:
Later:
- Implement compound words when it works for Myspell. Current idea has
the problem that "foo/X" always allows "foofoo", there is no way to
- specify a word can only be at the start or end.
+ specify a word can only be at the start or end, or that only certain
+ words combine.
- REFACTORING: The main() function is very long. Move parts to separate
functions, especially loops. Ideas from Walter Briscoe (2003 Apr 3, 2004
@@ -266,7 +282,7 @@ on MS-Windows. (George Reilly)
Add strtol() to avoid the problems with leading zero causing octal conversion.
Try new POSIX tests, made after my comments. (Geoff Clare, 2005 April 7)
-Before April 23 if possible.
+Version 1.5 is in ~/src/posix/1.5. (Lynne Canal)
Add a 'tool' window: behaves like a preview window but there can be several.
Don't count it in only_one_window(). (Alexei Alexandrov)
@@ -2342,6 +2358,9 @@ Insert mode:
'cindent', 'smartindent':
+8 Wrong indent below ? : with ():
+ if ((a ? (b) : c) != 0)
+ aligns with ":".
8 Wrong indent for ":" after a method with line break in arguments:
Foo::Foo (int one,
int two)
@@ -2927,12 +2946,8 @@ Options:
8 When using ":mksession", also store a command to reset all options to
their default value, before setting the options that are not at their
default value.
-8 Should ":mksession" restore the current directory when writing the
- session, or the directory where the session file is? Probably need a word
- in 'sessionoptions' to make a choice:
- "curdir" (cd to current directory when session file was generated)
- "sessiondir" (cd to directory of session file)
- "nodir" (don't cd at all)
+7 With ":mksession" also store the tag stack and jump history. (Michal
+ Malecki)
8 Make "old" number options that really give a number of effects into string
options that are a comma separated list. The old number values should
also be supported.
View
4 runtime/doc/usr_11.txt
@@ -1,4 +1,4 @@
-*usr_11.txt* For Vim version 7.0aa. Last change: 2005 Apr 01
+*usr_11.txt* For Vim version 7.0aa. Last change: 2005 Jun 09
VIM USER MANUAL - by Bram Moolenaar
@@ -34,7 +34,7 @@ messages (with different file names, of course):
Using swap file ".help.txt.swp" ~
Original file "~/vim/runtime/doc/help.txt" ~
- Recovery completed. You should check if everything is OK. ~
+ Recovery completed. You should check if everything is OK. ~
(You might want to write out this file under another name ~
and run diff with the original file to check for changes) ~
Delete the .swp file afterwards. ~
View
14 runtime/doc/usr_41.txt
@@ -1,4 +1,4 @@
-*usr_41.txt* For Vim version 7.0aa. Last change: 2005 May 18
+*usr_41.txt* For Vim version 7.0aa. Last change: 2005 Jun 09
VIM USER MANUAL - by Bram Moolenaar
@@ -612,13 +612,13 @@ List manipulation:
join() join List items into a String
string() String representation of a List
call() call a function with List as arguments
- index() index of a value in a list
+ index() index of a value in a List
max() maximum value in a List
min() minimum value in a List
count() count number of times a value appears in a List
Dictionary manipulation:
- get() get an entries without error for wrong key
+ get() get an entry without an error for a wrong key
len() number of entries in a Dictionary
has_key() check whether a key appears in a Dictionary
empty() check if Dictionary is empty
@@ -1117,7 +1117,7 @@ over them: >
one ~
two ~
-The will notice the items are not ordered. You can sort the list to get a
+The will notice the keys are not ordered. You can sort the list to get a
specific order: >
:for key in sort(keys(uk2nl))
@@ -2237,8 +2237,8 @@ That script must define the "mylib#myfunction()" function.
You can put many other functions in the mylib.vim script, you are free to
organize your functions in library scripts. But you must use function names
-where the part before the colon matches the script name. Otherwise Vim
-would not know what script to load.
+where the part before the '#' matches the script name. Otherwise Vim would
+not know what script to load.
If you get really enthousiastic and write lots of library scripts, you may
want to use subdirectories. Example: >
@@ -2256,7 +2256,7 @@ Where the function is defined like this: >
endfunction
Notice that the name the function is defined with is exactly the same as the
-name used for calling the function. And the part before the last colon
+name used for calling the function. And the part before the last '#'
exactly matches the subdirectory and script name.
You can use the same mechanism for variables: >
View
11 runtime/doc/version7.txt
@@ -1,4 +1,4 @@
-*version7.txt* For Vim version 7.0aa. Last change: 2005 Jun 07
+*version7.txt* For Vim version 7.0aa. Last change: 2005 Jun 13
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -144,6 +144,11 @@ with scripts, but they were slow and/or required an external program.
The 'spell' option is used to switch spell checking on or off.
The 'spelllang' option is used to specify the languages that are accepted.
+The 'spellfile' option specifies where new words are added.
+
+The |[s| and |]s| commands can be used to move to the next or previous error.
+The |zg| and |zw| commands can be used to add good and wrong words.
+The |z?| command can be used to correct the word.
The "undercurl" highlighting attribute was added to nicely point out spelling
mistakes in the GUI (based on patch from Marcin Dalecki).
@@ -649,6 +654,9 @@ Added the "%s" item to 'errorformat'. (Yegappan Lakshmanan)
GTK GUI: use the GTK file dialog when it's available. Mix from patches by
Grahame Bowland and Evan Webb.
+Added ":scriptnames" to bugreport.vim, so that we can see what plugins were
+used.
+
==============================================================================
COMPILE TIME CHANGES *compile-changes-7*
@@ -1074,6 +1082,7 @@ 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)
+This breaks the thread stuff though, fixed by Ugo.
GTK GUI: using a .vimrc with "set cmdheight=2 lines=43" and ":split" right
after startup, the window layout is messed up. (Michael Schaap) Added
View
8 runtime/indent/lua.vim
@@ -2,7 +2,13 @@
" Language: Lua script
" Maintainer: Marcus Aurelius Farias <marcus.cf 'at' bol.com.br>
" First Author: Max Ischenko <mfi 'at' ukr.net>
-" Last Change: 2004 Aug 29
+" Last Change: 2005 Jun 09
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+let b:did_indent = 1
" Only define the function once.
if exists("*GetLuaIndent")
View
70 runtime/indent/mupad.vim
@@ -1,35 +1,35 @@
-" Vim indent file
-" Language: MuPAD source files
-" Maintainer: Dave Silvia <dsilvia@mchsi.com>
-" Filenames: *.mu
-" Date: 6/30/2004
-
-if exists("b:did_indent")
- finish
-endif
-
-let b:did_indent = 1
-
-runtime indent/GenericIndent.vim
-
-let b:indentStmts=''
-let b:dedentStmts=''
-let b:allStmts=''
-" NOTE: b:indentStmts, b:dedentStmts, and b:allStmts need to be initialized
-" to '' before callin the functions because 'indent.vim' explicitly
-" 'unlet's b:did_indent. This means that the lists will compound if
-" you change back and forth between buffers. This is true as of
-" version 6.3, 6/23/2004.
-setlocal indentexpr=GenericIndent()
-setlocal indentkeys==end_proc,=then,=else,=elif,=end_if,=end_case,=until,=end_repeat,=end_domain,=end_for,=end_while,=end,o,O
-
-call GenericIndentStmts('begin,if,then,else,elif,case,repeat,until,domain,do')
-call GenericDedentStmts('end_proc,then,else,elif,end_if,end_case,until,end_repeat,end_domain,end_for,end_while,end')
-call GenericAllStmts()
-
-
-" TODO: More comprehensive indentstmt, dedentstmt, and indentkeys values.
-"
-" BUGS: You tell me! Probably. I just haven't found one yet or haven't been
-" told about one.
-"
+" Vim indent file
+" Language: MuPAD source files
+" Maintainer: Dave Silvia <dsilvia@mchsi.com>
+" Filenames: *.mu
+" Date: 6/30/2004
+
+if exists("b:did_indent")
+ finish
+endif
+
+let b:did_indent = 1
+
+runtime indent/GenericIndent.vim
+
+let b:indentStmts=''
+let b:dedentStmts=''
+let b:allStmts=''
+" NOTE: b:indentStmts, b:dedentStmts, and b:allStmts need to be initialized
+" to '' before callin the functions because 'indent.vim' explicitly
+" 'unlet's b:did_indent. This means that the lists will compound if
+" you change back and forth between buffers. This is true as of
+" version 6.3, 6/23/2004.
+setlocal indentexpr=GenericIndent()
+setlocal indentkeys==end_proc,=then,=else,=elif,=end_if,=end_case,=until,=end_repeat,=end_domain,=end_for,=end_while,=end,o,O
+
+call GenericIndentStmts('begin,if,then,else,elif,case,repeat,until,domain,do')
+call GenericDedentStmts('end_proc,then,else,elif,end_if,end_case,until,end_repeat,end_domain,end_for,end_while,end')
+call GenericAllStmts()
+
+
+" TODO: More comprehensive indentstmt, dedentstmt, and indentkeys values.
+"
+" BUGS: You tell me! Probably. I just haven't found one yet or haven't been
+" told about one.
+"
View
13 runtime/indent/xsd.vim
@@ -0,0 +1,13 @@
+" Vim indent file
+" Language: .xsd files (XML Schema)
+" Maintainer: Nobody
+" Last Change: 2005 Jun 09
+
+" Only load this indent file when no other was loaded.
+if exists("b:did_indent")
+ finish
+endif
+
+" Use XML formatting rules
+runtime! indent/xml.vim
+
View
2 runtime/menu.vim
@@ -2,7 +2,7 @@
" You can also use this as a start for your own set of menus.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2005 Jun 08
+" Last Change: 2005 Jun 11
" Note that ":an" (short for ":anoremenu") is often used to make a menu work
" in all modes and avoid side effects from mappings defined by the user.
View
BIN runtime/spell/en.ascii.spl
Binary file not shown.
View
BIN runtime/spell/en.latin1.spl
Binary file not shown.
View
BIN runtime/spell/en.utf-8.spl
Binary file not shown.
View
116 runtime/syntax/squid.vim
@@ -1,9 +1,10 @@
" Vim syntax file
" Language: Squid config file
" Maintainer: Klaus Muth <klaus@hampft.de>
-" Last Change: 2004 Feb 01
+" Last Change: 2005 Jun 12
" URL: http://www.hampft.de/vim/syntax/squid.vim
-" ThanksTo: Ilya Sher <iso8601@mail.ru>
+" ThanksTo: Ilya Sher <iso8601@mail.ru>,
+" Michael Dotzler <Michael.Dotzler@leoni.com>
" For version 5.x: Clear all syntax items
@@ -22,80 +23,82 @@ syn match squidComment "#.*$" contains=squidTodo,squidTag
syn match squidTag contained "TAG: .*$"
" Lots & lots of Keywords!
-syn keyword squidConf acl always_direct announce_host
-syn keyword squidConf announce_period announce_port announce_to
-syn keyword squidConf anonymize_headers append_domain
-syn keyword squidConf as_whois_server authenticate_children
-syn keyword squidConf authenticate_program authenticate_ttl
-syn keyword squidConf broken_posts buffered_logs cache_access_log
-syn keyword squidConf cache_announce cache_dir cache_dns_program
-syn keyword squidConf cache_effective_group cache_effective_user
-syn keyword squidConf cache_host cache_host_acl cache_host_domain
-syn keyword squidConf cache_log cache_mem cache_mem_high
-syn keyword squidConf cache_mem_low cache_mgr cachemgr_passwd
-syn keyword squidConf cache_peer cache_stoplist
-syn keyword squidConf cache_stoplist_pattern cache_store_log
-syn keyword squidConf cache_swap cache_swap_high cache_swap_log
-syn keyword squidConf cache_swap_low client_db client_lifetime
-syn keyword squidConf client_netmask connect_timeout coredump_dir
-syn keyword squidConf dead_peer_timeout debug_options delay_access
-syn keyword squidConf delay_class delay_initial_bucket_level
-syn keyword squidConf delay_parameters delay_pools dns_children
-syn keyword squidConf dns_defnames dns_nameservers dns_testnames
-syn keyword squidConf emulate_httpd_log err_html_text
-syn keyword squidConf fake_user_agent firewall_ip forwarded_for
-syn keyword squidConf forward_snmpd_port fqdncache_size
+syn keyword squidConf acl always_direct announce_host announce_period
+syn keyword squidConf announce_port announce_to anonymize_headers
+syn keyword squidConf append_domain as_whois_server auth_param_basic
+syn keyword squidConf authenticate_children authenticate_program
+syn keyword squidConf authenticate_ttl broken_posts buffered_logs
+syn keyword squidConf cache_access_log cache_announce cache_dir
+syn keyword squidConf cache_dns_program cache_effective_group
+syn keyword squidConf cache_effective_user cache_host cache_host_acl
+syn keyword squidConf cache_host_domain cache_log cache_mem
+syn keyword squidConf cache_mem_high cache_mem_low cache_mgr
+syn keyword squidConf cachemgr_passwd cache_peer cache_peer_access
+syn keyword squidConf cahce_replacement_policy cache_stoplist
+syn keyword squidConf cache_stoplist_pattern cache_store_log cache_swap
+syn keyword squidConf cache_swap_high cache_swap_log cache_swap_low
+syn keyword squidConf client_db client_lifetime client_netmask
+syn keyword squidConf connect_timeout coredump_dir dead_peer_timeout
+syn keyword squidConf debug_options delay_access delay_class
+syn keyword squidConf delay_initial_bucket_level delay_parameters
+syn keyword squidConf delay_pools deny_info dns_children dns_defnames
+syn keyword squidConf dns_nameservers dns_testnames emulate_httpd_log
+syn keyword squidConf err_html_text fake_user_agent firewall_ip
+syn keyword squidConf forwarded_for forward_snmpd_port fqdncache_size
syn keyword squidConf ftpget_options ftpget_program ftp_list_width
-syn keyword squidConf ftp_user half_closed_clients
-syn keyword squidConf hierarchy_stoplist htcp_port http_access
-syn keyword squidConf http_anonymizer httpd_accel httpd_accel_host
-syn keyword squidConf httpd_accel_port httpd_accel_uses_host_header
-syn keyword squidConf httpd_accel_with_proxy http_port
-syn keyword squidConf http_reply_access icp_access icp_hit_stale
-syn keyword squidConf icp_port icp_query_timeout ident_lookup
-syn keyword squidConf ident_lookup_access ident_timeout
-syn keyword squidConf incoming_http_average incoming_icp_average
-syn keyword squidConf inside_firewall ipcache_high ipcache_low
-syn keyword squidConf ipcache_size local_domain local_ip
+syn keyword squidConf ftp_passive ftp_user half_closed_clients
+syn keyword squidConf header_access header_replace hierarchy_stoplist
+syn keyword squidConf high_response_time_warning high_page_fault_warning
+syn keyword squidConf htcp_port http_access http_anonymizer httpd_accel
+syn keyword squidConf httpd_accel_host httpd_accel_port
+syn keyword squidConf httpd_accel_uses_host_header
+syn keyword squidConf httpd_accel_with_proxy http_port http_reply_access
+syn keyword squidConf icp_access icp_hit_stale icp_port
+syn keyword squidConf icp_query_timeout ident_lookup ident_lookup_access
+syn keyword squidConf ident_timeout incoming_http_average
+syn keyword squidConf incoming_icp_average inside_firewall ipcache_high
+syn keyword squidConf ipcache_low ipcache_size local_domain local_ip
syn keyword squidConf logfile_rotate log_fqdn log_icp_queries
syn keyword squidConf log_mime_hdrs maximum_object_size
syn keyword squidConf maximum_single_addr_tries mcast_groups
syn keyword squidConf mcast_icp_query_timeout mcast_miss_addr
-syn keyword squidConf mcast_miss_encode_key mcast_miss_port
-syn keyword squidConf memory_pools mime_table min_http_poll_cnt
-syn keyword squidConf min_icp_poll_cnt minimum_direct_hops
-syn keyword squidConf minimum_retry_timeout miss_access
-syn keyword squidConf negative_dns_ttl negative_ttl
-syn keyword squidConf neighbor_timeout neighbor_type_domain
+syn keyword squidConf mcast_miss_encode_key mcast_miss_port memory_pools
+syn keyword squidConf memory_pools_limit memory_replacement_policy
+syn keyword squidConf mime_table min_http_poll_cnt min_icp_poll_cnt
+syn keyword squidConf minimum_direct_hops minimum_object_size
+syn keyword squidConf minimum_retry_timeout miss_access negative_dns_ttl
+syn keyword squidConf negative_ttl neighbor_timeout neighbor_type_domain
syn keyword squidConf netdb_high netdb_low netdb_ping_period
-syn keyword squidConf netdb_ping_rate no_cache passthrough_proxy
-syn keyword squidConf pconn_timeout pid_filename pinger_program
-syn keyword squidConf positive_dns_ttl prefer_direct proxy_auth
-syn keyword squidConf proxy_auth_realm query_icmp quick_abort
+syn keyword squidConf netdb_ping_rate never_direct no_cache
+syn keyword squidConf passthrough_proxy pconn_timeout pid_filename
+syn keyword squidConf pinger_program positive_dns_ttl prefer_direct
+syn keyword squidConf proxy_auth proxy_auth_realm query_icmp quick_abort
syn keyword squidConf quick_abort quick_abort_max quick_abort_min
-syn keyword squidConf quick_abort_pct range_offset_limit
-syn keyword squidConf read_timeout redirect_children
-syn keyword squidConf redirect_program
+syn keyword squidConf quick_abort_pct range_offset_limit read_timeout
+syn keyword squidConf redirect_children redirect_program
syn keyword squidConf redirect_rewrites_host_header reference_age
syn keyword squidConf reference_age refresh_pattern reload_into_ims
-syn keyword squidConf request_size request_timeout
+syn keyword squidConf request_body_max_size request_size request_timeout
syn keyword squidConf shutdown_lifetime single_parent_bypass
syn keyword squidConf siteselect_timeout snmp_access
syn keyword squidConf snmp_incoming_address snmp_port source_ping
syn keyword squidConf ssl_proxy store_avg_object_size
syn keyword squidConf store_objects_per_bucket strip_query_terms
syn keyword squidConf swap_level1_dirs swap_level2_dirs
syn keyword squidConf tcp_incoming_address tcp_outgoing_address
-syn keyword squidConf tcp_recv_bufsize test_reachability
-syn keyword squidConf udp_hit_obj udp_hit_obj_size
-syn keyword squidConf udp_incoming_address udp_outgoing_address
-syn keyword squidConf unique_hostname unlinkd_program
-syn keyword squidConf uri_whitespace useragent_log visible_hostname
-syn keyword squidConf wais_relay wais_relay_host wais_relay_port
+syn keyword squidConf tcp_recv_bufsize test_reachability udp_hit_obj
+syn keyword squidConf udp_hit_obj_size udp_incoming_address
+syn keyword squidConf udp_outgoing_address unique_hostname
+syn keyword squidConf unlinkd_program uri_whitespace useragent_log
+syn keyword squidConf visible_hostname wais_relay wais_relay_host
+syn keyword squidConf wais_relay_port
syn keyword squidOpt proxy-only weight ttl no-query default
syn keyword squidOpt round-robin multicast-responder
syn keyword squidOpt on off all deny allow
+syn keyword squidopt via parent no-digest heap lru realm
+syn keyword squidopt children credentialsttl none disable
+syn keyword squidopt offline_toggle diskd q1 q2
" Security Actions for cachemgr_passwd
syn keyword squidAction shutdown info parameter server_list
@@ -108,6 +111,7 @@ syn match squidAction "squid\.conf"
syn keyword squidAcl url_regex urlpath_regex referer_regex port proto
syn keyword squidAcl req_mime_type rep_mime_type
syn keyword squidAcl method browser user src dst
+syn keyword squidAcl time dstdomain ident snmp_community
syn match squidNumber "\<\d\+\>"
syn match squidIP "\<\d\{1,3}\.\d\{1,3}\.\d\{1,3}\.\d\{1,3}\>"
View
15 src/Make_mvc.mak
@@ -110,7 +110,8 @@
TARGETOS = BOTH
-# Select one of eight object code directories, depends on GUI, OLE and DEBUG.
+# Select one of eight object code directories, depends on GUI, OLE, DEBUG and
+# interfaces.
# If you change something else, do "make clean" first!
!if "$(GUI)" == "yes"
OBJDIR = .\ObjG
@@ -120,6 +121,18 @@ OBJDIR = .\ObjC
!if "$(OLE)" == "yes"
OBJDIR = $(OBJDIR)O
!endif
+!ifdef PERL
+OBJDIR = $(OBJDIR)L
+!endif
+!ifdef PYTHON
+OBJDIR = $(OBJDIR)Y
+!endif
+!ifdef TCL
+OBJDIR = $(OBJDIR)T
+!endif
+!ifdef RUBY
+OBJDIR = $(OBJDIR)R
+!endif
!ifdef MZSCHEME
OBJDIR = $(OBJDIR)Z
!endif
View
1,108 src/eval.c
@@ -264,12 +264,11 @@ typedef struct
#define VV_RO 2 /* read-only */
#define VV_RO_SBX 4 /* read-only in the sandbox */
-#define VV_NAME(s, t) s, sizeof(s) - 1, {{t}}, {0}
+#define VV_NAME(s, t) s, {{t}}, {0}
static struct vimvar
{
char *vv_name; /* name of variable, without v: */
- int vv_len; /* length of name */
dictitem_T vv_di; /* value and name for key */
char vv_filler[16]; /* space for LONGEST name below!!! */
char vv_flags; /* VV_COMPAT, VV_RO, VV_RO_SBX */
@@ -594,9 +593,12 @@ static void free_tv __ARGS((typval_T *varp));
static void clear_tv __ARGS((typval_T *varp));
static void init_tv __ARGS((typval_T *varp));
static long get_tv_number __ARGS((typval_T *varp));
+static long get_tv_number_chk __ARGS((typval_T *varp, int *denote));
static linenr_T get_tv_lnum __ARGS((typval_T *argvars));
static char_u *get_tv_string __ARGS((typval_T *varp));
+static char_u *get_tv_string_chk __ARGS((typval_T *varp));
static char_u *get_tv_string_buf __ARGS((typval_T *varp, char_u *buf));
+static char_u *get_tv_string_buf_chk __ARGS((typval_T *varp, char_u *buf));
static dictitem_T *find_var __ARGS((char_u *name, hashtab_T **htp));
static dictitem_T *find_var_in_ht __ARGS((hashtab_T *ht, char_u *varname, int writing));
static hashtab_T *find_var_ht __ARGS((char_u *name, char_u **varname));
@@ -1023,7 +1025,7 @@ eval_to_bool(arg, error, nextcmd, skip)
*error = FALSE;
if (!skip)
{
- retval = (get_tv_number(&tv) != 0);
+ retval = (get_tv_number_chk(&tv, error) != 0);
clear_tv(&tv);
}
}
@@ -1137,7 +1139,7 @@ eval_to_number(expr)
retval = -1;
else
{
- retval = get_tv_number(&rettv);
+ retval = get_tv_number_chk(&rettv, NULL);
clear_tv(&rettv);
}
--emsg_off;
@@ -1775,8 +1777,8 @@ ex_let_one(arg, tv, copy, endchars, op)
{
c1 = name[len];
name[len] = NUL;
- p = get_tv_string(tv);
- if (op != NULL && *op == '.')
+ p = get_tv_string_chk(tv);
+ if (p != NULL && op != NULL && *op == '.')
{
int mustfree = FALSE;
char_u *s = vim_getenv(name, &mustfree);
@@ -1789,15 +1791,18 @@ ex_let_one(arg, tv, copy, endchars, op)
}
}
if (p != NULL)
+ {
vim_setenv(name, p);
- if (STRICMP(name, "HOME") == 0)
- init_homedir();
- else if (didset_vim && STRICMP(name, "VIM") == 0)
- didset_vim = FALSE;
- else if (didset_vimruntime && STRICMP(name, "VIMRUNTIME") == 0)
- didset_vimruntime = FALSE;
+ if (STRICMP(name, "HOME") == 0)
+ init_homedir();
+ else if (didset_vim && STRICMP(name, "VIM") == 0)
+ didset_vim = FALSE;
+ else if (didset_vimruntime
+ && STRICMP(name, "VIMRUNTIME") == 0)
+ didset_vimruntime = FALSE;
+ arg_end = arg;
+ }
name[len] = c1;
- arg_end = arg;
vim_free(tofree);
}
}
@@ -1827,8 +1832,8 @@ ex_let_one(arg, tv, copy, endchars, op)
*p = NUL;
n = get_tv_number(tv);
- s = get_tv_string(tv);
- if (op != NULL && *op != '=')
+ s = get_tv_string_chk(tv); /* != NULL if number or string */
+ if (s != NULL && op != NULL && *op != '=')
{
opt_type = get_option_value(arg, &numval,
&stringval, opt_flags);
@@ -1852,9 +1857,12 @@ ex_let_one(arg, tv, copy, endchars, op)
}
}
}
- set_option_value(arg, n, s, opt_flags);
+ if (s != NULL)
+ {
+ set_option_value(arg, n, s, opt_flags);
+ arg_end = p;
+ }
*p = c1;
- arg_end = p;
vim_free(stringval);
}
}
@@ -1875,8 +1883,8 @@ ex_let_one(arg, tv, copy, endchars, op)
char_u *tofree = NULL;
char_u *s;
- p = get_tv_string(tv);
- if (op != NULL && *op == '.')
+ p = get_tv_string_chk(tv);
+ if (p != NULL && op != NULL && *op == '.')
{
s = get_reg_contents(*arg == '@' ? '"' : *arg, FALSE, FALSE);
if (s != NULL)
@@ -1886,8 +1894,10 @@ ex_let_one(arg, tv, copy, endchars, op)
}
}
if (p != NULL)
+ {
write_reg_contents(*arg == '@' ? '"' : *arg, p, -1, FALSE);
- arg_end = arg + 1;
+ arg_end = arg + 1;
+ }
vim_free(tofree);
}
}
@@ -2070,6 +2080,12 @@ get_lval(name, rettv, lp, unlet, skip, quiet, fne_flags)
empty1 = FALSE;
if (eval1(&p, &var1, TRUE) == FAIL) /* recursive! */
return NULL;
+ if (get_tv_string_chk(&var1) == NULL)
+ {
+ /* not a number or string */
+ clear_tv(&var1);
+ return NULL;
+ }
}
/* Optionally get the second index [ :expr]. */
@@ -2104,6 +2120,14 @@ get_lval(name, rettv, lp, unlet, skip, quiet, fne_flags)
clear_tv(&var1);
return NULL;
}
+ if (get_tv_string_chk(&var2) == NULL)
+ {
+ /* not a number or string */
+ if (!empty1)
+ clear_tv(&var1);
+ clear_tv(&var2);
+ return NULL;
+ }
}
lp->ll_range = TRUE;
}
@@ -2130,7 +2154,7 @@ get_lval(name, rettv, lp, unlet, skip, quiet, fne_flags)
if (len == -1)
{
/* "[key]": get key from "var1" */
- key = get_tv_string(&var1);
+ key = get_tv_string(&var1); /* is number or string */
if (*key == NUL)
{
if (!quiet)
@@ -2176,7 +2200,7 @@ get_lval(name, rettv, lp, unlet, skip, quiet, fne_flags)
lp->ll_n1 = 0;
else
{
- lp->ll_n1 = get_tv_number(&var1);
+ lp->ll_n1 = get_tv_number(&var1); /* is number or string */
clear_tv(&var1);
}
lp->ll_dict = NULL;
@@ -2199,7 +2223,7 @@ get_lval(name, rettv, lp, unlet, skip, quiet, fne_flags)
*/
if (lp->ll_range && !lp->ll_empty2)
{
- lp->ll_n2 = get_tv_number(&var2);
+ lp->ll_n2 = get_tv_number(&var2); /* is number or string */
clear_tv(&var2);
if (lp->ll_n2 < 0)
{
@@ -3340,9 +3364,13 @@ eval1(arg, rettv, evaluate)
result = FALSE;
if (evaluate)
{
- if (get_tv_number(rettv) != 0)
+ int error = FALSE;
+
+ if (get_tv_number_chk(rettv, &error) != 0)
result = TRUE;
clear_tv(rettv);
+ if (error)
+ return FAIL;
}
/*
@@ -3398,6 +3426,7 @@ eval2(arg, rettv, evaluate)
typval_T var2;
long result;
int first;
+ int error = FALSE;
/*
* Get the first variable.
@@ -3414,9 +3443,11 @@ eval2(arg, rettv, evaluate)
{
if (evaluate && first)
{
- if (get_tv_number(rettv) != 0)
+ if (get_tv_number_chk(rettv, &error) != 0)
result = TRUE;
clear_tv(rettv);
+ if (error)
+ return FAIL;
first = FALSE;
}
@@ -3432,9 +3463,11 @@ eval2(arg, rettv, evaluate)
*/
if (evaluate && !result)
{
- if (get_tv_number(&var2) != 0)
+ if (get_tv_number_chk(&var2, &error) != 0)
result = TRUE;
clear_tv(&var2);
+ if (error)
+ return FAIL;
}
if (evaluate)
{
@@ -3464,6 +3497,7 @@ eval3(arg, rettv, evaluate)
typval_T var2;
long result;
int first;
+ int error = FALSE;
/*
* Get the first variable.
@@ -3480,9 +3514,11 @@ eval3(arg, rettv, evaluate)
{
if (evaluate && first)
{
- if (get_tv_number(rettv) == 0)
+ if (get_tv_number_chk(rettv, &error) == 0)
result = FALSE;
clear_tv(rettv);
+ if (error)
+ return FAIL;
first = FALSE;
}
@@ -3498,9 +3534,11 @@ eval3(arg, rettv, evaluate)
*/
if (evaluate && result)
{
- if (get_tv_number(&var2) == 0)
+ if (get_tv_number_chk(&var2, &error) == 0)
result = FALSE;
clear_tv(&var2);
+ if (error)
+ return FAIL;
}
if (evaluate)
{
@@ -3832,6 +3870,22 @@ eval5(arg, rettv, evaluate)
if (op != '+' && op != '-' && op != '.')
break;
+ if (op != '+' || rettv->v_type != VAR_LIST)
+ {
+ /* For "list + ...", an illegal use of the first operand as
+ * a number cannot be determined before evaluating the 2nd
+ * operand: if this is also a list, all is ok.
+ * For "something . ...", "something - ..." or "non-list + ...",
+ * we know that the first operand needs to be a string or number
+ * without evaluating the 2nd operand. So check before to avoid
+ * side effects after an error. */
+ if (evaluate && get_tv_string_chk(rettv) == NULL)
+ {
+ clear_tv(rettv);
+ return FAIL;
+ }
+ }
+
/*
* Get the second variable.
*/
@@ -3849,8 +3903,14 @@ eval5(arg, rettv, evaluate)
*/
if (op == '.')
{
- s1 = get_tv_string_buf(rettv, buf1);
- s2 = get_tv_string_buf(&var2, buf2);
+ s1 = get_tv_string_buf(rettv, buf1); /* already checked */
+ s2 = get_tv_string_buf_chk(&var2, buf2);
+ if (s2 == NULL) /* type error ? */
+ {
+ clear_tv(rettv);
+ clear_tv(&var2);
+ return FAIL;
+ }
p = concat_str(s1, s2);
clear_tv(rettv);
rettv->v_type = VAR_STRING;
@@ -3872,8 +3932,24 @@ eval5(arg, rettv, evaluate)
}
else
{
- n1 = get_tv_number(rettv);
- n2 = get_tv_number(&var2);
+ int error = FALSE;
+
+ n1 = get_tv_number_chk(rettv, &error);
+ if (error)
+ {
+ /* This can only happen for "list + non-list".
+ * For "non-list + ..." or "something - ...", we returned
+ * before evaluating the 2nd operand. */
+ clear_tv(rettv);
+ return FAIL;
+ }
+ n2 = get_tv_number_chk(&var2, &error);
+ if (error)
+ {
+ clear_tv(rettv);
+ clear_tv(&var2);
+ return FAIL;
+ }
clear_tv(rettv);
if (op == '+')
n1 = n1 + n2;
@@ -3908,6 +3984,7 @@ eval6(arg, rettv, evaluate)
typval_T var2;
int op;
long n1, n2;
+ int error = FALSE;
/*
* Get the first variable.
@@ -3926,8 +4003,10 @@ eval6(arg, rettv, evaluate)
if (evaluate)
{
- n1 = get_tv_number(rettv);
+ n1 = get_tv_number_chk(rettv, &error);
clear_tv(rettv);
+ if (error)
+ return FAIL;
}
else
n1 = 0;
@@ -3941,8 +4020,10 @@ eval6(arg, rettv, evaluate)
if (evaluate)
{
- n2 = get_tv_number(&var2);
+ n2 = get_tv_number_chk(&var2, &error);
clear_tv(&var2);
+ if (error)
+ return FAIL;
/*
* Compute the result.
@@ -4175,18 +4256,28 @@ eval7(arg, rettv, evaluate)
*/
if (ret == OK && evaluate && end_leader > start_leader)
{
- val = get_tv_number(rettv);
- while (end_leader > start_leader)
+ int error = FALSE;
+
+ val = get_tv_number_chk(rettv, &error);
+ if (error)
{
- --end_leader;
- if (*end_leader == '!')
- val = !val;
- else if (*end_leader == '-')
- val = -val;
+ clear_tv(rettv);
+ ret = FAIL;
+ }
+ else
+ {
+ while (end_leader > start_leader)
+ {
+ --end_leader;
+ if (*end_leader == '!')
+ val = !val;
+ else if (*end_leader == '-')
+ val = -val;
+ }
+ clear_tv(rettv);
+ rettv->v_type = VAR_NUMBER;
+ rettv->vval.v_number = val;
}
- clear_tv(rettv);
- rettv->v_type = VAR_NUMBER;
- rettv->vval.v_number = val;
}
return ret;
@@ -4243,6 +4334,12 @@ eval_index(arg, rettv, evaluate, verbose)
empty1 = TRUE;
else if (eval1(arg, &var1, evaluate) == FAIL) /* recursive! */
return FAIL;
+ else if (evaluate && get_tv_string_chk(&var1) == NULL)
+ {
+ /* not a number or string */
+ clear_tv(&var1);
+ return FAIL;
+ }
/*
* Get the second variable from inside the [:].
@@ -4255,7 +4352,16 @@ eval_index(arg, rettv, evaluate, verbose)
empty2 = TRUE;
else if (eval1(arg, &var2, evaluate) == FAIL) /* recursive! */
{
- clear_tv(&var1);
+ if (!empty1)
+ clear_tv(&var1);
+ return FAIL;
+ }
+ else if (evaluate && get_tv_string_chk(&var2) == NULL)
+ {
+ /* not a number or string */
+ if (!empty1)
+ clear_tv(&var1);
+ clear_tv(&var2);
return FAIL;
}
}
@@ -4928,6 +5034,7 @@ tv_equal(tv1, tv2, ic)
int ic; /* ignore case */
{
char_u buf1[NUMBUFLEN], buf2[NUMBUFLEN];
+ char_u *s1, *s2;
if (tv1->v_type == VAR_LIST || tv2->v_type == VAR_LIST)
{
@@ -4963,12 +5070,13 @@ tv_equal(tv1, tv2, ic)
if (get_tv_number(tv1) != get_tv_number(tv2))
return FALSE;
}
- else if (!ic && STRCMP(get_tv_string_buf(tv1, buf1),
- get_tv_string_buf(tv2, buf2)) != 0)
- return FALSE;
- else if (ic && STRICMP(get_tv_string_buf(tv1, buf1),
- get_tv_string_buf(tv2, buf2)) != 0)
- return FALSE;
+ else
+ {
+ s1 = get_tv_string_buf(tv1, buf1);
+ s2 = get_tv_string_buf(tv2, buf2);
+ if ((ic ? MB_STRICMP(s1, s2) : STRCMP(s1, s2)) != 0)
+ return FALSE;
+ }
return TRUE;
}
@@ -5828,10 +5936,12 @@ get_dict_tv(arg, rettv, evaluate)
clear_tv(&tvkey);
goto failret;
}
- key = get_tv_string_buf(&tvkey, buf);
- if (*key == NUL)
+ key = get_tv_string_buf_chk(&tvkey, buf);
+ if (key == NULL || *key == NUL)
{
- EMSG(_(e_emptykey));
+ /* "key" is NULL when get_tv_string_buf_chk() gave an errmsg */
+ if (key != NULL)
+ EMSG(_(e_emptykey));
clear_tv(&tvkey);
goto failret;
}
@@ -6731,12 +6841,12 @@ f_append(argvars, rettv)
typval_T *rettv;
{
long lnum;
+ char_u *line;
list_T *l = NULL;
listitem_T *li = NULL;
typval_T *tv;
long added = 0;
- rettv->vval.v_number = 1; /* Default: Failed */
lnum = get_tv_lnum(argvars);
if (lnum >= 0
&& lnum <= curbuf->b_ml.ml_line_count
@@ -6749,6 +6859,7 @@ f_append(argvars, rettv)
return;
li = l->lv_first;
}
+ rettv->vval.v_number = 0; /* Default: Success */
for (;;)
{
if (l == NULL)
@@ -6757,7 +6868,13 @@ f_append(argvars, rettv)
break; /* end of list */
else
tv = &li->li_tv; /* append item from list */
- ml_append(lnum + added, get_tv_string(tv), (colnr_T)0, FALSE);
+ line = get_tv_string_chk(tv);
+ if (line == NULL) /* type error */
+ {
+ rettv->vval.v_number = 1; /* Failed */
+ break;
+ }
+ ml_append(lnum + added, line, (colnr_T)0, FALSE);
++added;
if (l == NULL)
break;
@@ -6767,8 +6884,9 @@ f_append(argvars, rettv)
appended_lines_mark(lnum, added);
if (curwin->w_cursor.lnum > lnum)
curwin->w_cursor.lnum += added;
- rettv->vval.v_number = 0; /* Success */
}
+ else
+ rettv->vval.v_number = 1; /* Failed */
}
/*
@@ -6805,7 +6923,7 @@ f_argv(argvars, rettv)
{
int idx;
- idx = get_tv_number(&argvars[0]);
+ idx = get_tv_number_chk(&argvars[0], NULL);
if (idx >= 0 && idx < ARGCOUNT)
rettv->vval.v_string = vim_strsave(alist_name(&ARGLIST[idx]));
else
@@ -6829,13 +6947,17 @@ f_browse(argvars, rettv)
char_u *defname;
char_u buf[NUMBUFLEN];
char_u buf2[NUMBUFLEN];
+ int error = FALSE;
- save = get_tv_number(&argvars[0]);
- title = get_tv_string(&argvars[1]);
- initdir = get_tv_string_buf(&argvars[2], buf);
- defname = get_tv_string_buf(&argvars[3], buf2);
+ save = get_tv_number_chk(&argvars[0], &error);
+ title = get_tv_string_chk(&argvars[1]);
+ initdir = get_tv_string_buf_chk(&argvars[2], buf);
+ defname = get_tv_string_buf_chk(&argvars[3], buf2);
- rettv->vval.v_string =
+ if (error || title == NULL || initdir == NULL || defname == NULL)
+ rettv->vval.v_string = NULL;
+ else
+ rettv->vval.v_string =
do_browse(save ? BROWSE_SAVE : 0,
title, defname, NULL, initdir, NULL, curbuf);
#else
@@ -6858,10 +6980,13 @@ f_browsedir(argvars, rettv)
char_u *initdir;
char_u buf[NUMBUFLEN];
- title = get_tv_string(&argvars[0]);
- initdir = get_tv_string_buf(&argvars[1], buf);
+ title = get_tv_string_chk(&argvars[0]);
+ initdir = get_tv_string_buf_chk(&argvars[1], buf);
- rettv->vval.v_string = do_browse(BROWSE_DIR,
+ if (title == NULL || initdir == NULL)
+ rettv->vval.v_string = NULL;
+ else
+ rettv->vval.v_string = do_browse(BROWSE_DIR,
title, NULL, NULL, initdir, NULL, curbuf);
#else
rettv->vval.v_string = NULL;
@@ -6994,6 +7119,7 @@ f_bufname(argvars, rettv)
{
buf_T *buf;
+ (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */
++emsg_off;
buf = get_buf_tv(&argvars[0]);
rettv->v_type = VAR_STRING;
@@ -7014,6 +7140,7 @@ f_bufnr(argvars, rettv)
{
buf_T *buf;
+ (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */
++emsg_off;
buf = get_buf_tv(&argvars[0]);
if (buf != NULL)
@@ -7037,6 +7164,7 @@ f_bufwinnr(argvars, rettv)
#endif
buf_T *buf;
+ (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */
++emsg_off;
buf = get_buf_tv(&argvars[0]);
#ifdef FEAT_WINDOWS
@@ -7067,7 +7195,7 @@ f_byte2line(argvars, rettv)
#else
long boff = 0;
- boff = get_tv_number(&argvars[0]) - 1;
+ boff = get_tv_number(&argvars[0]) - 1; /* boff gets -1 on type error */
if (boff < 0)
rettv->vval.v_number = -1;
else
@@ -7091,10 +7219,10 @@ f_byteidx(argvars, rettv)
char_u *str;
long idx;
- str = get_tv_string(&argvars[0]);
- idx = get_tv_number(&argvars[1]);
+ str = get_tv_string_chk(&argvars[0]);
+ idx = get_tv_number_chk(&argvars[1], NULL);
rettv->vval.v_number = -1;
- if (idx < 0)
+ if (str == NULL || idx < 0)
return;
#ifdef FEAT_MBYTE
@@ -7140,6 +7268,8 @@ f_call(argvars, rettv)
func = argvars[0].vval.v_string;
else
func = get_tv_string(&argvars[0]);
+ if (*func == NUL)
+ return; /* type error or empty name */
if (argvars[2].v_type != VAR_UNKNOWN)
{
@@ -7185,8 +7315,7 @@ f_char2nr(argvars, rettv)
{
#ifdef FEAT_MBYTE
if (has_mbyte)
- rettv->vval.v_number =
- (*mb_ptr2char)(get_tv_string(&argvars[0]));
+ rettv->vval.v_number = (*mb_ptr2char)(get_tv_string(&argvars[0]));
else
#endif
rettv->vval.v_number = get_tv_string(&argvars[0])[0];
@@ -7285,26 +7414,35 @@ f_confirm(argvars, rettv)
char_u buf2[NUMBUFLEN];
int def = 1;
int type = VIM_GENERIC;
- int c;
+ char_u *typestr;
+ int error = FALSE;
- message = get_tv_string(&argvars[0]);
+ message = get_tv_string_chk(&argvars[0]);
+ if (message == NULL)
+ error = TRUE;
if (argvars[1].v_type != VAR_UNKNOWN)
{
- buttons = get_tv_string_buf(&argvars[1], buf);
+ buttons = get_tv_string_buf_chk(&argvars[1], buf);
+ if (buttons == NULL)
+ error = TRUE;
if (argvars[2].v_type != VAR_UNKNOWN)
{
- def = get_tv_number(&argvars[2]);
+ def = get_tv_number_chk(&argvars[2], &error);
if (argvars[3].v_type != VAR_UNKNOWN)
{
- /* avoid that TOUPPER_ASC calls get_tv_string_buf() twice */
- c = *get_tv_string_buf(&argvars[3], buf2);
- switch (TOUPPER_ASC(c))
+ typestr = get_tv_string_buf_chk(&argvars[3], buf2);
+ if (typestr == NULL)
+ error = TRUE;
+ else
{
- case 'E': type = VIM_ERROR; break;
- case 'Q': type = VIM_QUESTION; break;
- case 'I': type = VIM_INFO; break;
- case 'W': type = VIM_WARNING; break;
- case 'G': type = VIM_GENERIC; break;
+ switch (TOUPPER_ASC(*typestr))
+ {
+ case 'E': type = VIM_ERROR; break;
+ case 'Q': type = VIM_QUESTION; break;
+ case 'I': type = VIM_INFO; break;
+ case 'W': type = VIM_WARNING; break;
+ case 'G': type = VIM_GENERIC; break;
+ }
}
}
}
@@ -7313,7 +7451,10 @@ f_confirm(argvars, rettv)
if (buttons == NULL || *buttons == NUL)
buttons = (char_u *)_("&Ok");
- rettv->vval.v_number = do_dialog(type, NULL, message, buttons,
+ if (error)
+ rettv->vval.v_number = 0;
+ else
+ rettv->vval.v_number = do_dialog(type, NULL, message, buttons,
def, NULL);
#else
rettv->vval.v_number = 0;
@@ -7353,14 +7494,21 @@ f_count(argvars, rettv)
li = l->lv_first;
if (argvars[2].v_type != VAR_UNKNOWN)
{
- ic = get_tv_number(&argvars[2]);
+ int error = FALSE;
+
+ ic = get_tv_number_chk(&argvars[2], &error);
if (argvars[3].v_type != VAR_UNKNOWN)
{
- idx = get_tv_number(&argvars[3]);
- li = list_find(l, idx);
- if (li == NULL)
- EMSGN(_(e_listidx), idx);
+ idx = get_tv_number_chk(&argvars[3], &error);
+ if (!error)
+ {
+ li = list_find(l, idx);
+ if (li == NULL)
+ EMSGN(_(e_listidx), idx);
+ }
}
+ if (error)
+ li = NULL;
}
for ( ; li != NULL; li = li->li_next)
@@ -7376,14 +7524,16 @@ f_count(argvars, rettv)
if ((d = argvars[0].vval.v_dict) != NULL)
{
+ int error = FALSE;
+
if (argvars[2].v_type != VAR_UNKNOWN)
{
- ic = get_tv_number(&argvars[2]);
+ ic = get_tv_number_chk(&argvars[2], &error);
if (argvars[3].v_type != VAR_UNKNOWN)
EMSG(_(e_invarg));
}
- todo = d->dv_hashtab.ht_used;
+ todo = error ? 0 : d->dv_hashtab.ht_used;
for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))
@@ -7446,9 +7596,11 @@ f_cursor(argvars, rettv)
long line, col;
line = get_tv_lnum(argvars);
+ col = get_tv_number_chk(&argvars[1], NULL);
+ if (line < 0 || col < 0)
+ return; /* type error; errmsg already given */
if (line > 0)
curwin->w_cursor.lnum = line;
- col = get_tv_number(&argvars[1]);
if (col > 0)
curwin->w_cursor.col = col - 1;
#ifdef FEAT_VIRTUALEDIT
@@ -7478,7 +7630,7 @@ f_deepcopy(argvars, rettv)
int noref = 0;
if (argvars[1].v_type != VAR_UNKNOWN)
- noref = get_tv_number(&argvars[1]);
+ noref = get_tv_number_chk(&argvars[1], NULL);
if (noref < 0 || noref > 1)
EMSG(_(e_invarg));
else
@@ -7549,6 +7701,8 @@ f_diff_hlID(argvars, rettv)
int filler_lines;
int col;
+ if (lnum < 0) /* ignore type error in {lnum} arg */
+ lnum = 0;
if (lnum != prev_lnum
|| changedtick != curbuf->b_changedtick
|| fnum != curbuf->b_fnum)
@@ -7578,7 +7732,7 @@ f_diff_hlID(argvars, rettv)
if (hlID == HLF_CHD || hlID == HLF_TXD)
{
- col = get_tv_number(&argvars[1]) - 1;
+ col = get_tv_number(&argvars[1]) - 1; /* ignore type error in {col} */
if (col >= change_start && col <= change_end)
hlID = HLF_TXD; /* changed text */
else
@@ -7650,11 +7804,15 @@ f_eval(argvars, rettv)
{
char_u *s;
- s = get_tv_string(&argvars[0]);
- s = skipwhite(s);
+ s = get_tv_string_chk(&argvars[0]);
+ if (s != NULL)
+ s = skipwhite(s);
- if (eval1(&s, rettv, TRUE) == FAIL)
+ if (s == NULL || eval1(&s, rettv, TRUE) == FAIL)
+ {
+ rettv->v_type = VAR_NUMBER;
rettv->vval.v_number = 0;
+ }
else if (*s != NUL)
EMSG(_(e_trailing));
}
@@ -7772,6 +7930,7 @@ f_expand(argvars, rettv)
char_u *errormsg;
int flags = WILD_SILENT|WILD_USE_NL|WILD_LIST_NOTFOUND;
expand_T xpc;
+ int error = FALSE;
rettv->v_type = VAR_STRING;
s = get_tv_string(&argvars[0]);
@@ -7785,12 +7944,18 @@ f_expand(argvars, rettv)
{
/* When the optional second argument is non-zero, don't remove matches
* for 'suffixes' and 'wildignore' */
- if (argvars[1].v_type != VAR_UNKNOWN && get_tv_number(&argvars[1]))
+ if (argvars[1].v_type != VAR_UNKNOWN
+ && get_tv_number_chk(&argvars[1], &error))
flags |= WILD_KEEP_ALL;
- ExpandInit(&xpc);
- xpc.xp_context = EXPAND_FILES;
- rettv->vval.v_string = ExpandOne(&xpc, s, NULL, flags, WILD_ALL);
- ExpandCleanup(&xpc);
+ if (!error)
+ {
+ ExpandInit(&xpc);
+ xpc.xp_context = EXPAND_FILES;
+ rettv->vval.v_string = ExpandOne(&xpc, s, NULL, flags, WILD_ALL);
+ ExpandCleanup(&xpc);
+ }
+ else
+ rettv->vval.v_string = NULL;
}
}
@@ -7809,6 +7974,7 @@ f_extend(argvars, rettv)
list_T *l1, *l2;
listitem_T *item;
long before;
+ int error = FALSE;
l1 = argvars[0].vval.v_list;
l2 = argvars[1].vval.v_list;
@@ -7817,7 +7983,10 @@ f_extend(argvars, rettv)
{
if (argvars[2].v_type != VAR_UNKNOWN)
{
- before = get_tv_number(&argvars[2]);
+ before = get_tv_number_chk(&argvars[2], &error);
+ if (error)
+ return; /* type error; errmsg already given */
+
if (before == l1->lv_len)
item = NULL;
else
@@ -7857,7 +8026,9 @@ f_extend(argvars, rettv)
{
static char *(av[]) = {"keep", "force", "error"};
- action = get_tv_string(&argvars[2]);
+ action = get_tv_string_chk(&argvars[2]);
+ if (action == NULL)
+ return; /* type error; errmsg already given */
for (i = 0; i < 3; ++i)
if (STRCMP(action, av[i]) == 0)
break;
@@ -7963,22 +8134,30 @@ findfilendir(argvars, rettv, dir)
if (argvars[1].v_type != VAR_UNKNOWN)
{
- p = get_tv_string_buf(&argvars[1], pathbuf);
- if (*p != NUL)
- path = p;
+ p = get_tv_string_buf_chk(&argvars[1], pathbuf);
+ if (p == NULL)
+ count = -1; /* error */
+ else
+ {
+ if (*p != NUL)
+ path = p;
- if (argvars[2].v_type != VAR_UNKNOWN)
- count = get_tv_number(&argvars[2]);
+ if (argvars[2].v_type != VAR_UNKNOWN)
+ count = get_tv_number_chk(&argvars[2], NULL); /* -1: error */
+ }
}
- do
+ if (*fname != NUL && count >= 0)
{
- vim_free(fresult);
- fresult = find_file_in_path_option(first ? fname : NULL,
- first ? (int)STRLEN(fname) : 0,
- 0, first, path, dir, NULL);
- first = FALSE;
- } while (--count > 0 && fresult != NULL);
+ do
+ {
+ vim_free(fresult);
+ fresult = find_file_in_path_option(first ? fname : NULL,
+ first ? (int)STRLEN(fname) : 0,
+ 0, first, path, dir, NULL);
+ first = FALSE;
+ } while (--count > 0 && fresult != NULL);
+ }
rettv->vval.v_string = fresult;
#else
@@ -8073,53 +8252,60 @@ filter_map(argvars, rettv, map)
return;
}
- prepare_vimvar(VV_VAL, &save_val);
- expr = skipwhite(get_tv_string_buf(&argvars[1], buf));
-
- if (argvars[0].v_type == VAR_DICT)
+ expr = get_tv_string_buf_chk(&argvars[1], buf);
+ /* On type errors, the preceding call has already displayed an error
+ * message. Avoid a misleading error message for an empty string that
+ * was not passed as argument. */
+ if (expr != NULL)
{
- prepare_vimvar(VV_KEY, &save_key);
- vimvars[VV_KEY].vv_type = VAR_STRING;
+ prepare_vimvar(VV_VAL, &save_val);
+ expr = skipwhite(expr);
- ht = &d->dv_hashtab;
- hash_lock(ht);
- todo = ht->ht_used;
- for (hi = ht->ht_array; todo > 0; ++hi)
+ if (argvars[0].v_type == VAR_DICT)
{
- if (!HASHITEM_EMPTY(hi))
+ prepare_vimvar(VV_KEY, &save_key);
+ vimvars[VV_KEY].vv_type = VAR_STRING;
+
+ ht = &d->dv_hashtab;
+ hash_lock(ht);
+ todo = ht->ht_used;
+ for (hi = ht->ht_array; todo > 0; ++hi)
{
- --todo;
- di = HI2DI(hi);
- if (tv_check_lock(di->di_tv.v_lock, msg))
+ if (!HASHITEM_EMPTY(hi))
+ {
+ --todo;
+ di = HI2DI(hi);
+ if (tv_check_lock(di->di_tv.v_lock, msg))
+ break;
+ vimvars[VV_KEY].vv_str = vim_strsave(di->di_key);
+ if (filter_map_one(&di->di_tv, expr, map, &rem) == FAIL)
+ break;
+ if (!map && rem)
+ dictitem_remove(d, di);
+ clear_tv(&vimvars[VV_KEY].vv_tv);
+ }
+ }
+ hash_unlock(ht);
+
+ restore_vimvar(VV_KEY, &save_key);
+ }
+ else
+ {
+ for (li = l->lv_first; li != NULL; li = nli)
+ {
+ if (tv_check_lock(li->li_tv.v_lock, msg))
break;
- vimvars[VV_KEY].vv_str = vim_strsave(di->di_key);
- if (filter_map_one(&di->di_tv, expr, map, &rem) == FAIL)
+ nli = li->li_next;
+ if (filter_map_one(&li->li_tv, expr, map, &rem) == FAIL)
break;
if (!map && rem)
- dictitem_remove(d, di);
- clear_tv(&vimvars[VV_KEY].vv_tv);
+ listitem_remove(l, li);
}
}
- hash_unlock(ht);
- restore_vimvar(VV_KEY, &save_key);
- }
- else
- {
- for (li = l->lv_first; li != NULL; li = nli)
- {
- if (tv_check_lock(li->li_tv.v_lock, msg))
- break;
- nli = li->li_next;
- if (filter_map_one(&li->li_tv, expr, map, &rem) == FAIL)
- break;
- if (!map && rem)
- listitem_remove(l, li);
- }
+ restore_vimvar(VV_VAL, &save_val);
}
- restore_vimvar(VV_VAL, &save_val);
-
copy_tv(&argvars[0], rettv);
}
@@ -8150,9 +8336,15 @@ filter_map_one(tv, expr, map, remp)
}
else
{
+ int error = FALSE;
+
/* filter(): when expr is zero remove the item */
- *remp = (get_tv_number(&rettv) == 0);
+ *remp = (get_tv_number_chk(&rettv, &error) == 0);
clear_tv(&rettv);
+ /* On type error, nothing has been removed; return FAIL to stop the
+ * loop. The error message was given by get_tv_number_chk(). */
+ if (error)
+ return FAIL;
}
clear_tv(&vimvars[VV_VAL].vv_tv);
return OK;
@@ -8206,11 +8398,15 @@ f_fnamemodify(argvars, rettv)
char_u *fbuf = NULL;
char_u buf[NUMBUFLEN];
- fname = get_tv_string(&argvars[0]);
- mods = get_tv_string_buf(&argvars[1], buf);
- len = (int)STRLEN(fname);
-
- (void)modify_fname(mods, &usedlen, &fname, &fbuf, &len);
+ fname = get_tv_string_chk(&argvars[0]);
+ mods = get_tv_string_buf_chk(&argvars[1], buf);
+ if (fname == NULL || mods == NULL)
+ fname = NULL;
+ else
+ {
+ len = (int)STRLEN(fname);
+ (void)modify_fname(mods, &usedlen, &fname, &fbuf, &len);
+ }
rettv->v_type = VAR_STRING;
if (fname == NULL)
@@ -8381,6 +8577,9 @@ f_foldtextresult(argvars, rettv)
rettv->vval.v_string = NULL;
#ifdef FEAT_FOLDING
lnum = get_tv_lnum(argvars);
+ /* treat illegal types and illegal string values for {lnum} the same */
+ if (lnum < 0)
+ lnum = 0;
fold_count = foldedCount(curwin, lnum, &foldinfo);
if (fold_count > 0)
{
@@ -8455,8 +8654,10 @@ f_get(argvars, rettv)
{
if ((l = argvars[0].vval.v_list) != NULL)
{
- li = list_find(l, get_tv_number(&argvars[1]));
- if (li != NULL)
+ int error = FALSE;
+
+ li = list_find(l, get_tv_number_chk(&argvars[1], &error));
+ if (!error && li != NULL)
tv = &li->li_tv;
}
}
@@ -8496,9 +8697,10 @@ f_getbufvar(argvars, rettv)
char_u *varname;
dictitem_T *v;
+ (void)get_tv_number(&argvars[0]); /* issue errmsg if type error */
+ varname = get_tv_string_chk(&argvars[1]);
++emsg_off;
buf = get_buf_tv(&argvars[0]);
- varname = get_tv_string(&argvars[1]);
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
@@ -8518,6 +8720,11 @@ f_getbufvar(argvars, rettv)
}
else
{
+ if (*varname == NUL)
+ /* let getbufvar({nr}, "") return the "b:" dictionary. The
+ * scope prefix before the NUL byte is required by
+ * find_var_in_ht(). */
+ varname = (char_u *)"b:" + 2;
/* look up the variable */
v = find_var_in_ht(&buf->b_vars.dv_hashtab, varname, FALSE);
if (v != NULL)
@@ -8537,17 +8744,18 @@ f_getchar(argvars, rettv)
typval_T *rettv;
{
varnumber_T n;
+ int error = FALSE;
++no_mapping;
++allow_keys;
if (argvars[0].v_type == VAR_UNKNOWN)
/* getchar(): blocking wait. */
n = safe_vgetc();
- else if (get_tv_number(&argvars[0]) == 1)
+ else if (get_tv_number_chk(&argvars[0], &error) == 1)
/* getchar(1): only check if char avail */
n = vpeekc();
- else if (vpeekc() == NUL)
- /* getchar(0) and no char avail: return zero */
+ else if (error || vpeekc() == NUL)
+ /* illegal argument or getchar(0) and no char avail: return zero */
n = 0;
else
/* getchar(0) and char avail: return char */
@@ -8858,8 +9066,9 @@ f_getline(argvars, rettv)
listitem_T *li;
lnum = get_tv_lnum(argvars);
-
- if (argvars[1].v_type == VAR_UNKNOWN)
+ if (lnum < 0)
+ rettv->vval.v_number = 0; /* failure; error message already given */
+ else if (argvars[1].v_type == VAR_UNKNOWN)
{
if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count)
p = ml_get(lnum);
@@ -8874,7 +9083,8 @@ f_getline(argvars, rettv)
end = get_tv_lnum(&argvars[1]);
if (end < lnum)
{
- EMSG(_(e_invrange));
+ if (end >= 0) /* else: error message already given */
+ EMSG(_(e_invrange));
rettv->vval.v_number = 0;
}
else
@@ -8945,12 +9155,14 @@ f_getreg(argvars, rettv)
char_u *strregname;
int regname;
int arg2 = FALSE;
+ int error = FALSE;
if (argvars[0].v_type != VAR_UNKNOWN)
{
- strregname = get_tv_string(&argvars[0]);
+ strregname = get_tv_string_chk(&argvars[0]);
+ error = strregname == NULL;
if (argvars[1].v_type != VAR_UNKNOWN)
- arg2 = get_tv_number(&argvars[1]);
+ arg2 = get_tv_number_chk(&argvars[1], &error);
}
else
strregname = vimvars[VV_REG].vv_str;
@@ -8959,7 +9171,8 @@ f_getreg(argvars, rettv)
regname = '"';
rettv->v_type = VAR_STRING;
- rettv->vval.v_string = get_reg_contents(regname, TRUE, arg2);
+ rettv->vval.v_string = error ? NULL :
+ get_reg_contents(regname, TRUE, arg2);
}
/*
@@ -8976,7 +9189,15 @@ f_getregtype(argvars, rettv)
long reglen = 0;
if (argvars[0].v_type != VAR_UNKNOWN)
- strregname = get_tv_string(&argvars[0]);
+ {
+ strregname = get_tv_string_chk(&argvars[0]);
+ if (strregname == NULL) /* type error; errmsg already given */
+ {
+ rettv->v_type = VAR_STRING;
+ rettv->vval.v_string = NULL;
+ return;
+ }
+ }
else
/* Default to v:register */
strregname = vimvars[VV_REG].vv_str;
@@ -9056,9 +9277,9 @@ f_getwinvar(argvars, rettv)
char_u *varname;
dictitem_T *v;
- ++emsg_off;
win = find_win_by_nr(&argvars[0]);
- varname = get_tv_string(&argvars[1]);
+ varname = get_tv_string_chk(&argvars[1]);
+ ++emsg_off;
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
@@ -9081,6 +9302,11 @@ f_getwinvar(argvars, rettv)
}
else
{
+ if (*varname == NUL)
+ /* let getwinvar({nr}, "") return the "w:" dictionary. The
+ * scope prefix before the NUL byte is required by
+ * find_var_in_ht(). */
+ varname = (char_u *)"w:" + 2;
/* look up the variable */
v = find_var_in_ht(&win->w_vars.dv_hashtab, varname, FALSE);
if (v != NULL)
@@ -9118,10 +9344,13 @@ f_globpath(argvars, rettv)
typval_T *rettv;
{
char_u buf1[NUMBUFLEN];
+ char_u *file = get_tv_string_buf_chk(&argvars[1], buf1);
rettv->v_type = VAR_STRING;
- rettv->vval.v_string = globpath(get_tv_string(&argvars[0]),
- get_tv_string_buf(&argvars[1], buf1));
+ if (file == NULL)
+ rettv->vval.v_string = NULL;
+ else
+ rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file);
}
/*
@@ -9697,7 +9926,8 @@ f_histadd(argvars, rettv)
if (check_restricted() || check_secure())
return;
#ifdef FEAT_CMDHIST
- histype = get_histtype(get_tv_string(&argvars[0]));