Mercurial > vim
annotate src/evalfunc.c @ 18982:26a583bf16df
Added tag v8.2.0051 for changeset 25a60d11adc2650ce554b95540e485b9ed9e24ac
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 28 Dec 2019 14:15:04 +0100 |
parents | bf8eb950df61 |
children | dd9ab0674eec |
rev | line source |
---|---|
10042
4aead6a9b7a9
commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents:
10009
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 * |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3 * VIM - Vi IMproved by Bram Moolenaar |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4 * |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 * Do ":help uganda" in Vim to read copying and usage conditions. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 * Do ":help credits" in Vim to see a list of people who contributed. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 * See README.txt for an overview of the Vim source code. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 * evalfunc.c: Builtin functions |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 #define USING_FLOAT_STUFF |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 #include "vim.h" |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 #if defined(FEAT_EVAL) || defined(PROTO) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
19 #ifdef VMS |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 # include <float.h> |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
22 |
18669
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
23 #if defined(MACOS_X) |
17893
e4d3b6c466d4
patch 8.1.1943: more code can be moved to evalvars.c
Bram Moolenaar <Bram@vim.org>
parents:
17873
diff
changeset
|
24 # include <time.h> // for time_t |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
26 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
27 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
28 static void f_abs(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 static void f_acos(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
30 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 static void f_and(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 static void f_asin(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 static void f_atan(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
35 static void f_atan2(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
36 #endif |
11014
fb2bcfa6a8de
patch 8.0.0396: 'balloonexpr' only works synchronously
Christian Brabandt <cb@256bit.org>
parents:
11006
diff
changeset
|
37 #ifdef FEAT_BEVAL |
16600
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
38 static void f_balloon_gettext(typval_T *argvars, typval_T *rettv); |
11014
fb2bcfa6a8de
patch 8.0.0396: 'balloonexpr' only works synchronously
Christian Brabandt <cb@256bit.org>
parents:
11006
diff
changeset
|
39 static void f_balloon_show(typval_T *argvars, typval_T *rettv); |
12885
10cb5c3df3f5
patch 8.0.1319: can't build GUI on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12883
diff
changeset
|
40 # if defined(FEAT_BEVAL_TERM) |
12883
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
41 static void f_balloon_split(typval_T *argvars, typval_T *rettv); |
12885
10cb5c3df3f5
patch 8.0.1319: can't build GUI on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12883
diff
changeset
|
42 # endif |
11014
fb2bcfa6a8de
patch 8.0.0396: 'balloonexpr' only works synchronously
Christian Brabandt <cb@256bit.org>
parents:
11006
diff
changeset
|
43 #endif |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
44 static void f_byte2line(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 static void byteidx(typval_T *argvars, typval_T *rettv, int comp); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 static void f_byteidx(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 static void f_byteidxcomp(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
48 static void f_call(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
49 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
50 static void f_ceil(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
51 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
52 static void f_changenr(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 static void f_char2nr(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
54 static void f_col(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
55 static void f_confirm(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
56 static void f_copy(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
57 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
58 static void f_cos(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 static void f_cosh(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 static void f_cursor(typval_T *argsvars, typval_T *rettv); |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
62 #ifdef MSWIN |
14147
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
63 static void f_debugbreak(typval_T *argvars, typval_T *rettv); |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
64 #endif |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
65 static void f_deepcopy(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
66 static void f_did_filetype(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
67 static void f_empty(typval_T *argvars, typval_T *rettv); |
16604
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
68 static void f_environ(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
69 static void f_escape(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
70 static void f_eval(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
71 static void f_eventhandler(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
72 static void f_execute(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
73 static void f_exists(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
74 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
75 static void f_exp(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
76 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
77 static void f_expand(typval_T *argvars, typval_T *rettv); |
17020
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
78 static void f_expandcmd(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
79 static void f_feedkeys(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
80 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
81 static void f_float2nr(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
82 static void f_floor(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
83 static void f_fmod(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
84 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
85 static void f_fnameescape(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
86 static void f_foreground(typval_T *argvars, typval_T *rettv); |
9723
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
87 static void f_funcref(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
88 static void f_function(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
89 static void f_garbagecollect(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
90 static void f_get(typval_T *argvars, typval_T *rettv); |
13280
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
91 static void f_getchangelist(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
92 static void f_getcharsearch(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
93 static void f_getcmdwintype(typval_T *argvars, typval_T *rettv); |
16604
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
94 static void f_getenv(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
95 static void f_getfontname(typval_T *argvars, typval_T *rettv); |
13246
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
96 static void f_getjumplist(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
97 static void f_getpid(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
98 static void f_getcurpos(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
99 static void f_getpos(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
100 static void f_getreg(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
101 static void f_getregtype(typval_T *argvars, typval_T *rettv); |
15016
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
102 static void f_gettagstack(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
103 static void f_has(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
104 static void f_haslocaldir(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
105 static void f_hasmapto(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
106 static void f_hlID(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
107 static void f_hlexists(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
108 static void f_hostname(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
109 static void f_iconv(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
110 static void f_index(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
111 static void f_input(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
112 static void f_inputdialog(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
113 static void f_inputlist(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
114 static void f_inputrestore(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
115 static void f_inputsave(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
116 static void f_inputsecret(typval_T *argvars, typval_T *rettv); |
18699
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
18687
diff
changeset
|
117 static void f_interrupt(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
118 static void f_invert(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
119 static void f_islocked(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
120 #if defined(FEAT_FLOAT) && defined(HAVE_MATH_H) |
16213
2c33b119ba92
patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
121 static void f_isinf(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
122 static void f_isnan(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
123 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
124 static void f_last_buffer_nr(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
125 static void f_len(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
126 static void f_libcall(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
127 static void f_libcallnr(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
128 static void f_line(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
129 static void f_line2byte(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
130 static void f_localtime(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
131 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
132 static void f_log(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
133 static void f_log10(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
134 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
135 #ifdef FEAT_LUA |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
136 static void f_luaeval(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
137 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
138 static void f_maparg(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
139 static void f_mapcheck(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
140 static void f_match(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
141 static void f_matchend(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
142 static void f_matchlist(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
143 static void f_matchstr(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
144 static void f_matchstrpos(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
145 static void f_max(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
146 static void f_min(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
147 #ifdef FEAT_MZSCHEME |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
148 static void f_mzeval(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
149 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
150 static void f_nextnonblank(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
151 static void f_nr2char(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
152 static void f_or(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
153 #ifdef FEAT_PERL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
154 static void f_perleval(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
155 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
156 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
157 static void f_pow(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
158 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
159 static void f_prevnonblank(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
160 static void f_printf(typval_T *argvars, typval_T *rettv); |
17756
a7afcea6f40a
patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17744
diff
changeset
|
161 static void f_pum_getpos(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
162 static void f_pumvisible(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
163 #ifdef FEAT_PYTHON3 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
164 static void f_py3eval(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
165 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
166 #ifdef FEAT_PYTHON |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
167 static void f_pyeval(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
168 #endif |
10722
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
169 #if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
170 static void f_pyxeval(typval_T *argvars, typval_T *rettv); |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
171 #endif |
18701
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
172 static void f_rand(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
173 static void f_range(typval_T *argvars, typval_T *rettv); |
14004
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
174 static void f_reg_executing(typval_T *argvars, typval_T *rettv); |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
175 static void f_reg_recording(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
176 static void f_reltime(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
177 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
178 static void f_reltimefloat(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
179 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
180 static void f_reltimestr(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
181 static void f_remote_expr(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
182 static void f_remote_foreground(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
183 static void f_remote_peek(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
184 static void f_remote_read(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
185 static void f_remote_send(typval_T *argvars, typval_T *rettv); |
11177
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
186 static void f_remote_startserver(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
187 static void f_rename(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
188 static void f_repeat(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
189 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
190 static void f_round(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
191 #endif |
16103
518f44125207
patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents:
16078
diff
changeset
|
192 #ifdef FEAT_RUBY |
518f44125207
patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents:
16078
diff
changeset
|
193 static void f_rubyeval(typval_T *argvars, typval_T *rettv); |
518f44125207
patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents:
16078
diff
changeset
|
194 #endif |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
195 static void f_screenattr(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
196 static void f_screenchar(typval_T *argvars, typval_T *rettv); |
16133
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
197 static void f_screenchars(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
198 static void f_screencol(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
199 static void f_screenrow(typval_T *argvars, typval_T *rettv); |
16133
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
200 static void f_screenstring(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
201 static void f_search(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
202 static void f_searchdecl(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
203 static void f_searchpair(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
204 static void f_searchpairpos(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
205 static void f_searchpos(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
206 static void f_server2client(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
207 static void f_serverlist(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
208 static void f_setcharsearch(typval_T *argvars, typval_T *rettv); |
16604
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
209 static void f_setenv(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
210 static void f_setfperm(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
211 static void f_setpos(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
212 static void f_setreg(typval_T *argvars, typval_T *rettv); |
15016
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
213 static void f_settagstack(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
214 #ifdef FEAT_CRYPT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
215 static void f_sha256(typval_T *argvars, typval_T *rettv); |
17966
46f95606b9ec
patch 8.1.1979: code for handling file names is spread out
Bram Moolenaar <Bram@vim.org>
parents:
17964
diff
changeset
|
216 #endif |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
217 static void f_shellescape(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
218 static void f_shiftwidth(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
219 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
220 static void f_sin(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
221 static void f_sinh(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
222 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
223 static void f_soundfold(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
224 static void f_spellbadword(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
225 static void f_spellsuggest(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
226 static void f_split(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
227 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
228 static void f_sqrt(typval_T *argvars, typval_T *rettv); |
18738
e0cd10f750e7
patch 8.1.2359: cannot build without FEAT_FLOAT
Bram Moolenaar <Bram@vim.org>
parents:
18732
diff
changeset
|
229 #endif |
18701
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
230 static void f_srand(typval_T *argvars, typval_T *rettv); |
18738
e0cd10f750e7
patch 8.1.2359: cannot build without FEAT_FLOAT
Bram Moolenaar <Bram@vim.org>
parents:
18732
diff
changeset
|
231 #ifdef FEAT_FLOAT |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
232 static void f_str2float(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
233 #endif |
16235
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
234 static void f_str2list(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
235 static void f_str2nr(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
236 static void f_strchars(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
237 #ifdef HAVE_STRFTIME |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
238 static void f_strftime(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
239 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
240 static void f_strgetchar(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
241 static void f_stridx(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
242 static void f_strlen(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
243 static void f_strcharpart(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
244 static void f_strpart(typval_T *argvars, typval_T *rettv); |
18669
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
245 #ifdef HAVE_STRPTIME |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
246 static void f_strptime(typval_T *argvars, typval_T *rettv); |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
247 #endif |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
248 static void f_strridx(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
249 static void f_strtrans(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
250 static void f_strdisplaywidth(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
251 static void f_strwidth(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
252 static void f_submatch(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
253 static void f_substitute(typval_T *argvars, typval_T *rettv); |
14599
72d6f6f7ead7
patch 8.1.0313: information about a swap file is unavailable
Christian Brabandt <cb@256bit.org>
parents:
14587
diff
changeset
|
254 static void f_swapinfo(typval_T *argvars, typval_T *rettv); |
14778
20653d6f3d95
patch 8.1.0401: can't get swap name of another buffer
Christian Brabandt <cb@256bit.org>
parents:
14756
diff
changeset
|
255 static void f_swapname(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
256 static void f_synID(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
257 static void f_synIDattr(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
258 static void f_synIDtrans(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
259 static void f_synstack(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
260 static void f_synconcealed(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
261 static void f_tabpagebuflist(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
262 static void f_taglist(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
263 static void f_tagfiles(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
264 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
265 static void f_tan(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
266 static void f_tanh(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
267 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
268 static void f_tolower(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
269 static void f_toupper(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
270 static void f_tr(typval_T *argvars, typval_T *rettv); |
13513
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
271 static void f_trim(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
272 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
273 static void f_trunc(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
274 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
275 static void f_type(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
276 static void f_virtcol(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
277 static void f_visualmode(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
278 static void f_wildmenumode(typval_T *argvars, typval_T *rettv); |
18973
bf8eb950df61
patch 8.2.0047: cannot skip tests for specific MS-Windows platform
Bram Moolenaar <Bram@vim.org>
parents:
18777
diff
changeset
|
279 static void f_windowsversion(typval_T *argvars, typval_T *rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
280 static void f_wordcount(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
281 static void f_xor(typval_T *argvars, typval_T *rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
282 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
283 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
284 * Array with names and number of arguments of all internal functions |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
285 * MUST BE KEPT SORTED IN strcmp() ORDER FOR BINARY SEARCH! |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
286 */ |
17612
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
287 typedef struct |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
288 { |
17620
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
289 char *f_name; // function name |
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
290 char f_min_argc; // minimal number of arguments |
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
291 char f_max_argc; // maximal number of arguments |
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
292 char f_argtype; // for method: FEARG_ values |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
293 void (*f_func)(typval_T *args, typval_T *rvar); |
17620
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
294 // implementation of function |
17612
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
295 } funcentry_T; |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
296 |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
297 // values for f_argtype; zero means it cannot be used as a method |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
298 #define FEARG_1 1 // base is the first argument |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
299 #define FEARG_2 2 // base is the second argument |
17728
68ea27d26d5b
patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17704
diff
changeset
|
300 #define FEARG_3 3 // base is the third argument |
18000
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
301 #define FEARG_4 4 // base is the fourth argument |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
302 #define FEARG_LAST 9 // base is the last argument |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
303 |
17612
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
304 static funcentry_T global_functions[] = |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
305 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
306 #ifdef FEAT_FLOAT |
17765
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
307 {"abs", 1, 1, FEARG_1, f_abs}, |
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
308 {"acos", 1, 1, FEARG_1, f_acos}, // WJMc |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
309 #endif |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
310 {"add", 2, 2, FEARG_1, f_add}, |
17783
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
311 {"and", 2, 2, FEARG_1, f_and}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
312 {"append", 2, 2, FEARG_LAST, f_append}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
313 {"appendbufline", 3, 3, FEARG_LAST, f_appendbufline}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
314 {"argc", 0, 1, 0, f_argc}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
315 {"argidx", 0, 0, 0, f_argidx}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
316 {"arglistid", 0, 2, 0, f_arglistid}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
317 {"argv", 0, 2, 0, f_argv}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
318 #ifdef FEAT_FLOAT |
17765
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
319 {"asin", 1, 1, FEARG_1, f_asin}, // WJMc |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
320 #endif |
17728
68ea27d26d5b
patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17704
diff
changeset
|
321 {"assert_beeps", 1, 2, FEARG_1, f_assert_beeps}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
322 {"assert_equal", 2, 3, FEARG_2, f_assert_equal}, |
17825
ce993ba17adb
patch 8.1.1909: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17817
diff
changeset
|
323 {"assert_equalfile", 2, 2, FEARG_1, f_assert_equalfile}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
324 {"assert_exception", 1, 2, 0, f_assert_exception}, |
17728
68ea27d26d5b
patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17704
diff
changeset
|
325 {"assert_fails", 1, 3, FEARG_1, f_assert_fails}, |
68ea27d26d5b
patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17704
diff
changeset
|
326 {"assert_false", 1, 2, FEARG_1, f_assert_false}, |
68ea27d26d5b
patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17704
diff
changeset
|
327 {"assert_inrange", 3, 4, FEARG_3, f_assert_inrange}, |
68ea27d26d5b
patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17704
diff
changeset
|
328 {"assert_match", 2, 3, FEARG_2, f_assert_match}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
329 {"assert_notequal", 2, 3, FEARG_2, f_assert_notequal}, |
17728
68ea27d26d5b
patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17704
diff
changeset
|
330 {"assert_notmatch", 2, 3, FEARG_2, f_assert_notmatch}, |
17825
ce993ba17adb
patch 8.1.1909: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17817
diff
changeset
|
331 {"assert_report", 1, 1, FEARG_1, f_assert_report}, |
17728
68ea27d26d5b
patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17704
diff
changeset
|
332 {"assert_true", 1, 2, FEARG_1, f_assert_true}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
333 #ifdef FEAT_FLOAT |
17765
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
334 {"atan", 1, 1, FEARG_1, f_atan}, |
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
335 {"atan2", 2, 2, FEARG_1, f_atan2}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
336 #endif |
11014
fb2bcfa6a8de
patch 8.0.0396: 'balloonexpr' only works synchronously
Christian Brabandt <cb@256bit.org>
parents:
11006
diff
changeset
|
337 #ifdef FEAT_BEVAL |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
338 {"balloon_gettext", 0, 0, 0, f_balloon_gettext}, |
17783
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
339 {"balloon_show", 1, 1, FEARG_1, f_balloon_show}, |
12885
10cb5c3df3f5
patch 8.0.1319: can't build GUI on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12883
diff
changeset
|
340 # if defined(FEAT_BEVAL_TERM) |
17783
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
341 {"balloon_split", 1, 1, FEARG_1, f_balloon_split}, |
12885
10cb5c3df3f5
patch 8.0.1319: can't build GUI on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12883
diff
changeset
|
342 # endif |
11014
fb2bcfa6a8de
patch 8.0.0396: 'balloonexpr' only works synchronously
Christian Brabandt <cb@256bit.org>
parents:
11006
diff
changeset
|
343 #endif |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
344 {"browse", 4, 4, 0, f_browse}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
345 {"browsedir", 2, 2, 0, f_browsedir}, |
17783
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
346 {"bufadd", 1, 1, FEARG_1, f_bufadd}, |
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
347 {"bufexists", 1, 1, FEARG_1, f_bufexists}, |
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
348 {"buffer_exists", 1, 1, FEARG_1, f_bufexists}, // obsolete |
17855
285f7a700185
patch 8.1.1924: using empty string for current buffer is unexpected
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
349 {"buffer_name", 0, 1, FEARG_1, f_bufname}, // obsolete |
285f7a700185
patch 8.1.1924: using empty string for current buffer is unexpected
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
350 {"buffer_number", 0, 1, FEARG_1, f_bufnr}, // obsolete |
17783
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
351 {"buflisted", 1, 1, FEARG_1, f_buflisted}, |
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
352 {"bufload", 1, 1, FEARG_1, f_bufload}, |
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
353 {"bufloaded", 1, 1, FEARG_1, f_bufloaded}, |
17855
285f7a700185
patch 8.1.1924: using empty string for current buffer is unexpected
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
354 {"bufname", 0, 1, FEARG_1, f_bufname}, |
285f7a700185
patch 8.1.1924: using empty string for current buffer is unexpected
Bram Moolenaar <Bram@vim.org>
parents:
17849
diff
changeset
|
355 {"bufnr", 0, 2, FEARG_1, f_bufnr}, |
17825
ce993ba17adb
patch 8.1.1909: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17817
diff
changeset
|
356 {"bufwinid", 1, 1, FEARG_1, f_bufwinid}, |
ce993ba17adb
patch 8.1.1909: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17817
diff
changeset
|
357 {"bufwinnr", 1, 1, FEARG_1, f_bufwinnr}, |
17829
1090d6637cfd
patch 8.1.1911: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17825
diff
changeset
|
358 {"byte2line", 1, 1, FEARG_1, f_byte2line}, |
1090d6637cfd
patch 8.1.1911: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17825
diff
changeset
|
359 {"byteidx", 2, 2, FEARG_1, f_byteidx}, |
1090d6637cfd
patch 8.1.1911: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17825
diff
changeset
|
360 {"byteidxcomp", 2, 2, FEARG_1, f_byteidxcomp}, |
1090d6637cfd
patch 8.1.1911: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17825
diff
changeset
|
361 {"call", 2, 3, FEARG_1, f_call}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
362 #ifdef FEAT_FLOAT |
17765
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
363 {"ceil", 1, 1, FEARG_1, f_ceil}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
364 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
365 #ifdef FEAT_JOB_CHANNEL |
17831
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
366 {"ch_canread", 1, 1, FEARG_1, f_ch_canread}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
367 {"ch_close", 1, 1, FEARG_1, f_ch_close}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
368 {"ch_close_in", 1, 1, FEARG_1, f_ch_close_in}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
369 {"ch_evalexpr", 2, 3, FEARG_1, f_ch_evalexpr}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
370 {"ch_evalraw", 2, 3, FEARG_1, f_ch_evalraw}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
371 {"ch_getbufnr", 2, 2, FEARG_1, f_ch_getbufnr}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
372 {"ch_getjob", 1, 1, FEARG_1, f_ch_getjob}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
373 {"ch_info", 1, 1, FEARG_1, f_ch_info}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
374 {"ch_log", 1, 2, FEARG_1, f_ch_log}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
375 {"ch_logfile", 1, 2, FEARG_1, f_ch_logfile}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
376 {"ch_open", 1, 2, FEARG_1, f_ch_open}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
377 {"ch_read", 1, 2, FEARG_1, f_ch_read}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
378 {"ch_readblob", 1, 2, FEARG_1, f_ch_readblob}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
379 {"ch_readraw", 1, 2, FEARG_1, f_ch_readraw}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
380 {"ch_sendexpr", 2, 3, FEARG_1, f_ch_sendexpr}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
381 {"ch_sendraw", 2, 3, FEARG_1, f_ch_sendraw}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
382 {"ch_setoptions", 2, 2, FEARG_1, f_ch_setoptions}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
383 {"ch_status", 1, 2, FEARG_1, f_ch_status}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
384 #endif |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
385 {"changenr", 0, 0, 0, f_changenr}, |
17837
f71ee7b04f0b
patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17831
diff
changeset
|
386 {"char2nr", 1, 2, FEARG_1, f_char2nr}, |
f71ee7b04f0b
patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17831
diff
changeset
|
387 {"chdir", 1, 1, FEARG_1, f_chdir}, |
f71ee7b04f0b
patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17831
diff
changeset
|
388 {"cindent", 1, 1, FEARG_1, f_cindent}, |
f71ee7b04f0b
patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17831
diff
changeset
|
389 {"clearmatches", 0, 1, FEARG_1, f_clearmatches}, |
f71ee7b04f0b
patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17831
diff
changeset
|
390 {"col", 1, 1, FEARG_1, f_col}, |
f71ee7b04f0b
patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17831
diff
changeset
|
391 {"complete", 2, 2, FEARG_2, f_complete}, |
f71ee7b04f0b
patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17831
diff
changeset
|
392 {"complete_add", 1, 1, FEARG_1, f_complete_add}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
393 {"complete_check", 0, 0, 0, f_complete_check}, |
17837
f71ee7b04f0b
patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17831
diff
changeset
|
394 {"complete_info", 0, 1, FEARG_1, f_complete_info}, |
f71ee7b04f0b
patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17831
diff
changeset
|
395 {"confirm", 1, 4, FEARG_1, f_confirm}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
396 {"copy", 1, 1, FEARG_1, f_copy}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
397 #ifdef FEAT_FLOAT |
17765
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
398 {"cos", 1, 1, FEARG_1, f_cos}, |
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
399 {"cosh", 1, 1, FEARG_1, f_cosh}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
400 #endif |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
401 {"count", 2, 4, FEARG_1, f_count}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
402 {"cscope_connection",0,3, 0, f_cscope_connection}, |
17837
f71ee7b04f0b
patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17831
diff
changeset
|
403 {"cursor", 1, 3, FEARG_1, f_cursor}, |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
404 #ifdef MSWIN |
17837
f71ee7b04f0b
patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17831
diff
changeset
|
405 {"debugbreak", 1, 1, FEARG_1, f_debugbreak}, |
f71ee7b04f0b
patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17831
diff
changeset
|
406 #endif |
f71ee7b04f0b
patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17831
diff
changeset
|
407 {"deepcopy", 1, 2, FEARG_1, f_deepcopy}, |
f71ee7b04f0b
patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17831
diff
changeset
|
408 {"delete", 1, 2, FEARG_1, f_delete}, |
f71ee7b04f0b
patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17831
diff
changeset
|
409 {"deletebufline", 2, 3, FEARG_1, f_deletebufline}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
410 {"did_filetype", 0, 0, 0, f_did_filetype}, |
17837
f71ee7b04f0b
patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17831
diff
changeset
|
411 {"diff_filler", 1, 1, FEARG_1, f_diff_filler}, |
f71ee7b04f0b
patch 8.1.1915: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17831
diff
changeset
|
412 {"diff_hlID", 2, 2, FEARG_1, f_diff_hlID}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
413 {"empty", 1, 1, FEARG_1, f_empty}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
414 {"environ", 0, 0, 0, f_environ}, |
17849
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
415 {"escape", 2, 2, FEARG_1, f_escape}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
416 {"eval", 1, 1, FEARG_1, f_eval}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
417 {"eventhandler", 0, 0, 0, f_eventhandler}, |
17849
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
418 {"executable", 1, 1, FEARG_1, f_executable}, |
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
419 {"execute", 1, 2, FEARG_1, f_execute}, |
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
420 {"exepath", 1, 1, FEARG_1, f_exepath}, |
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
421 {"exists", 1, 1, FEARG_1, f_exists}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
422 #ifdef FEAT_FLOAT |
17765
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
423 {"exp", 1, 1, FEARG_1, f_exp}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
424 #endif |
17849
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
425 {"expand", 1, 3, FEARG_1, f_expand}, |
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
426 {"expandcmd", 1, 1, FEARG_1, f_expandcmd}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
427 {"extend", 2, 3, FEARG_1, f_extend}, |
17849
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
428 {"feedkeys", 1, 2, FEARG_1, f_feedkeys}, |
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
429 {"file_readable", 1, 1, FEARG_1, f_filereadable}, // obsolete |
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
430 {"filereadable", 1, 1, FEARG_1, f_filereadable}, |
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
431 {"filewritable", 1, 1, FEARG_1, f_filewritable}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
432 {"filter", 2, 2, FEARG_1, f_filter}, |
17849
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
433 {"finddir", 1, 3, FEARG_1, f_finddir}, |
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
434 {"findfile", 1, 3, FEARG_1, f_findfile}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
435 #ifdef FEAT_FLOAT |
17765
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
436 {"float2nr", 1, 1, FEARG_1, f_float2nr}, |
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
437 {"floor", 1, 1, FEARG_1, f_floor}, |
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
438 {"fmod", 2, 2, FEARG_1, f_fmod}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
439 #endif |
17849
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
440 {"fnameescape", 1, 1, FEARG_1, f_fnameescape}, |
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
441 {"fnamemodify", 2, 2, FEARG_1, f_fnamemodify}, |
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
442 {"foldclosed", 1, 1, FEARG_1, f_foldclosed}, |
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
443 {"foldclosedend", 1, 1, FEARG_1, f_foldclosedend}, |
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
444 {"foldlevel", 1, 1, FEARG_1, f_foldlevel}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
445 {"foldtext", 0, 0, 0, f_foldtext}, |
17849
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
446 {"foldtextresult", 1, 1, FEARG_1, f_foldtextresult}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
447 {"foreground", 0, 0, 0, f_foreground}, |
17849
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
448 {"funcref", 1, 3, FEARG_1, f_funcref}, |
73ddc462979d
patch 8.1.1921: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17837
diff
changeset
|
449 {"function", 1, 3, FEARG_1, f_function}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
450 {"garbagecollect", 0, 1, 0, f_garbagecollect}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
451 {"get", 2, 3, FEARG_1, f_get}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
452 {"getbufinfo", 0, 1, 0, f_getbufinfo}, |
17857
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
453 {"getbufline", 2, 3, FEARG_1, f_getbufline}, |
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
454 {"getbufvar", 2, 3, FEARG_1, f_getbufvar}, |
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
455 {"getchangelist", 0, 1, FEARG_1, f_getchangelist}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
456 {"getchar", 0, 1, 0, f_getchar}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
457 {"getcharmod", 0, 0, 0, f_getcharmod}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
458 {"getcharsearch", 0, 0, 0, f_getcharsearch}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
459 {"getcmdline", 0, 0, 0, f_getcmdline}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
460 {"getcmdpos", 0, 0, 0, f_getcmdpos}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
461 {"getcmdtype", 0, 0, 0, f_getcmdtype}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
462 {"getcmdwintype", 0, 0, 0, f_getcmdwintype}, |
17857
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
463 {"getcompletion", 2, 3, FEARG_1, f_getcompletion}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
464 {"getcurpos", 0, 0, 0, f_getcurpos}, |
17857
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
465 {"getcwd", 0, 2, FEARG_1, f_getcwd}, |
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
466 {"getenv", 1, 1, FEARG_1, f_getenv}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
467 {"getfontname", 0, 1, 0, f_getfontname}, |
17857
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
468 {"getfperm", 1, 1, FEARG_1, f_getfperm}, |
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
469 {"getfsize", 1, 1, FEARG_1, f_getfsize}, |
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
470 {"getftime", 1, 1, FEARG_1, f_getftime}, |
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
471 {"getftype", 1, 1, FEARG_1, f_getftype}, |
18008
8ae333756614
patch 8.1.2000: plugin cannot get the current IME status
Bram Moolenaar <Bram@vim.org>
parents:
18000
diff
changeset
|
472 {"getimstatus", 0, 0, 0, f_getimstatus}, |
17857
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
473 {"getjumplist", 0, 2, FEARG_1, f_getjumplist}, |
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
474 {"getline", 1, 2, FEARG_1, f_getline}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
475 {"getloclist", 1, 2, 0, f_getloclist}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
476 {"getmatches", 0, 1, 0, f_getmatches}, |
18623
3089b422b9dc
patch 8.1.2304: cannot get the mouse position when getting a mouse click
Bram Moolenaar <Bram@vim.org>
parents:
18576
diff
changeset
|
477 {"getmousepos", 0, 0, 0, f_getmousepos}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
478 {"getpid", 0, 0, 0, f_getpid}, |
17857
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
479 {"getpos", 1, 1, FEARG_1, f_getpos}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
480 {"getqflist", 0, 1, 0, f_getqflist}, |
17857
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
481 {"getreg", 0, 3, FEARG_1, f_getreg}, |
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
482 {"getregtype", 0, 1, FEARG_1, f_getregtype}, |
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
483 {"gettabinfo", 0, 1, FEARG_1, f_gettabinfo}, |
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
484 {"gettabvar", 2, 3, FEARG_1, f_gettabvar}, |
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
485 {"gettabwinvar", 3, 4, FEARG_1, f_gettabwinvar}, |
17912
9fac6d0de69a
patch 8.1.1952: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17893
diff
changeset
|
486 {"gettagstack", 0, 1, FEARG_1, f_gettagstack}, |
9fac6d0de69a
patch 8.1.1952: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17893
diff
changeset
|
487 {"getwininfo", 0, 1, FEARG_1, f_getwininfo}, |
9fac6d0de69a
patch 8.1.1952: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17893
diff
changeset
|
488 {"getwinpos", 0, 1, FEARG_1, f_getwinpos}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
489 {"getwinposx", 0, 0, 0, f_getwinposx}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
490 {"getwinposy", 0, 0, 0, f_getwinposy}, |
17912
9fac6d0de69a
patch 8.1.1952: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17893
diff
changeset
|
491 {"getwinvar", 2, 3, FEARG_1, f_getwinvar}, |
9fac6d0de69a
patch 8.1.1952: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17893
diff
changeset
|
492 {"glob", 1, 4, FEARG_1, f_glob}, |
9fac6d0de69a
patch 8.1.1952: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17893
diff
changeset
|
493 {"glob2regpat", 1, 1, FEARG_1, f_glob2regpat}, |
9fac6d0de69a
patch 8.1.1952: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17893
diff
changeset
|
494 {"globpath", 2, 5, FEARG_2, f_globpath}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
495 {"has", 1, 1, 0, f_has}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
496 {"has_key", 2, 2, FEARG_1, f_has_key}, |
17914
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
497 {"haslocaldir", 0, 2, FEARG_1, f_haslocaldir}, |
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
498 {"hasmapto", 1, 3, FEARG_1, f_hasmapto}, |
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
499 {"highlightID", 1, 1, FEARG_1, f_hlID}, // obsolete |
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
500 {"highlight_exists",1, 1, FEARG_1, f_hlexists}, // obsolete |
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
501 {"histadd", 2, 2, FEARG_2, f_histadd}, |
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
502 {"histdel", 1, 2, FEARG_1, f_histdel}, |
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
503 {"histget", 1, 2, FEARG_1, f_histget}, |
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
504 {"histnr", 1, 1, FEARG_1, f_histnr}, |
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
505 {"hlID", 1, 1, FEARG_1, f_hlID}, |
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
506 {"hlexists", 1, 1, FEARG_1, f_hlexists}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
507 {"hostname", 0, 0, 0, f_hostname}, |
17914
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
508 {"iconv", 3, 3, FEARG_1, f_iconv}, |
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
509 {"indent", 1, 1, FEARG_1, f_indent}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
510 {"index", 2, 4, FEARG_1, f_index}, |
17914
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
511 {"input", 1, 3, FEARG_1, f_input}, |
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
512 {"inputdialog", 1, 3, FEARG_1, f_inputdialog}, |
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
513 {"inputlist", 1, 1, FEARG_1, f_inputlist}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
514 {"inputrestore", 0, 0, 0, f_inputrestore}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
515 {"inputsave", 0, 0, 0, f_inputsave}, |
17914
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
516 {"inputsecret", 1, 2, FEARG_1, f_inputsecret}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
517 {"insert", 2, 3, FEARG_1, f_insert}, |
18699
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
18687
diff
changeset
|
518 {"interrupt", 0, 0, 0, f_interrupt}, |
17783
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
519 {"invert", 1, 1, FEARG_1, f_invert}, |
17914
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
520 {"isdirectory", 1, 1, FEARG_1, f_isdirectory}, |
16213
2c33b119ba92
patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
521 #if defined(FEAT_FLOAT) && defined(HAVE_MATH_H) |
17765
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
522 {"isinf", 1, 1, FEARG_1, f_isinf}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
523 #endif |
17914
af3d441845cd
patch 8.1.1953: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17912
diff
changeset
|
524 {"islocked", 1, 1, FEARG_1, f_islocked}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
525 #if defined(FEAT_FLOAT) && defined(HAVE_MATH_H) |
17765
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
526 {"isnan", 1, 1, FEARG_1, f_isnan}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
527 #endif |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
528 {"items", 1, 1, FEARG_1, f_items}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
529 #ifdef FEAT_JOB_CHANNEL |
17831
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
530 {"job_getchannel", 1, 1, FEARG_1, f_job_getchannel}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
531 {"job_info", 0, 1, FEARG_1, f_job_info}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
532 {"job_setoptions", 2, 2, FEARG_1, f_job_setoptions}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
533 {"job_start", 1, 2, FEARG_1, f_job_start}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
534 {"job_status", 1, 1, FEARG_1, f_job_status}, |
4ab97fdf7ff7
patch 8.1.1912: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17829
diff
changeset
|
535 {"job_stop", 1, 2, FEARG_1, f_job_stop}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
536 #endif |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
537 {"join", 1, 2, FEARG_1, f_join}, |
17916
2e53305f2239
patch 8.1.1954: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
538 {"js_decode", 1, 1, FEARG_1, f_js_decode}, |
2e53305f2239
patch 8.1.1954: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
539 {"js_encode", 1, 1, FEARG_1, f_js_encode}, |
2e53305f2239
patch 8.1.1954: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
540 {"json_decode", 1, 1, FEARG_1, f_json_decode}, |
2e53305f2239
patch 8.1.1954: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
541 {"json_encode", 1, 1, FEARG_1, f_json_encode}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
542 {"keys", 1, 1, FEARG_1, f_keys}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
543 {"last_buffer_nr", 0, 0, 0, f_last_buffer_nr}, // obsolete |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
544 {"len", 1, 1, FEARG_1, f_len}, |
17916
2e53305f2239
patch 8.1.1954: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
545 {"libcall", 3, 3, FEARG_3, f_libcall}, |
2e53305f2239
patch 8.1.1954: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
546 {"libcallnr", 3, 3, FEARG_3, f_libcallnr}, |
17942
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
547 {"line", 1, 2, FEARG_1, f_line}, |
17916
2e53305f2239
patch 8.1.1954: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
548 {"line2byte", 1, 1, FEARG_1, f_line2byte}, |
2e53305f2239
patch 8.1.1954: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
549 {"lispindent", 1, 1, FEARG_1, f_lispindent}, |
2e53305f2239
patch 8.1.1954: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
550 {"list2str", 1, 2, FEARG_1, f_list2str}, |
2e53305f2239
patch 8.1.1954: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
551 {"listener_add", 1, 2, FEARG_2, f_listener_add}, |
2e53305f2239
patch 8.1.1954: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
552 {"listener_flush", 0, 1, FEARG_1, f_listener_flush}, |
2e53305f2239
patch 8.1.1954: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
553 {"listener_remove", 1, 1, FEARG_1, f_listener_remove}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
554 {"localtime", 0, 0, 0, f_localtime}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
555 #ifdef FEAT_FLOAT |
17765
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
556 {"log", 1, 1, FEARG_1, f_log}, |
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
557 {"log10", 1, 1, FEARG_1, f_log10}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
558 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
559 #ifdef FEAT_LUA |
17916
2e53305f2239
patch 8.1.1954: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17914
diff
changeset
|
560 {"luaeval", 1, 2, FEARG_1, f_luaeval}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
561 #endif |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
562 {"map", 2, 2, FEARG_1, f_map}, |
17930
0cdb6ac20748
patch 8.1.1961: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17928
diff
changeset
|
563 {"maparg", 1, 4, FEARG_1, f_maparg}, |
0cdb6ac20748
patch 8.1.1961: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17928
diff
changeset
|
564 {"mapcheck", 1, 3, FEARG_1, f_mapcheck}, |
0cdb6ac20748
patch 8.1.1961: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17928
diff
changeset
|
565 {"match", 2, 4, FEARG_1, f_match}, |
0cdb6ac20748
patch 8.1.1961: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17928
diff
changeset
|
566 {"matchadd", 2, 5, FEARG_1, f_matchadd}, |
0cdb6ac20748
patch 8.1.1961: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17928
diff
changeset
|
567 {"matchaddpos", 2, 5, FEARG_1, f_matchaddpos}, |
0cdb6ac20748
patch 8.1.1961: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17928
diff
changeset
|
568 {"matcharg", 1, 1, FEARG_1, f_matcharg}, |
0cdb6ac20748
patch 8.1.1961: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17928
diff
changeset
|
569 {"matchdelete", 1, 2, FEARG_1, f_matchdelete}, |
0cdb6ac20748
patch 8.1.1961: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17928
diff
changeset
|
570 {"matchend", 2, 4, FEARG_1, f_matchend}, |
0cdb6ac20748
patch 8.1.1961: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17928
diff
changeset
|
571 {"matchlist", 2, 4, FEARG_1, f_matchlist}, |
0cdb6ac20748
patch 8.1.1961: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17928
diff
changeset
|
572 {"matchstr", 2, 4, FEARG_1, f_matchstr}, |
0cdb6ac20748
patch 8.1.1961: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17928
diff
changeset
|
573 {"matchstrpos", 2, 4, FEARG_1, f_matchstrpos}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
574 {"max", 1, 1, FEARG_1, f_max}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
575 {"min", 1, 1, FEARG_1, f_min}, |
17930
0cdb6ac20748
patch 8.1.1961: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17928
diff
changeset
|
576 {"mkdir", 1, 3, FEARG_1, f_mkdir}, |
0cdb6ac20748
patch 8.1.1961: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17928
diff
changeset
|
577 {"mode", 0, 1, FEARG_1, f_mode}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
578 #ifdef FEAT_MZSCHEME |
17930
0cdb6ac20748
patch 8.1.1961: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17928
diff
changeset
|
579 {"mzeval", 1, 1, FEARG_1, f_mzeval}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
580 #endif |
17976
6d11a0d5751d
patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17972
diff
changeset
|
581 {"nextnonblank", 1, 1, FEARG_1, f_nextnonblank}, |
6d11a0d5751d
patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17972
diff
changeset
|
582 {"nr2char", 1, 2, FEARG_1, f_nr2char}, |
17783
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
583 {"or", 2, 2, FEARG_1, f_or}, |
17976
6d11a0d5751d
patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17972
diff
changeset
|
584 {"pathshorten", 1, 1, FEARG_1, f_pathshorten}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
585 #ifdef FEAT_PERL |
17976
6d11a0d5751d
patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17972
diff
changeset
|
586 {"perleval", 1, 1, FEARG_1, f_perleval}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
587 #endif |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18742
diff
changeset
|
588 #ifdef FEAT_PROP_POPUP |
17972
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17970
diff
changeset
|
589 {"popup_atcursor", 2, 2, FEARG_1, f_popup_atcursor}, |
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17970
diff
changeset
|
590 {"popup_beval", 2, 2, FEARG_1, f_popup_beval}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
591 {"popup_clear", 0, 0, 0, f_popup_clear}, |
17972
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17970
diff
changeset
|
592 {"popup_close", 1, 2, FEARG_1, f_popup_close}, |
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17970
diff
changeset
|
593 {"popup_create", 2, 2, FEARG_1, f_popup_create}, |
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17970
diff
changeset
|
594 {"popup_dialog", 2, 2, FEARG_1, f_popup_dialog}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
595 {"popup_filter_menu", 2, 2, 0, f_popup_filter_menu}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
596 {"popup_filter_yesno", 2, 2, 0, f_popup_filter_yesno}, |
17817
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17809
diff
changeset
|
597 {"popup_findinfo", 0, 0, 0, f_popup_findinfo}, |
e8a7029efa40
patch 8.1.1905: cannot set all properties of the info popup
Bram Moolenaar <Bram@vim.org>
parents:
17809
diff
changeset
|
598 {"popup_findpreview", 0, 0, 0, f_popup_findpreview}, |
17972
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17970
diff
changeset
|
599 {"popup_getoptions", 1, 1, FEARG_1, f_popup_getoptions}, |
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17970
diff
changeset
|
600 {"popup_getpos", 1, 1, FEARG_1, f_popup_getpos}, |
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17970
diff
changeset
|
601 {"popup_hide", 1, 1, FEARG_1, f_popup_hide}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
602 {"popup_locate", 2, 2, 0, f_popup_locate}, |
17972
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17970
diff
changeset
|
603 {"popup_menu", 2, 2, FEARG_1, f_popup_menu}, |
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17970
diff
changeset
|
604 {"popup_move", 2, 2, FEARG_1, f_popup_move}, |
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17970
diff
changeset
|
605 {"popup_notification", 2, 2, FEARG_1, f_popup_notification}, |
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17970
diff
changeset
|
606 {"popup_setoptions", 2, 2, FEARG_1, f_popup_setoptions}, |
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17970
diff
changeset
|
607 {"popup_settext", 2, 2, FEARG_1, f_popup_settext}, |
a170c48e0f91
patch 8.1.1982: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17970
diff
changeset
|
608 {"popup_show", 1, 1, FEARG_1, f_popup_show}, |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16764
diff
changeset
|
609 #endif |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
610 #ifdef FEAT_FLOAT |
17765
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
611 {"pow", 2, 2, FEARG_1, f_pow}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
612 #endif |
17976
6d11a0d5751d
patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17972
diff
changeset
|
613 {"prevnonblank", 1, 1, FEARG_1, f_prevnonblank}, |
17676
14ac8c31e598
patch 8.1.1835: cannot use printf() as a method
Bram Moolenaar <Bram@vim.org>
parents:
17672
diff
changeset
|
614 {"printf", 1, 19, FEARG_2, f_printf}, |
14019
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
14004
diff
changeset
|
615 #ifdef FEAT_JOB_CHANNEL |
17976
6d11a0d5751d
patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17972
diff
changeset
|
616 {"prompt_setcallback", 2, 2, FEARG_1, f_prompt_setcallback}, |
6d11a0d5751d
patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17972
diff
changeset
|
617 {"prompt_setinterrupt", 2, 2, FEARG_1, f_prompt_setinterrupt}, |
6d11a0d5751d
patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17972
diff
changeset
|
618 {"prompt_setprompt", 2, 2, FEARG_1, f_prompt_setprompt}, |
14019
dc67449d648c
patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
14004
diff
changeset
|
619 #endif |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18742
diff
changeset
|
620 #ifdef FEAT_PROP_POPUP |
17980
52f23198af7f
patch 8.1.1986: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17978
diff
changeset
|
621 {"prop_add", 3, 3, FEARG_1, f_prop_add}, |
52f23198af7f
patch 8.1.1986: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17978
diff
changeset
|
622 {"prop_clear", 1, 3, FEARG_1, f_prop_clear}, |
52f23198af7f
patch 8.1.1986: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17978
diff
changeset
|
623 {"prop_list", 1, 2, FEARG_1, f_prop_list}, |
52f23198af7f
patch 8.1.1986: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17978
diff
changeset
|
624 {"prop_remove", 1, 3, FEARG_1, f_prop_remove}, |
52f23198af7f
patch 8.1.1986: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17978
diff
changeset
|
625 {"prop_type_add", 2, 2, FEARG_1, f_prop_type_add}, |
52f23198af7f
patch 8.1.1986: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17978
diff
changeset
|
626 {"prop_type_change", 2, 2, FEARG_1, f_prop_type_change}, |
52f23198af7f
patch 8.1.1986: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17978
diff
changeset
|
627 {"prop_type_delete", 1, 2, FEARG_1, f_prop_type_delete}, |
52f23198af7f
patch 8.1.1986: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17978
diff
changeset
|
628 {"prop_type_get", 1, 2, FEARG_1, f_prop_type_get}, |
52f23198af7f
patch 8.1.1986: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17978
diff
changeset
|
629 {"prop_type_list", 0, 1, FEARG_1, f_prop_type_list}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
630 #endif |
17756
a7afcea6f40a
patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17744
diff
changeset
|
631 {"pum_getpos", 0, 0, 0, f_pum_getpos}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
632 {"pumvisible", 0, 0, 0, f_pumvisible}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
633 #ifdef FEAT_PYTHON3 |
17976
6d11a0d5751d
patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17972
diff
changeset
|
634 {"py3eval", 1, 1, FEARG_1, f_py3eval}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
635 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
636 #ifdef FEAT_PYTHON |
17976
6d11a0d5751d
patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17972
diff
changeset
|
637 {"pyeval", 1, 1, FEARG_1, f_pyeval}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
638 #endif |
10722
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
639 #if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) |
17976
6d11a0d5751d
patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17972
diff
changeset
|
640 {"pyxeval", 1, 1, FEARG_1, f_pyxeval}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
641 #endif |
18701
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
642 {"rand", 0, 1, FEARG_1, f_rand}, |
17982
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17980
diff
changeset
|
643 {"range", 1, 3, FEARG_1, f_range}, |
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17980
diff
changeset
|
644 {"readdir", 1, 2, FEARG_1, f_readdir}, |
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17980
diff
changeset
|
645 {"readfile", 1, 3, FEARG_1, f_readfile}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
646 {"reg_executing", 0, 0, 0, f_reg_executing}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
647 {"reg_recording", 0, 0, 0, f_reg_recording}, |
17982
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17980
diff
changeset
|
648 {"reltime", 0, 2, FEARG_1, f_reltime}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
649 #ifdef FEAT_FLOAT |
17982
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17980
diff
changeset
|
650 {"reltimefloat", 1, 1, FEARG_1, f_reltimefloat}, |
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17980
diff
changeset
|
651 #endif |
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17980
diff
changeset
|
652 {"reltimestr", 1, 1, FEARG_1, f_reltimestr}, |
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17980
diff
changeset
|
653 {"remote_expr", 2, 4, FEARG_1, f_remote_expr}, |
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17980
diff
changeset
|
654 {"remote_foreground", 1, 1, FEARG_1, f_remote_foreground}, |
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17980
diff
changeset
|
655 {"remote_peek", 1, 2, FEARG_1, f_remote_peek}, |
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17980
diff
changeset
|
656 {"remote_read", 1, 2, FEARG_1, f_remote_read}, |
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17980
diff
changeset
|
657 {"remote_send", 2, 3, FEARG_1, f_remote_send}, |
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17980
diff
changeset
|
658 {"remote_startserver", 1, 1, FEARG_1, f_remote_startserver}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
659 {"remove", 2, 3, FEARG_1, f_remove}, |
17982
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17980
diff
changeset
|
660 {"rename", 2, 2, FEARG_1, f_rename}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
661 {"repeat", 2, 2, FEARG_1, f_repeat}, |
17982
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17980
diff
changeset
|
662 {"resolve", 1, 1, FEARG_1, f_resolve}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
663 {"reverse", 1, 1, FEARG_1, f_reverse}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
664 #ifdef FEAT_FLOAT |
17765
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
665 {"round", 1, 1, FEARG_1, f_round}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
666 #endif |
16103
518f44125207
patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents:
16078
diff
changeset
|
667 #ifdef FEAT_RUBY |
17982
2029737e6a22
patch 8.1.1987: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17980
diff
changeset
|
668 {"rubyeval", 1, 1, FEARG_1, f_rubyeval}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
669 #endif |
17994
0dcc2ee838dd
patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17986
diff
changeset
|
670 {"screenattr", 2, 2, FEARG_1, f_screenattr}, |
0dcc2ee838dd
patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17986
diff
changeset
|
671 {"screenchar", 2, 2, FEARG_1, f_screenchar}, |
0dcc2ee838dd
patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17986
diff
changeset
|
672 {"screenchars", 2, 2, FEARG_1, f_screenchars}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
673 {"screencol", 0, 0, 0, f_screencol}, |
17994
0dcc2ee838dd
patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17986
diff
changeset
|
674 {"screenpos", 3, 3, FEARG_1, f_screenpos}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
675 {"screenrow", 0, 0, 0, f_screenrow}, |
17994
0dcc2ee838dd
patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17986
diff
changeset
|
676 {"screenstring", 2, 2, FEARG_1, f_screenstring}, |
0dcc2ee838dd
patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17986
diff
changeset
|
677 {"search", 1, 4, FEARG_1, f_search}, |
0dcc2ee838dd
patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17986
diff
changeset
|
678 {"searchdecl", 1, 3, FEARG_1, f_searchdecl}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
679 {"searchpair", 3, 7, 0, f_searchpair}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
680 {"searchpairpos", 3, 7, 0, f_searchpairpos}, |
17994
0dcc2ee838dd
patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17986
diff
changeset
|
681 {"searchpos", 1, 4, FEARG_1, f_searchpos}, |
0dcc2ee838dd
patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17986
diff
changeset
|
682 {"server2client", 2, 2, FEARG_1, f_server2client}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
683 {"serverlist", 0, 0, 0, f_serverlist}, |
17994
0dcc2ee838dd
patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17986
diff
changeset
|
684 {"setbufline", 3, 3, FEARG_3, f_setbufline}, |
0dcc2ee838dd
patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17986
diff
changeset
|
685 {"setbufvar", 3, 3, FEARG_3, f_setbufvar}, |
0dcc2ee838dd
patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17986
diff
changeset
|
686 {"setcharsearch", 1, 1, FEARG_1, f_setcharsearch}, |
0dcc2ee838dd
patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17986
diff
changeset
|
687 {"setcmdpos", 1, 1, FEARG_1, f_setcmdpos}, |
0dcc2ee838dd
patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17986
diff
changeset
|
688 {"setenv", 2, 2, FEARG_2, f_setenv}, |
17857
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
689 {"setfperm", 2, 2, FEARG_1, f_setfperm}, |
17994
0dcc2ee838dd
patch 8.1.1993: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17986
diff
changeset
|
690 {"setline", 2, 2, FEARG_2, f_setline}, |
18000
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
691 {"setloclist", 2, 4, FEARG_2, f_setloclist}, |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
692 {"setmatches", 1, 2, FEARG_1, f_setmatches}, |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
693 {"setpos", 2, 2, FEARG_2, f_setpos}, |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
694 {"setqflist", 1, 3, FEARG_1, f_setqflist}, |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
695 {"setreg", 2, 3, FEARG_2, f_setreg}, |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
696 {"settabvar", 3, 3, FEARG_3, f_settabvar}, |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
697 {"settabwinvar", 4, 4, FEARG_4, f_settabwinvar}, |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
698 {"settagstack", 2, 3, FEARG_2, f_settagstack}, |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
699 {"setwinvar", 3, 3, FEARG_3, f_setwinvar}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
700 #ifdef FEAT_CRYPT |
18000
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
701 {"sha256", 1, 1, FEARG_1, f_sha256}, |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
702 #endif |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
703 {"shellescape", 1, 2, FEARG_1, f_shellescape}, |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
704 {"shiftwidth", 0, 1, FEARG_1, f_shiftwidth}, |
15209
3a99b2e6d136
patch 8.1.0614: placing signs can be complicated
Bram Moolenaar <Bram@vim.org>
parents:
15146
diff
changeset
|
705 #ifdef FEAT_SIGNS |
17998
ea916dbbb9b9
patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
706 {"sign_define", 1, 2, FEARG_1, f_sign_define}, |
ea916dbbb9b9
patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
707 {"sign_getdefined", 0, 1, FEARG_1, f_sign_getdefined}, |
ea916dbbb9b9
patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
708 {"sign_getplaced", 0, 2, FEARG_1, f_sign_getplaced}, |
ea916dbbb9b9
patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
709 {"sign_jump", 3, 3, FEARG_1, f_sign_jump}, |
ea916dbbb9b9
patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
710 {"sign_place", 4, 5, FEARG_1, f_sign_place}, |
ea916dbbb9b9
patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
711 {"sign_placelist", 1, 1, FEARG_1, f_sign_placelist}, |
ea916dbbb9b9
patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
712 {"sign_undefine", 0, 1, FEARG_1, f_sign_undefine}, |
ea916dbbb9b9
patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
713 {"sign_unplace", 1, 2, FEARG_1, f_sign_unplace}, |
ea916dbbb9b9
patch 8.1.1995: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17994
diff
changeset
|
714 {"sign_unplacelist", 1, 2, FEARG_1, f_sign_unplacelist}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
715 #endif |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
716 {"simplify", 1, 1, 0, f_simplify}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
717 #ifdef FEAT_FLOAT |
17765
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
718 {"sin", 1, 1, FEARG_1, f_sin}, |
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
719 {"sinh", 1, 1, FEARG_1, f_sinh}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
720 #endif |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
721 {"sort", 1, 3, FEARG_1, f_sort}, |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
722 #ifdef FEAT_SOUND |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
723 {"sound_clear", 0, 0, 0, f_sound_clear}, |
18017
988e5a868b60
patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
724 {"sound_playevent", 1, 2, FEARG_1, f_sound_playevent}, |
988e5a868b60
patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
725 {"sound_playfile", 1, 2, FEARG_1, f_sound_playfile}, |
988e5a868b60
patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
726 {"sound_stop", 1, 1, FEARG_1, f_sound_stop}, |
988e5a868b60
patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
727 #endif |
988e5a868b60
patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
728 {"soundfold", 1, 1, FEARG_1, f_soundfold}, |
988e5a868b60
patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
729 {"spellbadword", 0, 1, FEARG_1, f_spellbadword}, |
988e5a868b60
patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
730 {"spellsuggest", 1, 3, FEARG_1, f_spellsuggest}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
731 {"split", 1, 3, FEARG_1, f_split}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
732 #ifdef FEAT_FLOAT |
17765
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
733 {"sqrt", 1, 1, FEARG_1, f_sqrt}, |
18738
e0cd10f750e7
patch 8.1.2359: cannot build without FEAT_FLOAT
Bram Moolenaar <Bram@vim.org>
parents:
18732
diff
changeset
|
734 #endif |
18701
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
735 {"srand", 0, 1, FEARG_1, f_srand}, |
18104
e59ff7b5d7a7
patch 8.1.2047: cannot check the current state
Bram Moolenaar <Bram@vim.org>
parents:
18094
diff
changeset
|
736 {"state", 0, 1, FEARG_1, f_state}, |
e59ff7b5d7a7
patch 8.1.2047: cannot check the current state
Bram Moolenaar <Bram@vim.org>
parents:
18094
diff
changeset
|
737 #ifdef FEAT_FLOAT |
17765
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
738 {"str2float", 1, 1, FEARG_1, f_str2float}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
739 #endif |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
740 {"str2list", 1, 2, FEARG_1, f_str2list}, |
18080
a6d218f99ff7
patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
741 {"str2nr", 1, 3, FEARG_1, f_str2nr}, |
18017
988e5a868b60
patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
742 {"strcharpart", 2, 3, FEARG_1, f_strcharpart}, |
988e5a868b60
patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
743 {"strchars", 1, 2, FEARG_1, f_strchars}, |
988e5a868b60
patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
744 {"strdisplaywidth", 1, 2, FEARG_1, f_strdisplaywidth}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
745 #ifdef HAVE_STRFTIME |
18017
988e5a868b60
patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
746 {"strftime", 1, 2, FEARG_1, f_strftime}, |
988e5a868b60
patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
747 #endif |
988e5a868b60
patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
748 {"strgetchar", 2, 2, FEARG_1, f_strgetchar}, |
988e5a868b60
patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
749 {"stridx", 2, 3, FEARG_1, f_stridx}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
750 {"string", 1, 1, FEARG_1, f_string}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
751 {"strlen", 1, 1, FEARG_1, f_strlen}, |
18017
988e5a868b60
patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
752 {"strpart", 2, 3, FEARG_1, f_strpart}, |
18669
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
753 #ifdef HAVE_STRPTIME |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
754 {"strptime", 2, 2, FEARG_1, f_strptime}, |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
755 #endif |
18017
988e5a868b60
patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
756 {"strridx", 2, 3, FEARG_1, f_strridx}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
757 {"strtrans", 1, 1, FEARG_1, f_strtrans}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
758 {"strwidth", 1, 1, FEARG_1, f_strwidth}, |
18017
988e5a868b60
patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
759 {"submatch", 1, 2, FEARG_1, f_submatch}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
760 {"substitute", 4, 4, FEARG_1, f_substitute}, |
18017
988e5a868b60
patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
761 {"swapinfo", 1, 1, FEARG_1, f_swapinfo}, |
988e5a868b60
patch 8.1.2004: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18010
diff
changeset
|
762 {"swapname", 1, 1, FEARG_1, f_swapname}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
763 {"synID", 3, 3, 0, f_synID}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
764 {"synIDattr", 2, 3, FEARG_1, f_synIDattr}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
765 {"synIDtrans", 1, 1, FEARG_1, f_synIDtrans}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
766 {"synconcealed", 2, 2, 0, f_synconcealed}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
767 {"synstack", 2, 2, 0, f_synstack}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
768 {"system", 1, 2, FEARG_1, f_system}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
769 {"systemlist", 1, 2, FEARG_1, f_systemlist}, |
18031
8a2fb21c23c0
patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18017
diff
changeset
|
770 {"tabpagebuflist", 0, 1, FEARG_1, f_tabpagebuflist}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
771 {"tabpagenr", 0, 1, 0, f_tabpagenr}, |
18031
8a2fb21c23c0
patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18017
diff
changeset
|
772 {"tabpagewinnr", 1, 2, FEARG_1, f_tabpagewinnr}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
773 {"tagfiles", 0, 0, 0, f_tagfiles}, |
18031
8a2fb21c23c0
patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18017
diff
changeset
|
774 {"taglist", 1, 2, FEARG_1, f_taglist}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
775 #ifdef FEAT_FLOAT |
17765
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
776 {"tan", 1, 1, FEARG_1, f_tan}, |
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
777 {"tanh", 1, 1, FEARG_1, f_tanh}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
778 #endif |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
779 {"tempname", 0, 0, 0, f_tempname}, |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
11828
diff
changeset
|
780 #ifdef FEAT_TERMINAL |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
781 {"term_dumpdiff", 2, 3, FEARG_1, f_term_dumpdiff}, |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
782 {"term_dumpload", 1, 2, FEARG_1, f_term_dumpload}, |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
783 {"term_dumpwrite", 2, 3, FEARG_2, f_term_dumpwrite}, |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
784 {"term_getaltscreen", 1, 1, FEARG_1, f_term_getaltscreen}, |
13626
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13587
diff
changeset
|
785 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
786 {"term_getansicolors", 1, 1, FEARG_1, f_term_getansicolors}, |
13626
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13587
diff
changeset
|
787 # endif |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
788 {"term_getattr", 2, 2, FEARG_1, f_term_getattr}, |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
789 {"term_getcursor", 1, 1, FEARG_1, f_term_getcursor}, |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
790 {"term_getjob", 1, 1, FEARG_1, f_term_getjob}, |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
791 {"term_getline", 2, 2, FEARG_1, f_term_getline}, |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
792 {"term_getscrolled", 1, 1, FEARG_1, f_term_getscrolled}, |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
793 {"term_getsize", 1, 1, FEARG_1, f_term_getsize}, |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
794 {"term_getstatus", 1, 1, FEARG_1, f_term_getstatus}, |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
795 {"term_gettitle", 1, 1, FEARG_1, f_term_gettitle}, |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
796 {"term_gettty", 1, 2, FEARG_1, f_term_gettty}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
797 {"term_list", 0, 0, 0, f_term_list}, |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
798 {"term_scrape", 2, 2, FEARG_1, f_term_scrape}, |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
799 {"term_sendkeys", 2, 2, FEARG_1, f_term_sendkeys}, |
13626
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13587
diff
changeset
|
800 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
801 {"term_setansicolors", 2, 2, FEARG_1, f_term_setansicolors}, |
13626
ab89131d30e0
patch 8.0.1685: can't set ANSI colors of a terminal window
Christian Brabandt <cb@256bit.org>
parents:
13587
diff
changeset
|
802 # endif |
18170
4ac8161e92e0
patch 8.1.2080: the terminal API is limited and can't be disabled
Bram Moolenaar <Bram@vim.org>
parents:
18104
diff
changeset
|
803 {"term_setapi", 2, 2, FEARG_1, f_term_setapi}, |
18033
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
804 {"term_setkill", 2, 2, FEARG_1, f_term_setkill}, |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
805 {"term_setrestore", 2, 2, FEARG_1, f_term_setrestore}, |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
806 {"term_setsize", 3, 3, FEARG_1, f_term_setsize}, |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
807 {"term_start", 1, 2, FEARG_1, f_term_start}, |
049a7481d737
patch 8.1.2012: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18031
diff
changeset
|
808 {"term_wait", 1, 2, FEARG_1, f_term_wait}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
809 #endif |
18031
8a2fb21c23c0
patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18017
diff
changeset
|
810 {"test_alloc_fail", 3, 3, FEARG_1, f_test_alloc_fail}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
811 {"test_autochdir", 0, 0, 0, f_test_autochdir}, |
18031
8a2fb21c23c0
patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18017
diff
changeset
|
812 {"test_feedinput", 1, 1, FEARG_1, f_test_feedinput}, |
8a2fb21c23c0
patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18017
diff
changeset
|
813 {"test_garbagecollect_now", 0, 0, 0, f_test_garbagecollect_now}, |
8a2fb21c23c0
patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18017
diff
changeset
|
814 {"test_garbagecollect_soon", 0, 0, 0, f_test_garbagecollect_soon}, |
8a2fb21c23c0
patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18017
diff
changeset
|
815 {"test_getvalue", 1, 1, FEARG_1, f_test_getvalue}, |
8a2fb21c23c0
patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18017
diff
changeset
|
816 {"test_ignore_error", 1, 1, FEARG_1, f_test_ignore_error}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
817 {"test_null_blob", 0, 0, 0, f_test_null_blob}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
818 #ifdef FEAT_JOB_CHANNEL |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
819 {"test_null_channel", 0, 0, 0, f_test_null_channel}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
820 #endif |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
821 {"test_null_dict", 0, 0, 0, f_test_null_dict}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
822 #ifdef FEAT_JOB_CHANNEL |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
823 {"test_null_job", 0, 0, 0, f_test_null_job}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
824 #endif |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
825 {"test_null_list", 0, 0, 0, f_test_null_list}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
826 {"test_null_partial", 0, 0, 0, f_test_null_partial}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
827 {"test_null_string", 0, 0, 0, f_test_null_string}, |
18031
8a2fb21c23c0
patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18017
diff
changeset
|
828 {"test_option_not_set", 1, 1, FEARG_1, f_test_option_not_set}, |
8a2fb21c23c0
patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18017
diff
changeset
|
829 {"test_override", 2, 2, FEARG_2, f_test_override}, |
8a2fb21c23c0
patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18017
diff
changeset
|
830 {"test_refcount", 1, 1, FEARG_1, f_test_refcount}, |
14756
a179e5cfcab7
patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents:
14752
diff
changeset
|
831 #ifdef FEAT_GUI |
18031
8a2fb21c23c0
patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18017
diff
changeset
|
832 {"test_scrollbar", 3, 3, FEARG_2, f_test_scrollbar}, |
14756
a179e5cfcab7
patch 8.1.0390: scrollbars are not tested
Christian Brabandt <cb@256bit.org>
parents:
14752
diff
changeset
|
833 #endif |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
834 {"test_setmouse", 2, 2, 0, f_test_setmouse}, |
18031
8a2fb21c23c0
patch 8.1.2011: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18017
diff
changeset
|
835 {"test_settime", 1, 1, FEARG_1, f_test_settime}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
836 #ifdef FEAT_TIMERS |
18035
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
837 {"timer_info", 0, 1, FEARG_1, f_timer_info}, |
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
838 {"timer_pause", 2, 2, FEARG_1, f_timer_pause}, |
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
839 {"timer_start", 2, 3, FEARG_1, f_timer_start}, |
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
840 {"timer_stop", 1, 1, FEARG_1, f_timer_stop}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
841 {"timer_stopall", 0, 0, 0, f_timer_stopall}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
842 #endif |
18035
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
843 {"tolower", 1, 1, FEARG_1, f_tolower}, |
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
844 {"toupper", 1, 1, FEARG_1, f_toupper}, |
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
845 {"tr", 3, 3, FEARG_1, f_tr}, |
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
846 {"trim", 1, 2, FEARG_1, f_trim}, |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
847 #ifdef FEAT_FLOAT |
17765
545119cd5554
patch 8.1.1879: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17756
diff
changeset
|
848 {"trunc", 1, 1, FEARG_1, f_trunc}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
849 #endif |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
850 {"type", 1, 1, FEARG_1, f_type}, |
18035
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
851 {"undofile", 1, 1, FEARG_1, f_undofile}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
852 {"undotree", 0, 0, 0, f_undotree}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
853 {"uniq", 1, 3, FEARG_1, f_uniq}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
854 {"values", 1, 1, FEARG_1, f_values}, |
18035
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
855 {"virtcol", 1, 1, FEARG_1, f_virtcol}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
856 {"visualmode", 0, 1, 0, f_visualmode}, |
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
857 {"wildmenumode", 0, 0, 0, f_wildmenumode}, |
18035
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
858 {"win_execute", 2, 3, FEARG_2, f_win_execute}, |
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
859 {"win_findbuf", 1, 1, FEARG_1, f_win_findbuf}, |
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
860 {"win_getid", 0, 2, FEARG_1, f_win_getid}, |
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
861 {"win_gotoid", 1, 1, FEARG_1, f_win_gotoid}, |
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
862 {"win_id2tabwin", 1, 1, FEARG_1, f_win_id2tabwin}, |
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
863 {"win_id2win", 1, 1, FEARG_1, f_win_id2win}, |
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
864 {"win_screenpos", 1, 1, FEARG_1, f_win_screenpos}, |
18049
a9f1656f13c9
patch 8.1.2020: it is not easy to change the window layout
Bram Moolenaar <Bram@vim.org>
parents:
18035
diff
changeset
|
865 {"win_splitmove", 2, 3, FEARG_1, f_win_splitmove}, |
17825
ce993ba17adb
patch 8.1.1909: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17817
diff
changeset
|
866 {"winbufnr", 1, 1, FEARG_1, f_winbufnr}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
867 {"wincol", 0, 0, 0, f_wincol}, |
18973
bf8eb950df61
patch 8.2.0047: cannot skip tests for specific MS-Windows platform
Bram Moolenaar <Bram@vim.org>
parents:
18777
diff
changeset
|
868 {"windowsversion", 0, 0, 0, f_windowsversion}, |
18035
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
869 {"winheight", 1, 1, FEARG_1, f_winheight}, |
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
870 {"winlayout", 0, 1, FEARG_1, f_winlayout}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
871 {"winline", 0, 0, 0, f_winline}, |
18035
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
872 {"winnr", 0, 1, FEARG_1, f_winnr}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
873 {"winrestcmd", 0, 0, 0, f_winrestcmd}, |
18035
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
874 {"winrestview", 1, 1, FEARG_1, f_winrestview}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
875 {"winsaveview", 0, 0, 0, f_winsaveview}, |
18035
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
876 {"winwidth", 1, 1, FEARG_1, f_winwidth}, |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
877 {"wordcount", 0, 0, 0, f_wordcount}, |
18035
11dca9732a48
patch 8.1.2013: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
18033
diff
changeset
|
878 {"writefile", 2, 3, FEARG_1, f_writefile}, |
17783
45eca7143d7c
patch 8.1.1888: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
879 {"xor", 2, 2, FEARG_1, f_xor}, |
17612
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
880 }; |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
881 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
882 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
883 * Function given to ExpandGeneric() to obtain the list of internal |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
884 * or user defined function names. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
885 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
886 char_u * |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
887 get_function_name(expand_T *xp, int idx) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
888 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
889 static int intidx = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
890 char_u *name; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
891 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
892 if (idx == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
893 intidx = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
894 if (intidx < 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
895 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
896 name = get_user_func_name(xp, idx); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
897 if (name != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
898 return name; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
899 } |
17612
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
900 if (++intidx < (int)(sizeof(global_functions) / sizeof(funcentry_T))) |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
901 { |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
902 STRCPY(IObuff, global_functions[intidx].f_name); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
903 STRCAT(IObuff, "("); |
17612
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
904 if (global_functions[intidx].f_max_argc == 0) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
905 STRCAT(IObuff, ")"); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
906 return IObuff; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
907 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
908 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
909 return NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
910 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
911 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
912 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
913 * Function given to ExpandGeneric() to obtain the list of internal or |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
914 * user defined variable or function names. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
915 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
916 char_u * |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
917 get_expr_name(expand_T *xp, int idx) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
918 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
919 static int intidx = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
920 char_u *name; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
921 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
922 if (idx == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
923 intidx = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
924 if (intidx < 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
925 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
926 name = get_function_name(xp, idx); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
927 if (name != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
928 return name; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
929 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
930 return get_user_var_name(xp, ++intidx); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
931 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
932 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
933 /* |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
934 * Find internal function "name" in table "global_functions". |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
935 * Return index, or -1 if not found |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
936 */ |
17612
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
937 static int |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
938 find_internal_func(char_u *name) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
939 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
940 int first = 0; |
17612
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
941 int last; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
942 int cmp; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
943 int x; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
944 |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
945 last = (int)(sizeof(global_functions) / sizeof(funcentry_T)) - 1; |
17612
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
946 |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
947 // Find the function name in the table. Binary search. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
948 while (first <= last) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
949 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
950 x = first + ((unsigned)(last - first) >> 1); |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
951 cmp = STRCMP(name, global_functions[x].f_name); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
952 if (cmp < 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
953 last = x - 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
954 else if (cmp > 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
955 first = x + 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
956 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
957 return x; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
958 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
959 return -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
960 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
961 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
962 int |
17612
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
963 has_internal_func(char_u *name) |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
964 { |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
965 return find_internal_func(name) >= 0; |
17612
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
966 } |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
967 |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
968 int |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
969 call_internal_func( |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
970 char_u *name, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
971 int argcount, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
972 typval_T *argvars, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
973 typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
974 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
975 int i; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
976 |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
977 i = find_internal_func(name); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
978 if (i < 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
979 return ERROR_UNKNOWN; |
17612
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
980 if (argcount < global_functions[i].f_min_argc) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
981 return ERROR_TOOFEW; |
17612
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
982 if (argcount > global_functions[i].f_max_argc) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
983 return ERROR_TOOMANY; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
984 argvars[argcount].v_type = VAR_UNKNOWN; |
17612
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
985 global_functions[i].f_func(argvars, rettv); |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
986 return ERROR_NONE; |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
987 } |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
988 |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
989 /* |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
990 * Invoke a method for base->method(). |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
991 */ |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
992 int |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
993 call_internal_method( |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
994 char_u *name, |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
995 int argcount, |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
996 typval_T *argvars, |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
997 typval_T *rettv, |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
998 typval_T *basetv) |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
999 { |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
1000 int i; |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
1001 int fi; |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
1002 typval_T argv[MAX_FUNC_ARGS + 1]; |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
1003 |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
1004 fi = find_internal_func(name); |
17732
1726c2db81bf
patch 8.1.1863: confusing error when using a builtin function as method
Bram Moolenaar <Bram@vim.org>
parents:
17728
diff
changeset
|
1005 if (fi < 0) |
17612
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
1006 return ERROR_UNKNOWN; |
17732
1726c2db81bf
patch 8.1.1863: confusing error when using a builtin function as method
Bram Moolenaar <Bram@vim.org>
parents:
17728
diff
changeset
|
1007 if (global_functions[fi].f_argtype == 0) |
1726c2db81bf
patch 8.1.1863: confusing error when using a builtin function as method
Bram Moolenaar <Bram@vim.org>
parents:
17728
diff
changeset
|
1008 return ERROR_NOTMETHOD; |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
1009 if (argcount + 1 < global_functions[fi].f_min_argc) |
17612
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
1010 return ERROR_TOOFEW; |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
1011 if (argcount + 1 > global_functions[fi].f_max_argc) |
17612
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
1012 return ERROR_TOOMANY; |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
1013 |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
1014 if (global_functions[fi].f_argtype == FEARG_LAST) |
17620
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
1015 { |
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
1016 // base value goes last |
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
1017 for (i = 0; i < argcount; ++i) |
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
1018 argv[i] = argvars[i]; |
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
1019 argv[argcount] = *basetv; |
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
1020 } |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
1021 else if (global_functions[fi].f_argtype == FEARG_2) |
17620
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
1022 { |
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
1023 // base value goes second |
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
1024 argv[0] = argvars[0]; |
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
1025 argv[1] = *basetv; |
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
1026 for (i = 1; i < argcount; ++i) |
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
1027 argv[i + 1] = argvars[i]; |
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
1028 } |
17728
68ea27d26d5b
patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17704
diff
changeset
|
1029 else if (global_functions[fi].f_argtype == FEARG_3) |
68ea27d26d5b
patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17704
diff
changeset
|
1030 { |
68ea27d26d5b
patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17704
diff
changeset
|
1031 // base value goes third |
68ea27d26d5b
patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17704
diff
changeset
|
1032 argv[0] = argvars[0]; |
68ea27d26d5b
patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17704
diff
changeset
|
1033 argv[1] = argvars[1]; |
68ea27d26d5b
patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17704
diff
changeset
|
1034 argv[2] = *basetv; |
68ea27d26d5b
patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17704
diff
changeset
|
1035 for (i = 2; i < argcount; ++i) |
68ea27d26d5b
patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17704
diff
changeset
|
1036 argv[i + 1] = argvars[i]; |
68ea27d26d5b
patch 8.1.1861: only some assert functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17704
diff
changeset
|
1037 } |
18000
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
1038 else if (global_functions[fi].f_argtype == FEARG_4) |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
1039 { |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
1040 // base value goes fourth |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
1041 argv[0] = argvars[0]; |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
1042 argv[1] = argvars[1]; |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
1043 argv[2] = argvars[2]; |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
1044 argv[3] = *basetv; |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
1045 for (i = 3; i < argcount; ++i) |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
1046 argv[i + 1] = argvars[i]; |
7a19c8d6bb9e
patch 8.1.1996: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17998
diff
changeset
|
1047 } |
17620
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
1048 else |
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
1049 { |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
1050 // FEARG_1: base value goes first |
17620
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
1051 argv[0] = *basetv; |
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
1052 for (i = 0; i < argcount; ++i) |
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
1053 argv[i + 1] = argvars[i]; |
072efa9ca875
patch 8.1.1807: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents:
17612
diff
changeset
|
1054 } |
17612
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
1055 argv[argcount + 1].v_type = VAR_UNKNOWN; |
e259d11e2900
patch 8.1.1803: all builtin functions are global
Bram Moolenaar <Bram@vim.org>
parents:
17588
diff
changeset
|
1056 |
17636
1687c8935ab6
patch 8.1.1815: duplicating info for internal functions
Bram Moolenaar <Bram@vim.org>
parents:
17624
diff
changeset
|
1057 global_functions[fi].f_func(argv, rettv); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1058 return ERROR_NONE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1059 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1060 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1061 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1062 * Return TRUE for a non-zero Number and a non-empty String. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1063 */ |
18104
e59ff7b5d7a7
patch 8.1.2047: cannot check the current state
Bram Moolenaar <Bram@vim.org>
parents:
18094
diff
changeset
|
1064 int |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1065 non_zero_arg(typval_T *argvars) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1066 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1067 return ((argvars[0].v_type == VAR_NUMBER |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1068 && argvars[0].vval.v_number != 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1069 || (argvars[0].v_type == VAR_SPECIAL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1070 && argvars[0].vval.v_number == VVAL_TRUE) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1071 || (argvars[0].v_type == VAR_STRING |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1072 && argvars[0].vval.v_string != NULL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1073 && *argvars[0].vval.v_string != NUL)); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1074 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1075 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1076 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1077 * Get the lnum from the first argument. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1078 * Also accepts ".", "$", etc., but that only works for the current buffer. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1079 * Returns -1 on error. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1080 */ |
17218
210c4c5f783d
patch 8.1.1608: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17178
diff
changeset
|
1081 linenr_T |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1082 tv_get_lnum(typval_T *argvars) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1083 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1084 linenr_T lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1085 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1086 lnum = (linenr_T)tv_get_number_chk(&argvars[0], NULL); |
17956
1f6d5f9ddeb0
patch 8.1.1974: Coverity warns for using pointer as array
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
1087 if (lnum == 0) // no valid number, try using arg like line() |
1f6d5f9ddeb0
patch 8.1.1974: Coverity warns for using pointer as array
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
1088 { |
1f6d5f9ddeb0
patch 8.1.1974: Coverity warns for using pointer as array
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
1089 int fnum; |
1f6d5f9ddeb0
patch 8.1.1974: Coverity warns for using pointer as array
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
1090 pos_T *fp = var2fpos(&argvars[0], TRUE, &fnum); |
1f6d5f9ddeb0
patch 8.1.1974: Coverity warns for using pointer as array
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
1091 |
1f6d5f9ddeb0
patch 8.1.1974: Coverity warns for using pointer as array
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
1092 if (fp != NULL) |
1f6d5f9ddeb0
patch 8.1.1974: Coverity warns for using pointer as array
Bram Moolenaar <Bram@vim.org>
parents:
17942
diff
changeset
|
1093 lnum = fp->lnum; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1094 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1095 return lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1096 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1097 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1098 /* |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1099 * Get the lnum from the first argument. |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1100 * Also accepts "$", then "buf" is used. |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1101 * Returns 0 on error. |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1102 */ |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
18008
diff
changeset
|
1103 linenr_T |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1104 tv_get_lnum_buf(typval_T *argvars, buf_T *buf) |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1105 { |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1106 if (argvars[0].v_type == VAR_STRING |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1107 && argvars[0].vval.v_string != NULL |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1108 && argvars[0].vval.v_string[0] == '$' |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1109 && buf != NULL) |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1110 return buf->b_ml.ml_line_count; |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1111 return (linenr_T)tv_get_number_chk(&argvars[0], NULL); |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1112 } |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1113 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1114 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1115 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1116 * Get the float value of "argvars[0]" into "f". |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1117 * Returns FAIL when the argument is not a Number or Float. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1118 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1119 static int |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1120 get_float_arg(typval_T *argvars, float_T *f) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1121 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1122 if (argvars[0].v_type == VAR_FLOAT) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1123 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1124 *f = argvars[0].vval.v_float; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1125 return OK; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1126 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1127 if (argvars[0].v_type == VAR_NUMBER) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1128 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1129 *f = (float_T)argvars[0].vval.v_number; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1130 return OK; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1131 } |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
1132 emsg(_("E808: Number or Float required")); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1133 return FAIL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1134 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1135 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1136 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1137 * "abs(expr)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1138 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1139 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1140 f_abs(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1141 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1142 if (argvars[0].v_type == VAR_FLOAT) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1143 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1144 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1145 rettv->vval.v_float = fabs(argvars[0].vval.v_float); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1146 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1147 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1148 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1149 varnumber_T n; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1150 int error = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1151 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1152 n = tv_get_number_chk(&argvars[0], &error); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1153 if (error) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1154 rettv->vval.v_number = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1155 else if (n > 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1156 rettv->vval.v_number = n; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1157 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1158 rettv->vval.v_number = -n; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1159 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1160 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1161 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1162 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1163 * "acos()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1164 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1165 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1166 f_acos(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1167 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1168 float_T f = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1169 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1170 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1171 if (get_float_arg(argvars, &f) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1172 rettv->vval.v_float = acos(f); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1173 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1174 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1175 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1176 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1177 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1178 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1179 * "and(expr, expr)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1180 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1181 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1182 f_and(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1183 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1184 rettv->vval.v_number = tv_get_number_chk(&argvars[0], NULL) |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1185 & tv_get_number_chk(&argvars[1], NULL); |
14039
acb2dc112b06
patch 8.1.0037: cannot easily append lines to another buffer
Christian Brabandt <cb@256bit.org>
parents:
14019
diff
changeset
|
1186 } |
acb2dc112b06
patch 8.1.0037: cannot easily append lines to another buffer
Christian Brabandt <cb@256bit.org>
parents:
14019
diff
changeset
|
1187 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1188 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1189 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1190 * "asin()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1191 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1192 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1193 f_asin(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1194 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1195 float_T f = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1196 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1197 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1198 if (get_float_arg(argvars, &f) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1199 rettv->vval.v_float = asin(f); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1200 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1201 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1202 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1203 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1204 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1205 * "atan()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1206 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1207 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1208 f_atan(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1209 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1210 float_T f = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1211 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1212 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1213 if (get_float_arg(argvars, &f) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1214 rettv->vval.v_float = atan(f); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1215 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1216 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1217 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1218 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1219 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1220 * "atan2()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1221 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1222 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1223 f_atan2(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1224 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1225 float_T fx = 0.0, fy = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1226 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1227 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1228 if (get_float_arg(argvars, &fx) == OK |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1229 && get_float_arg(&argvars[1], &fy) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1230 rettv->vval.v_float = atan2(fx, fy); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1231 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1232 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1233 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1234 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1235 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1236 /* |
11014
fb2bcfa6a8de
patch 8.0.0396: 'balloonexpr' only works synchronously
Christian Brabandt <cb@256bit.org>
parents:
11006
diff
changeset
|
1237 * "balloon_show()" function |
fb2bcfa6a8de
patch 8.0.0396: 'balloonexpr' only works synchronously
Christian Brabandt <cb@256bit.org>
parents:
11006
diff
changeset
|
1238 */ |
fb2bcfa6a8de
patch 8.0.0396: 'balloonexpr' only works synchronously
Christian Brabandt <cb@256bit.org>
parents:
11006
diff
changeset
|
1239 #ifdef FEAT_BEVAL |
fb2bcfa6a8de
patch 8.0.0396: 'balloonexpr' only works synchronously
Christian Brabandt <cb@256bit.org>
parents:
11006
diff
changeset
|
1240 static void |
16600
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1241 f_balloon_gettext(typval_T *argvars UNUSED, typval_T *rettv) |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1242 { |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1243 rettv->v_type = VAR_STRING; |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1244 if (balloonEval != NULL) |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1245 { |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1246 if (balloonEval->msg == NULL) |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1247 rettv->vval.v_string = NULL; |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1248 else |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1249 rettv->vval.v_string = vim_strsave(balloonEval->msg); |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1250 } |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1251 } |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1252 |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1253 static void |
11014
fb2bcfa6a8de
patch 8.0.0396: 'balloonexpr' only works synchronously
Christian Brabandt <cb@256bit.org>
parents:
11006
diff
changeset
|
1254 f_balloon_show(typval_T *argvars, typval_T *rettv UNUSED) |
fb2bcfa6a8de
patch 8.0.0396: 'balloonexpr' only works synchronously
Christian Brabandt <cb@256bit.org>
parents:
11006
diff
changeset
|
1255 { |
11020
50f3e37bc210
patch 8.0.0399: crash when using balloon_show() when not supported
Christian Brabandt <cb@256bit.org>
parents:
11014
diff
changeset
|
1256 if (balloonEval != NULL) |
12883
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1257 { |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1258 if (argvars[0].v_type == VAR_LIST |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1259 # ifdef FEAT_GUI |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1260 && !gui.in_use |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1261 # endif |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1262 ) |
16600
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1263 { |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1264 list_T *l = argvars[0].vval.v_list; |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1265 |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1266 // empty list removes the balloon |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1267 post_balloon(balloonEval, NULL, |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1268 l == NULL || l->lv_len == 0 ? NULL : l); |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1269 } |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1270 else |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1271 { |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1272 char_u *mesg = tv_get_string_chk(&argvars[0]); |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1273 |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1274 if (mesg != NULL) |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1275 // empty string removes the balloon |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1276 post_balloon(balloonEval, *mesg == NUL ? NULL : mesg, NULL); |
ff3c99bd1038
patch 8.1.1303: not possible to hide a balloon
Bram Moolenaar <Bram@vim.org>
parents:
16576
diff
changeset
|
1277 } |
12883
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1278 } |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1279 } |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1280 |
12885
10cb5c3df3f5
patch 8.0.1319: can't build GUI on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12883
diff
changeset
|
1281 # if defined(FEAT_BEVAL_TERM) |
12883
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1282 static void |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1283 f_balloon_split(typval_T *argvars, typval_T *rettv UNUSED) |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1284 { |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1285 if (rettv_list_alloc(rettv) == OK) |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1286 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1287 char_u *msg = tv_get_string_chk(&argvars[0]); |
12883
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1288 |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1289 if (msg != NULL) |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1290 { |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1291 pumitem_T *array; |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1292 int size = split_message(msg, &array); |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1293 int i; |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1294 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1295 // Skip the first and last item, they are always empty. |
12883
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1296 for (i = 1; i < size - 1; ++i) |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1297 list_append_string(rettv->vval.v_list, array[i].pum_text, -1); |
13236
fee03d646e42
patch 8.0.1492: memory leak in balloon_split()
Christian Brabandt <cb@256bit.org>
parents:
13229
diff
changeset
|
1298 while (size > 0) |
fee03d646e42
patch 8.0.1492: memory leak in balloon_split()
Christian Brabandt <cb@256bit.org>
parents:
13229
diff
changeset
|
1299 vim_free(array[--size].pum_text); |
12883
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1300 vim_free(array); |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1301 } |
058e93aee621
patch 8.0.1318: terminal balloon only shows one line
Christian Brabandt <cb@256bit.org>
parents:
12871
diff
changeset
|
1302 } |
11014
fb2bcfa6a8de
patch 8.0.0396: 'balloonexpr' only works synchronously
Christian Brabandt <cb@256bit.org>
parents:
11006
diff
changeset
|
1303 } |
12885
10cb5c3df3f5
patch 8.0.1319: can't build GUI on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
12883
diff
changeset
|
1304 # endif |
11014
fb2bcfa6a8de
patch 8.0.0396: 'balloonexpr' only works synchronously
Christian Brabandt <cb@256bit.org>
parents:
11006
diff
changeset
|
1305 #endif |
fb2bcfa6a8de
patch 8.0.0396: 'balloonexpr' only works synchronously
Christian Brabandt <cb@256bit.org>
parents:
11006
diff
changeset
|
1306 |
fb2bcfa6a8de
patch 8.0.0396: 'balloonexpr' only works synchronously
Christian Brabandt <cb@256bit.org>
parents:
11006
diff
changeset
|
1307 /* |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1308 * Get buffer by number or pattern. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1309 */ |
11846
1c65cad8b967
patch 8.0.0804: terminal window functions not yet implemented
Christian Brabandt <cb@256bit.org>
parents:
11828
diff
changeset
|
1310 buf_T * |
15355
73b153ed5af8
patch 8.1.0685: get_buf_tv() is named inconsistently
Bram Moolenaar <Bram@vim.org>
parents:
15343
diff
changeset
|
1311 tv_get_buf(typval_T *tv, int curtab_only) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1312 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1313 char_u *name = tv->vval.v_string; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1314 buf_T *buf; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1315 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1316 if (tv->v_type == VAR_NUMBER) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1317 return buflist_findnr((int)tv->vval.v_number); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1318 if (tv->v_type != VAR_STRING) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1319 return NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1320 if (name == NULL || *name == NUL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1321 return curbuf; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1322 if (name[0] == '$' && name[1] == NUL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1323 return lastbuf; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1324 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1325 buf = buflist_find_by_name(name, curtab_only); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1326 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1327 // If not found, try expanding the name, like done for bufexists(). |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1328 if (buf == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1329 buf = find_buffer(tv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1330 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1331 return buf; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1332 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1333 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1334 /* |
15418
51b3c36b0523
patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents:
15388
diff
changeset
|
1335 * Get the buffer from "arg" and give an error and return NULL if it is not |
51b3c36b0523
patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents:
15388
diff
changeset
|
1336 * valid. |
51b3c36b0523
patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents:
15388
diff
changeset
|
1337 */ |
16638
4790302965fc
patch 8.1.1321: no docs or tests for listener functions
Bram Moolenaar <Bram@vim.org>
parents:
16634
diff
changeset
|
1338 buf_T * |
15418
51b3c36b0523
patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents:
15388
diff
changeset
|
1339 get_buf_arg(typval_T *arg) |
51b3c36b0523
patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents:
15388
diff
changeset
|
1340 { |
51b3c36b0523
patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents:
15388
diff
changeset
|
1341 buf_T *buf; |
51b3c36b0523
patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents:
15388
diff
changeset
|
1342 |
51b3c36b0523
patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents:
15388
diff
changeset
|
1343 ++emsg_off; |
51b3c36b0523
patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents:
15388
diff
changeset
|
1344 buf = tv_get_buf(arg, FALSE); |
51b3c36b0523
patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents:
15388
diff
changeset
|
1345 --emsg_off; |
51b3c36b0523
patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents:
15388
diff
changeset
|
1346 if (buf == NULL) |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
1347 semsg(_("E158: Invalid buffer name: %s"), tv_get_string(arg)); |
15418
51b3c36b0523
patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents:
15388
diff
changeset
|
1348 return buf; |
51b3c36b0523
patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents:
15388
diff
changeset
|
1349 } |
51b3c36b0523
patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents:
15388
diff
changeset
|
1350 |
51b3c36b0523
patch 8.1.0717: there is no function for the ":sign jump" command
Bram Moolenaar <Bram@vim.org>
parents:
15388
diff
changeset
|
1351 /* |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1352 * "byte2line(byte)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1353 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1354 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1355 f_byte2line(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1356 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1357 #ifndef FEAT_BYTEOFF |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1358 rettv->vval.v_number = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1359 #else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1360 long boff = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1361 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1362 boff = tv_get_number(&argvars[0]) - 1; // boff gets -1 on type error |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1363 if (boff < 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1364 rettv->vval.v_number = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1365 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1366 rettv->vval.v_number = ml_find_line_or_offset(curbuf, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1367 (linenr_T)0, &boff); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1368 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1369 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1370 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1371 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1372 byteidx(typval_T *argvars, typval_T *rettv, int comp UNUSED) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1373 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1374 char_u *t; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1375 char_u *str; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1376 varnumber_T idx; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1377 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1378 str = tv_get_string_chk(&argvars[0]); |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1379 idx = tv_get_number_chk(&argvars[1], NULL); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1380 rettv->vval.v_number = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1381 if (str == NULL || idx < 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1382 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1383 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1384 t = str; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1385 for ( ; idx > 0; idx--) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1386 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1387 if (*t == NUL) // EOL reached |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1388 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1389 if (enc_utf8 && comp) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1390 t += utf_ptr2len(t); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1391 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1392 t += (*mb_ptr2len)(t); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1393 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1394 rettv->vval.v_number = (varnumber_T)(t - str); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1395 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1396 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1397 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1398 * "byteidx()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1399 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1400 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1401 f_byteidx(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1402 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1403 byteidx(argvars, rettv, FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1404 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1405 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1406 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1407 * "byteidxcomp()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1408 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1409 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1410 f_byteidxcomp(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1411 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1412 byteidx(argvars, rettv, TRUE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1413 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1414 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1415 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1416 * "call(func, arglist [, dict])" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1417 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1418 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1419 f_call(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1420 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1421 char_u *func; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1422 partial_T *partial = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1423 dict_T *selfdict = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1424 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1425 if (argvars[1].v_type != VAR_LIST) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1426 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
1427 emsg(_(e_listreq)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1428 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1429 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1430 if (argvars[1].vval.v_list == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1431 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1432 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1433 if (argvars[0].v_type == VAR_FUNC) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1434 func = argvars[0].vval.v_string; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1435 else if (argvars[0].v_type == VAR_PARTIAL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1436 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1437 partial = argvars[0].vval.v_partial; |
9723
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
1438 func = partial_name(partial); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1439 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1440 else |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1441 func = tv_get_string(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1442 if (*func == NUL) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1443 return; // type error or empty name |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1444 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1445 if (argvars[2].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1446 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1447 if (argvars[2].v_type != VAR_DICT) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1448 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
1449 emsg(_(e_dictreq)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1450 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1451 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1452 selfdict = argvars[2].vval.v_dict; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1453 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1454 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1455 (void)func_call(func, &argvars[1], partial, selfdict, rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1456 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1457 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1458 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1459 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1460 * "ceil({float})" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1461 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1462 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1463 f_ceil(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1464 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1465 float_T f = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1466 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1467 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1468 if (get_float_arg(argvars, &f) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1469 rettv->vval.v_float = ceil(f); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1470 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1471 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1472 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1473 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1474 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1475 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1476 * "changenr()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1477 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1478 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1479 f_changenr(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1480 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1481 rettv->vval.v_number = curbuf->b_u_seq_cur; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1482 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1483 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1484 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1485 * "char2nr(string)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1486 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1487 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1488 f_char2nr(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1489 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1490 if (has_mbyte) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1491 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1492 int utf8 = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1493 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1494 if (argvars[1].v_type != VAR_UNKNOWN) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1495 utf8 = (int)tv_get_number_chk(&argvars[1], NULL); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1496 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1497 if (utf8) |
15967
ddd82b1c9e9d
patch 8.1.0989: various small code ugliness
Bram Moolenaar <Bram@vim.org>
parents:
15955
diff
changeset
|
1498 rettv->vval.v_number = utf_ptr2char(tv_get_string(&argvars[0])); |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1499 else |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1500 rettv->vval.v_number = (*mb_ptr2char)(tv_get_string(&argvars[0])); |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1501 } |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1502 else |
15595
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15579
diff
changeset
|
1503 rettv->vval.v_number = tv_get_string(&argvars[0])[0]; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1504 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1505 |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17377
diff
changeset
|
1506 win_T * |
16158
aef0f93d3eba
patch 8.1.1084: cannot delete a match from another window
Bram Moolenaar <Bram@vim.org>
parents:
16144
diff
changeset
|
1507 get_optional_window(typval_T *argvars, int idx) |
aef0f93d3eba
patch 8.1.1084: cannot delete a match from another window
Bram Moolenaar <Bram@vim.org>
parents:
16144
diff
changeset
|
1508 { |
aef0f93d3eba
patch 8.1.1084: cannot delete a match from another window
Bram Moolenaar <Bram@vim.org>
parents:
16144
diff
changeset
|
1509 win_T *win = curwin; |
aef0f93d3eba
patch 8.1.1084: cannot delete a match from another window
Bram Moolenaar <Bram@vim.org>
parents:
16144
diff
changeset
|
1510 |
aef0f93d3eba
patch 8.1.1084: cannot delete a match from another window
Bram Moolenaar <Bram@vim.org>
parents:
16144
diff
changeset
|
1511 if (argvars[idx].v_type != VAR_UNKNOWN) |
aef0f93d3eba
patch 8.1.1084: cannot delete a match from another window
Bram Moolenaar <Bram@vim.org>
parents:
16144
diff
changeset
|
1512 { |
aef0f93d3eba
patch 8.1.1084: cannot delete a match from another window
Bram Moolenaar <Bram@vim.org>
parents:
16144
diff
changeset
|
1513 win = find_win_by_nr_or_id(&argvars[idx]); |
aef0f93d3eba
patch 8.1.1084: cannot delete a match from another window
Bram Moolenaar <Bram@vim.org>
parents:
16144
diff
changeset
|
1514 if (win == NULL) |
aef0f93d3eba
patch 8.1.1084: cannot delete a match from another window
Bram Moolenaar <Bram@vim.org>
parents:
16144
diff
changeset
|
1515 { |
aef0f93d3eba
patch 8.1.1084: cannot delete a match from another window
Bram Moolenaar <Bram@vim.org>
parents:
16144
diff
changeset
|
1516 emsg(_(e_invalwindow)); |
aef0f93d3eba
patch 8.1.1084: cannot delete a match from another window
Bram Moolenaar <Bram@vim.org>
parents:
16144
diff
changeset
|
1517 return NULL; |
aef0f93d3eba
patch 8.1.1084: cannot delete a match from another window
Bram Moolenaar <Bram@vim.org>
parents:
16144
diff
changeset
|
1518 } |
aef0f93d3eba
patch 8.1.1084: cannot delete a match from another window
Bram Moolenaar <Bram@vim.org>
parents:
16144
diff
changeset
|
1519 } |
aef0f93d3eba
patch 8.1.1084: cannot delete a match from another window
Bram Moolenaar <Bram@vim.org>
parents:
16144
diff
changeset
|
1520 return win; |
aef0f93d3eba
patch 8.1.1084: cannot delete a match from another window
Bram Moolenaar <Bram@vim.org>
parents:
16144
diff
changeset
|
1521 } |
aef0f93d3eba
patch 8.1.1084: cannot delete a match from another window
Bram Moolenaar <Bram@vim.org>
parents:
16144
diff
changeset
|
1522 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1523 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1524 * "col(string)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1525 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1526 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1527 f_col(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1528 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1529 colnr_T col = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1530 pos_T *fp; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1531 int fnum = curbuf->b_fnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1532 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1533 fp = var2fpos(&argvars[0], FALSE, &fnum); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1534 if (fp != NULL && fnum == curbuf->b_fnum) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1535 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1536 if (fp->col == MAXCOL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1537 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1538 // '> can be MAXCOL, get the length of the line then |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1539 if (fp->lnum <= curbuf->b_ml.ml_line_count) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1540 col = (colnr_T)STRLEN(ml_get(fp->lnum)) + 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1541 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1542 col = MAXCOL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1543 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1544 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1545 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1546 col = fp->col + 1; |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1547 // col(".") when the cursor is on the NUL at the end of the line |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1548 // because of "coladd" can be seen as an extra column. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1549 if (virtual_active() && fp == &curwin->w_cursor) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1550 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1551 char_u *p = ml_get_cursor(); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1552 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1553 if (curwin->w_cursor.coladd >= (colnr_T)chartabsize(p, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1554 curwin->w_virtcol - curwin->w_cursor.coladd)) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1555 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1556 int l; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1557 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1558 if (*p != NUL && p[(l = (*mb_ptr2len)(p))] == NUL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1559 col += l; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1560 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1561 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1562 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1563 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1564 rettv->vval.v_number = col; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1565 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1566 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1567 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1568 * "confirm(message, buttons[, default [, type]])" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1569 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1570 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1571 f_confirm(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1572 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1573 #if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1574 char_u *message; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1575 char_u *buttons = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1576 char_u buf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1577 char_u buf2[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1578 int def = 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1579 int type = VIM_GENERIC; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1580 char_u *typestr; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1581 int error = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1582 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1583 message = tv_get_string_chk(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1584 if (message == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1585 error = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1586 if (argvars[1].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1587 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1588 buttons = tv_get_string_buf_chk(&argvars[1], buf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1589 if (buttons == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1590 error = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1591 if (argvars[2].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1592 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1593 def = (int)tv_get_number_chk(&argvars[2], &error); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1594 if (argvars[3].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1595 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1596 typestr = tv_get_string_buf_chk(&argvars[3], buf2); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1597 if (typestr == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1598 error = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1599 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1600 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1601 switch (TOUPPER_ASC(*typestr)) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1602 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1603 case 'E': type = VIM_ERROR; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1604 case 'Q': type = VIM_QUESTION; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1605 case 'I': type = VIM_INFO; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1606 case 'W': type = VIM_WARNING; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1607 case 'G': type = VIM_GENERIC; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1608 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1609 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1610 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1611 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1612 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1613 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1614 if (buttons == NULL || *buttons == NUL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1615 buttons = (char_u *)_("&Ok"); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1616 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1617 if (!error) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1618 rettv->vval.v_number = do_dialog(type, NULL, message, buttons, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1619 def, NULL, FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1620 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1621 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1622 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1623 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1624 * "copy()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1625 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1626 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1627 f_copy(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1628 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1629 item_copy(&argvars[0], rettv, FALSE, 0); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1630 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1631 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1632 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1633 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1634 * "cos()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1635 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1636 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1637 f_cos(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1638 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1639 float_T f = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1640 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1641 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1642 if (get_float_arg(argvars, &f) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1643 rettv->vval.v_float = cos(f); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1644 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1645 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1646 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1647 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1648 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1649 * "cosh()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1650 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1651 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1652 f_cosh(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1653 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1654 float_T f = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1655 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1656 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1657 if (get_float_arg(argvars, &f) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1658 rettv->vval.v_float = cosh(f); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1659 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1660 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1661 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1662 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1663 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1664 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1665 * "cursor(lnum, col)" function, or |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1666 * "cursor(list)" |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1667 * |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1668 * Moves the cursor to the specified line and column. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1669 * Returns 0 when the position could be set, -1 otherwise. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1670 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1671 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1672 f_cursor(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1673 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1674 long line, col; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1675 long coladd = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1676 int set_curswant = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1677 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1678 rettv->vval.v_number = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1679 if (argvars[1].v_type == VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1680 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1681 pos_T pos; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1682 colnr_T curswant = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1683 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1684 if (list2fpos(argvars, &pos, NULL, &curswant) == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1685 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
1686 emsg(_(e_invarg)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1687 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1688 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1689 line = pos.lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1690 col = pos.col; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1691 coladd = pos.coladd; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1692 if (curswant >= 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1693 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1694 curwin->w_curswant = curswant - 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1695 set_curswant = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1696 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1697 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1698 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1699 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1700 line = tv_get_lnum(argvars); |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1701 col = (long)tv_get_number_chk(&argvars[1], NULL); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1702 if (argvars[2].v_type != VAR_UNKNOWN) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1703 coladd = (long)tv_get_number_chk(&argvars[2], NULL); |
15636
6f1c7e9a6393
patch 8.1.0826: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
1704 } |
6f1c7e9a6393
patch 8.1.0826: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
1705 if (line < 0 || col < 0 || coladd < 0) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1706 return; // type error; errmsg already given |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1707 if (line > 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1708 curwin->w_cursor.lnum = line; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1709 if (col > 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1710 curwin->w_cursor.col = col - 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1711 curwin->w_cursor.coladd = coladd; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1712 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1713 // Make sure the cursor is in a valid position. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1714 check_cursor(); |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1715 // Correct cursor for multi-byte character. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1716 if (has_mbyte) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1717 mb_adjust_cursor(); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1718 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1719 curwin->w_set_curswant = set_curswant; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1720 rettv->vval.v_number = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1721 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1722 |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
1723 #ifdef MSWIN |
14147
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1724 /* |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1725 * "debugbreak()" function |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1726 */ |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1727 static void |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1728 f_debugbreak(typval_T *argvars, typval_T *rettv) |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1729 { |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1730 int pid; |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1731 |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1732 rettv->vval.v_number = FAIL; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1733 pid = (int)tv_get_number(&argvars[0]); |
14147
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1734 if (pid == 0) |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
1735 emsg(_(e_invarg)); |
14147
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1736 else |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1737 { |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1738 HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid); |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1739 |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1740 if (hProcess != NULL) |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1741 { |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1742 DebugBreakProcess(hProcess); |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1743 CloseHandle(hProcess); |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1744 rettv->vval.v_number = OK; |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1745 } |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1746 } |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1747 } |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1748 #endif |
de75c249723d
patch 8.1.0091: MS-Windows: Cannot interrupt gdb when program is running
Christian Brabandt <cb@256bit.org>
parents:
14103
diff
changeset
|
1749 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1750 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1751 * "deepcopy()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1752 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1753 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1754 f_deepcopy(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1755 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1756 int noref = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1757 int copyID; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1758 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1759 if (argvars[1].v_type != VAR_UNKNOWN) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1760 noref = (int)tv_get_number_chk(&argvars[1], NULL); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1761 if (noref < 0 || noref > 1) |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
1762 emsg(_(e_invarg)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1763 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1764 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1765 copyID = get_copyID(); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1766 item_copy(&argvars[0], rettv, TRUE, noref == 0 ? copyID : 0); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1767 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1768 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1769 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1770 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1771 * "did_filetype()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1772 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1773 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1774 f_did_filetype(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1775 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1776 rettv->vval.v_number = did_filetype; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1777 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1778 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1779 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1780 * "empty({expr})" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1781 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1782 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1783 f_empty(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1784 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1785 int n = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1786 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1787 switch (argvars[0].v_type) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1788 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1789 case VAR_STRING: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1790 case VAR_FUNC: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1791 n = argvars[0].vval.v_string == NULL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1792 || *argvars[0].vval.v_string == NUL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1793 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1794 case VAR_PARTIAL: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1795 n = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1796 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1797 case VAR_NUMBER: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1798 n = argvars[0].vval.v_number == 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1799 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1800 case VAR_FLOAT: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1801 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1802 n = argvars[0].vval.v_float == 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1803 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1804 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1805 case VAR_LIST: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1806 n = argvars[0].vval.v_list == NULL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1807 || argvars[0].vval.v_list->lv_first == NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1808 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1809 case VAR_DICT: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1810 n = argvars[0].vval.v_dict == NULL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1811 || argvars[0].vval.v_dict->dv_hashtab.ht_used == 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1812 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1813 case VAR_SPECIAL: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1814 n = argvars[0].vval.v_number != VVAL_TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1815 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1816 |
15454
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
1817 case VAR_BLOB: |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
1818 n = argvars[0].vval.v_blob == NULL |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
1819 || argvars[0].vval.v_blob->bv_ga.ga_len == 0; |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
1820 break; |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
1821 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1822 case VAR_JOB: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1823 #ifdef FEAT_JOB_CHANNEL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1824 n = argvars[0].vval.v_job == NULL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1825 || argvars[0].vval.v_job->jv_status != JOB_STARTED; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1826 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1827 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1828 case VAR_CHANNEL: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1829 #ifdef FEAT_JOB_CHANNEL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1830 n = argvars[0].vval.v_channel == NULL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1831 || !channel_is_open(argvars[0].vval.v_channel); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1832 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1833 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1834 case VAR_UNKNOWN: |
10359
66f1b5bf3fa6
commit https://github.com/vim/vim/commit/95f096030ed1a8afea028f2ea295d6f6a70f466f
Christian Brabandt <cb@256bit.org>
parents:
10277
diff
changeset
|
1835 internal_error("f_empty(UNKNOWN)"); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1836 n = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1837 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1838 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1839 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1840 rettv->vval.v_number = n; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1841 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1842 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1843 /* |
16604
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1844 * "environ()" function |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1845 */ |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1846 static void |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1847 f_environ(typval_T *argvars UNUSED, typval_T *rettv) |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1848 { |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1849 #if !defined(AMIGA) |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1850 int i = 0; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1851 char_u *entry, *value; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1852 # ifdef MSWIN |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1853 extern wchar_t **_wenviron; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1854 # else |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1855 extern char **environ; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1856 # endif |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1857 |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1858 if (rettv_dict_alloc(rettv) != OK) |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1859 return; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1860 |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1861 # ifdef MSWIN |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1862 if (*_wenviron == NULL) |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1863 return; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1864 # else |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1865 if (*environ == NULL) |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1866 return; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1867 # endif |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1868 |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1869 for (i = 0; ; ++i) |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1870 { |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1871 # ifdef MSWIN |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1872 short_u *p; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1873 |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1874 if ((p = (short_u *)_wenviron[i]) == NULL) |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1875 return; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1876 entry = utf16_to_enc(p, NULL); |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1877 # else |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1878 if ((entry = (char_u *)environ[i]) == NULL) |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1879 return; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1880 entry = vim_strsave(entry); |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1881 # endif |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1882 if (entry == NULL) // out of memory |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1883 return; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1884 if ((value = vim_strchr(entry, '=')) == NULL) |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1885 { |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1886 vim_free(entry); |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1887 continue; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1888 } |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1889 *value++ = NUL; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1890 dict_add_string(rettv->vval.v_dict, (char *)entry, value); |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1891 vim_free(entry); |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1892 } |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1893 #endif |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1894 } |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1895 |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
1896 /* |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1897 * "escape({string}, {chars})" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1898 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1899 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1900 f_escape(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1901 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1902 char_u buf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1903 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1904 rettv->vval.v_string = vim_strsave_escaped(tv_get_string(&argvars[0]), |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1905 tv_get_string_buf(&argvars[1], buf)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1906 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1907 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1908 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1909 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1910 * "eval()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1911 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1912 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1913 f_eval(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1914 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1915 char_u *s, *p; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1916 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1917 s = tv_get_string_chk(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1918 if (s != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1919 s = skipwhite(s); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1920 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1921 p = s; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1922 if (s == NULL || eval1(&s, rettv, TRUE) == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1923 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1924 if (p != NULL && !aborting()) |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
1925 semsg(_(e_invexpr2), p); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1926 need_clr_eos = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1927 rettv->v_type = VAR_NUMBER; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1928 rettv->vval.v_number = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1929 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1930 else if (*s != NUL) |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
1931 emsg(_(e_trailing)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1932 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1933 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1934 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1935 * "eventhandler()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1936 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1937 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1938 f_eventhandler(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1939 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1940 rettv->vval.v_number = vgetc_busy; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1941 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1942 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1943 static garray_T redir_execute_ga; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1944 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1945 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1946 * Append "value[value_len]" to the execute() output. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1947 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1948 void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1949 execute_redir_str(char_u *value, int value_len) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1950 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1951 int len; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1952 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1953 if (value_len == -1) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1954 len = (int)STRLEN(value); // Append the entire string |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1955 else |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1956 len = value_len; // Append only "value_len" characters |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1957 if (ga_grow(&redir_execute_ga, len) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1958 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1959 mch_memmove((char *)redir_execute_ga.ga_data |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1960 + redir_execute_ga.ga_len, value, len); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1961 redir_execute_ga.ga_len += len; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1962 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1963 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1964 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1965 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1966 * Get next line from a list. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1967 * Called by do_cmdline() to get the next line. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1968 * Returns allocated string, or NULL for end of function. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1969 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1970 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1971 static char_u * |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1972 get_list_line( |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1973 int c UNUSED, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1974 void *cookie, |
17178
40c4cb095d53
patch 8.1.1588: in :let-heredoc line continuation is recognized
Bram Moolenaar <Bram@vim.org>
parents:
17170
diff
changeset
|
1975 int indent UNUSED, |
40c4cb095d53
patch 8.1.1588: in :let-heredoc line continuation is recognized
Bram Moolenaar <Bram@vim.org>
parents:
17170
diff
changeset
|
1976 int do_concat UNUSED) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1977 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1978 listitem_T **p = (listitem_T **)cookie; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1979 listitem_T *item = *p; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1980 char_u buf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1981 char_u *s; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1982 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1983 if (item == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1984 return NULL; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
1985 s = tv_get_string_buf_chk(&item->li_tv, buf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1986 *p = item->li_next; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1987 return s == NULL ? NULL : vim_strsave(s); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1988 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1989 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1990 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1991 * "execute()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1992 */ |
18010
cf8e0c7e0cb9
patch 8.1.2001: some source files are too big
Bram Moolenaar <Bram@vim.org>
parents:
18008
diff
changeset
|
1993 void |
16833
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
1994 execute_common(typval_T *argvars, typval_T *rettv, int arg_off) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1995 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1996 char_u *cmd = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1997 list_T *list = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1998 int save_msg_silent = msg_silent; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
1999 int save_emsg_silent = emsg_silent; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2000 int save_emsg_noredir = emsg_noredir; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2001 int save_redir_execute = redir_execute; |
13101
9b3f8029a326
patch 8.0.1425: execute() does not work in completion of user command
Christian Brabandt <cb@256bit.org>
parents:
13088
diff
changeset
|
2002 int save_redir_off = redir_off; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2003 garray_T save_ga; |
15117
2fed75dee954
patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15062
diff
changeset
|
2004 int save_msg_col = msg_col; |
15121
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
2005 int echo_output = FALSE; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2006 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2007 rettv->vval.v_string = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2008 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2009 |
16833
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
2010 if (argvars[arg_off].v_type == VAR_LIST) |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
2011 { |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
2012 list = argvars[arg_off].vval.v_list; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2013 if (list == NULL || list->lv_first == NULL) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2014 // empty list, no commands, empty output |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2015 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2016 ++list->lv_refcount; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2017 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2018 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2019 { |
16833
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
2020 cmd = tv_get_string_chk(&argvars[arg_off]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2021 if (cmd == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2022 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2023 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2024 |
16833
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
2025 if (argvars[arg_off + 1].v_type != VAR_UNKNOWN) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2026 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2027 char_u buf[NUMBUFLEN]; |
16833
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
2028 char_u *s = tv_get_string_buf_chk(&argvars[arg_off + 1], buf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2029 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2030 if (s == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2031 return; |
15121
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
2032 if (*s == NUL) |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
2033 echo_output = TRUE; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2034 if (STRNCMP(s, "silent", 6) == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2035 ++msg_silent; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2036 if (STRCMP(s, "silent!") == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2037 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2038 emsg_silent = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2039 emsg_noredir = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2040 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2041 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2042 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2043 ++msg_silent; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2044 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2045 if (redir_execute) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2046 save_ga = redir_execute_ga; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2047 ga_init2(&redir_execute_ga, (int)sizeof(char), 500); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2048 redir_execute = TRUE; |
13101
9b3f8029a326
patch 8.0.1425: execute() does not work in completion of user command
Christian Brabandt <cb@256bit.org>
parents:
13088
diff
changeset
|
2049 redir_off = FALSE; |
15121
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
2050 if (!echo_output) |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
2051 msg_col = 0; // prevent leading spaces |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2052 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2053 if (cmd != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2054 do_cmdline_cmd(cmd); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2055 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2056 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2057 listitem_T *item = list->lv_first; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2058 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2059 do_cmdline(NULL, get_list_line, (void *)&item, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2060 DOCMD_NOWAIT|DOCMD_VERBOSE|DOCMD_REPEAT|DOCMD_KEYTYPED); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2061 --list->lv_refcount; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2062 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2063 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2064 // Need to append a NUL to the result. |
10749
a7789921b514
patch 8.0.0264: memory error reported by ubsan
Christian Brabandt <cb@256bit.org>
parents:
10732
diff
changeset
|
2065 if (ga_grow(&redir_execute_ga, 1) == OK) |
a7789921b514
patch 8.0.0264: memory error reported by ubsan
Christian Brabandt <cb@256bit.org>
parents:
10732
diff
changeset
|
2066 { |
a7789921b514
patch 8.0.0264: memory error reported by ubsan
Christian Brabandt <cb@256bit.org>
parents:
10732
diff
changeset
|
2067 ((char *)redir_execute_ga.ga_data)[redir_execute_ga.ga_len] = NUL; |
a7789921b514
patch 8.0.0264: memory error reported by ubsan
Christian Brabandt <cb@256bit.org>
parents:
10732
diff
changeset
|
2068 rettv->vval.v_string = redir_execute_ga.ga_data; |
a7789921b514
patch 8.0.0264: memory error reported by ubsan
Christian Brabandt <cb@256bit.org>
parents:
10732
diff
changeset
|
2069 } |
a7789921b514
patch 8.0.0264: memory error reported by ubsan
Christian Brabandt <cb@256bit.org>
parents:
10732
diff
changeset
|
2070 else |
a7789921b514
patch 8.0.0264: memory error reported by ubsan
Christian Brabandt <cb@256bit.org>
parents:
10732
diff
changeset
|
2071 { |
a7789921b514
patch 8.0.0264: memory error reported by ubsan
Christian Brabandt <cb@256bit.org>
parents:
10732
diff
changeset
|
2072 ga_clear(&redir_execute_ga); |
a7789921b514
patch 8.0.0264: memory error reported by ubsan
Christian Brabandt <cb@256bit.org>
parents:
10732
diff
changeset
|
2073 rettv->vval.v_string = NULL; |
a7789921b514
patch 8.0.0264: memory error reported by ubsan
Christian Brabandt <cb@256bit.org>
parents:
10732
diff
changeset
|
2074 } |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2075 msg_silent = save_msg_silent; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2076 emsg_silent = save_emsg_silent; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2077 emsg_noredir = save_emsg_noredir; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2078 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2079 redir_execute = save_redir_execute; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2080 if (redir_execute) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2081 redir_execute_ga = save_ga; |
13101
9b3f8029a326
patch 8.0.1425: execute() does not work in completion of user command
Christian Brabandt <cb@256bit.org>
parents:
13088
diff
changeset
|
2082 redir_off = save_redir_off; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2083 |
15117
2fed75dee954
patch 8.1.0569: execute() always resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15062
diff
changeset
|
2084 // "silent reg" or "silent echo x" leaves msg_col somewhere in the line. |
15121
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
2085 if (echo_output) |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
2086 // When not working silently: put it in column zero. A following |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
2087 // "echon" will overwrite the message, unavoidably. |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
2088 msg_col = 0; |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
2089 else |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
2090 // When working silently: Put it back where it was, since nothing |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
2091 // should have been written. |
895abc8a5195
patch 8.1.0571: non-silent execute() resets display column to zero
Bram Moolenaar <Bram@vim.org>
parents:
15117
diff
changeset
|
2092 msg_col = save_msg_col; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2093 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2094 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2095 /* |
16833
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
2096 * "execute()" function |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
2097 */ |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
2098 static void |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
2099 f_execute(typval_T *argvars, typval_T *rettv) |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
2100 { |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
2101 execute_common(argvars, rettv, 0); |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
2102 } |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
2103 |
6699c03347d2
patch 8.1.1418: win_execute() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16829
diff
changeset
|
2104 /* |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2105 * "exists()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2106 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2107 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2108 f_exists(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2109 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2110 char_u *p; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2111 int n = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2112 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
2113 p = tv_get_string(&argvars[0]); |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2114 if (*p == '$') // environment variable |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2115 { |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2116 // first try "normal" environment variables (fast) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2117 if (mch_getenv(p + 1) != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2118 n = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2119 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2120 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2121 // try expanding things like $VIM and ${HOME} |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2122 p = expand_env_save(p); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2123 if (p != NULL && *p != '$') |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2124 n = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2125 vim_free(p); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2126 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2127 } |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2128 else if (*p == '&' || *p == '+') // option |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2129 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2130 n = (get_option_tv(&p, NULL, TRUE) == OK); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2131 if (*skipwhite(p) != NUL) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2132 n = FALSE; // trailing garbage |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2133 } |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2134 else if (*p == '*') // internal or user defined function |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2135 { |
9717
6226de5f8137
commit https://github.com/vim/vim/commit/b54c3ff3174dbb5dfbfcabdf95200b047beaa644
Christian Brabandt <cb@256bit.org>
parents:
9707
diff
changeset
|
2136 n = function_exists(p + 1, FALSE); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2137 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2138 else if (*p == ':') |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2139 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2140 n = cmd_exists(p + 1); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2141 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2142 else if (*p == '#') |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2143 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2144 if (p[1] == '#') |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2145 n = autocmd_supported(p + 2); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2146 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2147 n = au_exists(p + 1); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2148 } |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2149 else // internal variable |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2150 { |
13262
69278c25429d
patch 8.0.1505: debugger can't break on a condition
Christian Brabandt <cb@256bit.org>
parents:
13248
diff
changeset
|
2151 n = var_exists(p); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2152 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2153 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2154 rettv->vval.v_number = n; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2155 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2156 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2157 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2158 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2159 * "exp()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2160 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2161 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2162 f_exp(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2163 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2164 float_T f = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2165 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2166 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2167 if (get_float_arg(argvars, &f) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2168 rettv->vval.v_float = exp(f); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2169 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2170 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2171 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2172 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2173 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2174 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2175 * "expand()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2176 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2177 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2178 f_expand(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2179 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2180 char_u *s; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2181 int len; |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
2182 char *errormsg; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2183 int options = WILD_SILENT|WILD_USE_NL|WILD_LIST_NOTFOUND; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2184 expand_T xpc; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2185 int error = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2186 char_u *result; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2187 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2188 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2189 if (argvars[1].v_type != VAR_UNKNOWN |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2190 && argvars[2].v_type != VAR_UNKNOWN |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
2191 && tv_get_number_chk(&argvars[2], &error) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2192 && !error) |
11418
162bcd0debd7
patch 8.0.0593: duplication of code for adding a list or dict return value
Christian Brabandt <cb@256bit.org>
parents:
11341
diff
changeset
|
2193 rettv_list_set(rettv, NULL); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2194 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
2195 s = tv_get_string(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2196 if (*s == '%' || *s == '#' || *s == '<') |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2197 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2198 ++emsg_off; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2199 result = eval_vars(s, s, &len, NULL, &errormsg, NULL); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2200 --emsg_off; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2201 if (rettv->v_type == VAR_LIST) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2202 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2203 if (rettv_list_alloc(rettv) != FAIL && result != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2204 list_append_string(rettv->vval.v_list, result, -1); |
18225
6c3a8312486d
patch 8.1.2107: various memory leaks reported by asan
Bram Moolenaar <Bram@vim.org>
parents:
18203
diff
changeset
|
2205 vim_free(result); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2206 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2207 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2208 rettv->vval.v_string = result; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2209 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2210 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2211 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2212 // When the optional second argument is non-zero, don't remove matches |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2213 // for 'wildignore' and don't put matches for 'suffixes' at the end. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2214 if (argvars[1].v_type != VAR_UNKNOWN |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
2215 && tv_get_number_chk(&argvars[1], &error)) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2216 options |= WILD_KEEP_ALL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2217 if (!error) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2218 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2219 ExpandInit(&xpc); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2220 xpc.xp_context = EXPAND_FILES; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2221 if (p_wic) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2222 options += WILD_ICASE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2223 if (rettv->v_type == VAR_STRING) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2224 rettv->vval.v_string = ExpandOne(&xpc, s, NULL, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2225 options, WILD_ALL); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2226 else if (rettv_list_alloc(rettv) != FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2227 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2228 int i; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2229 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2230 ExpandOne(&xpc, s, NULL, options, WILD_ALL_KEEP); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2231 for (i = 0; i < xpc.xp_numfiles; i++) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2232 list_append_string(rettv->vval.v_list, xpc.xp_files[i], -1); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2233 ExpandCleanup(&xpc); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2234 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2235 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2236 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2237 rettv->vval.v_string = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2238 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2239 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2240 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2241 /* |
17020
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2242 * "expandcmd()" function |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2243 * Expand all the special characters in a command string. |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2244 */ |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2245 static void |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2246 f_expandcmd(typval_T *argvars, typval_T *rettv) |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2247 { |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2248 exarg_T eap; |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2249 char_u *cmdstr; |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2250 char *errormsg = NULL; |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2251 |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2252 rettv->v_type = VAR_STRING; |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2253 cmdstr = vim_strsave(tv_get_string(&argvars[0])); |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2254 |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2255 memset(&eap, 0, sizeof(eap)); |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2256 eap.cmd = cmdstr; |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2257 eap.arg = cmdstr; |
17336
81705f4d9e03
patch 8.1.1667: flags for Ex commands may clash with other symbols
Bram Moolenaar <Bram@vim.org>
parents:
17292
diff
changeset
|
2258 eap.argt |= EX_NOSPC; |
17020
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2259 eap.usefilter = FALSE; |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2260 eap.nextcmd = NULL; |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2261 eap.cmdidx = CMD_USER; |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2262 |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2263 expand_filename(&eap, &cmdstr, &errormsg); |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2264 if (errormsg != NULL && *errormsg != NUL) |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2265 emsg(errormsg); |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2266 |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2267 rettv->vval.v_string = cmdstr; |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2268 } |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2269 |
1841c03a9b5e
patch 8.1.1510: a plugin cannot easily expand a command like done internally
Bram Moolenaar <Bram@vim.org>
parents:
17004
diff
changeset
|
2270 /* |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2271 * "feedkeys()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2272 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2273 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2274 f_feedkeys(typval_T *argvars, typval_T *rettv UNUSED) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2275 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2276 int remap = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2277 int insert = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2278 char_u *keys, *flags; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2279 char_u nbuf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2280 int typed = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2281 int execute = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2282 int dangerous = FALSE; |
15615
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
15595
diff
changeset
|
2283 int lowlevel = FALSE; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2284 char_u *keys_esc; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2285 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2286 // This is not allowed in the sandbox. If the commands would still be |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2287 // executed in the sandbox it would be OK, but it probably happens later, |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2288 // when "sandbox" is no longer set. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2289 if (check_secure()) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2290 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2291 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
2292 keys = tv_get_string(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2293 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2294 if (argvars[1].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2295 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
2296 flags = tv_get_string_buf(&argvars[1], nbuf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2297 for ( ; *flags != NUL; ++flags) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2298 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2299 switch (*flags) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2300 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2301 case 'n': remap = FALSE; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2302 case 'm': remap = TRUE; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2303 case 't': typed = TRUE; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2304 case 'i': insert = TRUE; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2305 case 'x': execute = TRUE; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2306 case '!': dangerous = TRUE; break; |
15615
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
15595
diff
changeset
|
2307 case 'L': lowlevel = TRUE; break; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2308 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2309 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2310 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2311 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2312 if (*keys != NUL || execute) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2313 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2314 // Need to escape K_SPECIAL and CSI before putting the string in the |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2315 // typeahead buffer. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2316 keys_esc = vim_strsave_escape_csi(keys); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2317 if (keys_esc != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2318 { |
15615
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
15595
diff
changeset
|
2319 if (lowlevel) |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
15595
diff
changeset
|
2320 { |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
15595
diff
changeset
|
2321 #ifdef USE_INPUT_BUF |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
15595
diff
changeset
|
2322 add_to_input_buf(keys, (int)STRLEN(keys)); |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
15595
diff
changeset
|
2323 #else |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
15595
diff
changeset
|
2324 emsg(_("E980: lowlevel input not supported")); |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
15595
diff
changeset
|
2325 #endif |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
15595
diff
changeset
|
2326 } |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
15595
diff
changeset
|
2327 else |
15687
cb501b3c9fb5
patch 8.1.0851: feedkeys() with "L" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
2328 { |
15615
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
15595
diff
changeset
|
2329 ins_typebuf(keys_esc, (remap ? REMAP_YES : REMAP_NONE), |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2330 insert ? 0 : typebuf.tb_len, !typed, FALSE); |
15687
cb501b3c9fb5
patch 8.1.0851: feedkeys() with "L" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
2331 if (vgetc_busy |
11583
ef8b233f07ae
patch 8.0.0674: cannot build with eval but without timers
Christian Brabandt <cb@256bit.org>
parents:
11575
diff
changeset
|
2332 #ifdef FEAT_TIMERS |
15687
cb501b3c9fb5
patch 8.1.0851: feedkeys() with "L" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
2333 || timer_busy |
cb501b3c9fb5
patch 8.1.0851: feedkeys() with "L" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
2334 #endif |
cb501b3c9fb5
patch 8.1.0851: feedkeys() with "L" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
2335 ) |
cb501b3c9fb5
patch 8.1.0851: feedkeys() with "L" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
2336 typebuf_was_filled = TRUE; |
cb501b3c9fb5
patch 8.1.0851: feedkeys() with "L" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
2337 } |
cb501b3c9fb5
patch 8.1.0851: feedkeys() with "L" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
2338 vim_free(keys_esc); |
cb501b3c9fb5
patch 8.1.0851: feedkeys() with "L" does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
2339 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2340 if (execute) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2341 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2342 int save_msg_scroll = msg_scroll; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2343 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2344 // Avoid a 1 second delay when the keys start Insert mode. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2345 msg_scroll = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2346 |
13829
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13796
diff
changeset
|
2347 if (!dangerous) |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13796
diff
changeset
|
2348 ++ex_normal_busy; |
16263
d3377393e3d9
patch 8.1.1136: decoding of mouse click escape sequence is not tested
Bram Moolenaar <Bram@vim.org>
parents:
16253
diff
changeset
|
2349 exec_normal(TRUE, lowlevel, TRUE); |
13829
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13796
diff
changeset
|
2350 if (!dangerous) |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13796
diff
changeset
|
2351 --ex_normal_busy; |
044337cbf854
patch 8.0.1786: no test for 'termwinkey'
Christian Brabandt <cb@256bit.org>
parents:
13796
diff
changeset
|
2352 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2353 msg_scroll |= save_msg_scroll; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2354 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2355 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2356 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2357 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2358 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2359 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2360 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2361 * "float2nr({float})" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2362 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2363 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2364 f_float2nr(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2365 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2366 float_T f = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2367 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2368 if (get_float_arg(argvars, &f) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2369 { |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11418
diff
changeset
|
2370 if (f <= -VARNUM_MAX + DBL_EPSILON) |
10658
77d66e9ac0ab
patch 8.0.0219: ubsan reports errors for overflow
Christian Brabandt <cb@256bit.org>
parents:
10640
diff
changeset
|
2371 rettv->vval.v_number = -VARNUM_MAX; |
11461
5be73ebf6a15
patch 8.0.0614: float2nr() is not exactly right
Christian Brabandt <cb@256bit.org>
parents:
11418
diff
changeset
|
2372 else if (f >= VARNUM_MAX - DBL_EPSILON) |
10658
77d66e9ac0ab
patch 8.0.0219: ubsan reports errors for overflow
Christian Brabandt <cb@256bit.org>
parents:
10640
diff
changeset
|
2373 rettv->vval.v_number = VARNUM_MAX; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2374 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2375 rettv->vval.v_number = (varnumber_T)f; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2376 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2377 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2378 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2379 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2380 * "floor({float})" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2381 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2382 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2383 f_floor(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2384 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2385 float_T f = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2386 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2387 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2388 if (get_float_arg(argvars, &f) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2389 rettv->vval.v_float = floor(f); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2390 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2391 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2392 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2393 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2394 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2395 * "fmod()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2396 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2397 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2398 f_fmod(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2399 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2400 float_T fx = 0.0, fy = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2401 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2402 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2403 if (get_float_arg(argvars, &fx) == OK |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2404 && get_float_arg(&argvars[1], &fy) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2405 rettv->vval.v_float = fmod(fx, fy); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2406 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2407 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2408 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2409 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2410 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2411 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2412 * "fnameescape({string})" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2413 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2414 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2415 f_fnameescape(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2416 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2417 rettv->vval.v_string = vim_strsave_fnameescape( |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
2418 tv_get_string(&argvars[0]), FALSE); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2419 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2420 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2421 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2422 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2423 * "foreground()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2424 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2425 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2426 f_foreground(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2427 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2428 #ifdef FEAT_GUI |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2429 if (gui.in_use) |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16427
diff
changeset
|
2430 { |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2431 gui_mch_set_foreground(); |
16451
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16427
diff
changeset
|
2432 return; |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16427
diff
changeset
|
2433 } |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16427
diff
changeset
|
2434 #endif |
7ae2396cef62
patch 8.1.1230: a lot of code is shared between vim.exe and gvim.exe
Bram Moolenaar <Bram@vim.org>
parents:
16427
diff
changeset
|
2435 #if defined(MSWIN) && (!defined(FEAT_GUI) || defined(VIMDLL)) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2436 win32_set_foreground(); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2437 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2438 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2439 |
9723
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2440 static void |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2441 common_function(typval_T *argvars, typval_T *rettv, int is_funcref) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2442 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2443 char_u *s; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2444 char_u *name; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2445 int use_string = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2446 partial_T *arg_pt = NULL; |
9723
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2447 char_u *trans_name = NULL; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2448 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2449 if (argvars[0].v_type == VAR_FUNC) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2450 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2451 // function(MyFunc, [arg], dict) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2452 s = argvars[0].vval.v_string; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2453 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2454 else if (argvars[0].v_type == VAR_PARTIAL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2455 && argvars[0].vval.v_partial != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2456 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2457 // function(dict.MyFunc, [arg]) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2458 arg_pt = argvars[0].vval.v_partial; |
9723
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2459 s = partial_name(arg_pt); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2460 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2461 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2462 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2463 // function('MyFunc', [arg], dict) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
2464 s = tv_get_string(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2465 use_string = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2466 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2467 |
9919
885e3c9c0e10
commit https://github.com/vim/vim/commit/843b884461de1c79a1d2748549776fb13fc94360
Christian Brabandt <cb@256bit.org>
parents:
9904
diff
changeset
|
2468 if ((use_string && vim_strchr(s, AUTOLOAD_CHAR) == NULL) || is_funcref) |
9723
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2469 { |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2470 name = s; |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2471 trans_name = trans_function_name(&name, FALSE, |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2472 TFN_INT | TFN_QUIET | TFN_NO_AUTOLOAD | TFN_NO_DEREF, NULL, NULL); |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2473 if (*name != NUL) |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2474 s = NULL; |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2475 } |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2476 |
9919
885e3c9c0e10
commit https://github.com/vim/vim/commit/843b884461de1c79a1d2748549776fb13fc94360
Christian Brabandt <cb@256bit.org>
parents:
9904
diff
changeset
|
2477 if (s == NULL || *s == NUL || (use_string && VIM_ISDIGIT(*s)) |
885e3c9c0e10
commit https://github.com/vim/vim/commit/843b884461de1c79a1d2748549776fb13fc94360
Christian Brabandt <cb@256bit.org>
parents:
9904
diff
changeset
|
2478 || (is_funcref && trans_name == NULL)) |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
2479 semsg(_(e_invarg2), use_string ? tv_get_string(&argvars[0]) : s); |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2480 // Don't check an autoload name for existence here. |
9723
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2481 else if (trans_name != NULL && (is_funcref |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2482 ? find_func(trans_name) == NULL |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2483 : !translated_function_exists(trans_name))) |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
2484 semsg(_("E700: Unknown function: %s"), s); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2485 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2486 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2487 int dict_idx = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2488 int arg_idx = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2489 list_T *list = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2490 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2491 if (STRNCMP(s, "s:", 2) == 0 || STRNCMP(s, "<SID>", 5) == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2492 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2493 char sid_buf[25]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2494 int off = *s == 's' ? 2 : 5; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2495 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2496 // Expand s: and <SID> into <SNR>nr_, so that the function can |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2497 // also be called from another script. Using trans_function_name() |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2498 // would also work, but some plugins depend on the name being |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2499 // printable text. |
14700
0a3b9ecf7cb8
patch 8.1.0362: cannot get the script line number when executing a function
Christian Brabandt <cb@256bit.org>
parents:
14673
diff
changeset
|
2500 sprintf(sid_buf, "<SNR>%ld_", (long)current_sctx.sc_sid); |
16782
fc58fee685e2
patch 8.1.1393: unnecessary type casts
Bram Moolenaar <Bram@vim.org>
parents:
16778
diff
changeset
|
2501 name = alloc(STRLEN(sid_buf) + STRLEN(s + off) + 1); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2502 if (name != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2503 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2504 STRCPY(name, sid_buf); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2505 STRCAT(name, s + off); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2506 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2507 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2508 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2509 name = vim_strsave(s); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2510 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2511 if (argvars[1].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2512 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2513 if (argvars[2].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2514 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2515 // function(name, [args], dict) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2516 arg_idx = 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2517 dict_idx = 2; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2518 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2519 else if (argvars[1].v_type == VAR_DICT) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2520 // function(name, dict) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2521 dict_idx = 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2522 else |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2523 // function(name, [args]) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2524 arg_idx = 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2525 if (dict_idx > 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2526 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2527 if (argvars[dict_idx].v_type != VAR_DICT) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2528 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
2529 emsg(_("E922: expected a dict")); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2530 vim_free(name); |
9723
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2531 goto theend; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2532 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2533 if (argvars[dict_idx].vval.v_dict == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2534 dict_idx = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2535 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2536 if (arg_idx > 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2537 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2538 if (argvars[arg_idx].v_type != VAR_LIST) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2539 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
2540 emsg(_("E923: Second argument of function() must be a list or a dict")); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2541 vim_free(name); |
9723
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2542 goto theend; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2543 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2544 list = argvars[arg_idx].vval.v_list; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2545 if (list == NULL || list->lv_len == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2546 arg_idx = 0; |
18576
e9675870c480
patch 8.1.2282: crash when passing many arguments through a partial
Bram Moolenaar <Bram@vim.org>
parents:
18358
diff
changeset
|
2547 else if (list->lv_len > MAX_FUNC_ARGS) |
e9675870c480
patch 8.1.2282: crash when passing many arguments through a partial
Bram Moolenaar <Bram@vim.org>
parents:
18358
diff
changeset
|
2548 { |
18687
81d34044450f
patch 8.1.2335: error message for function arguments may use NULL pointer
Bram Moolenaar <Bram@vim.org>
parents:
18671
diff
changeset
|
2549 emsg_funcname((char *)e_toomanyarg, s); |
18576
e9675870c480
patch 8.1.2282: crash when passing many arguments through a partial
Bram Moolenaar <Bram@vim.org>
parents:
18358
diff
changeset
|
2550 vim_free(name); |
e9675870c480
patch 8.1.2282: crash when passing many arguments through a partial
Bram Moolenaar <Bram@vim.org>
parents:
18358
diff
changeset
|
2551 goto theend; |
e9675870c480
patch 8.1.2282: crash when passing many arguments through a partial
Bram Moolenaar <Bram@vim.org>
parents:
18358
diff
changeset
|
2552 } |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2553 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2554 } |
9723
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2555 if (dict_idx > 0 || arg_idx > 0 || arg_pt != NULL || is_funcref) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2556 { |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2557 partial_T *pt = ALLOC_CLEAR_ONE(partial_T); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2558 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2559 // result is a VAR_PARTIAL |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2560 if (pt == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2561 vim_free(name); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2562 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2563 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2564 if (arg_idx > 0 || (arg_pt != NULL && arg_pt->pt_argc > 0)) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2565 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2566 listitem_T *li; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2567 int i = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2568 int arg_len = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2569 int lv_len = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2570 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2571 if (arg_pt != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2572 arg_len = arg_pt->pt_argc; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2573 if (list != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2574 lv_len = list->lv_len; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2575 pt->pt_argc = arg_len + lv_len; |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2576 pt->pt_argv = ALLOC_MULT(typval_T, pt->pt_argc); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2577 if (pt->pt_argv == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2578 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2579 vim_free(pt); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2580 vim_free(name); |
9723
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2581 goto theend; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2582 } |
9723
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2583 for (i = 0; i < arg_len; i++) |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2584 copy_tv(&arg_pt->pt_argv[i], &pt->pt_argv[i]); |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2585 if (lv_len > 0) |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2586 for (li = list->lv_first; li != NULL; |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2587 li = li->li_next) |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2588 copy_tv(&li->li_tv, &pt->pt_argv[i++]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2589 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2590 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2591 // For "function(dict.func, [], dict)" and "func" is a partial |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2592 // use "dict". That is backwards compatible. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2593 if (dict_idx > 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2594 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2595 // The dict is bound explicitly, pt_auto is FALSE. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2596 pt->pt_dict = argvars[dict_idx].vval.v_dict; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2597 ++pt->pt_dict->dv_refcount; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2598 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2599 else if (arg_pt != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2600 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2601 // If the dict was bound automatically the result is also |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2602 // bound automatically. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2603 pt->pt_dict = arg_pt->pt_dict; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2604 pt->pt_auto = arg_pt->pt_auto; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2605 if (pt->pt_dict != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2606 ++pt->pt_dict->dv_refcount; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2607 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2608 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2609 pt->pt_refcount = 1; |
9723
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2610 if (arg_pt != NULL && arg_pt->pt_func != NULL) |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2611 { |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2612 pt->pt_func = arg_pt->pt_func; |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2613 func_ptr_ref(pt->pt_func); |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2614 vim_free(name); |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2615 } |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2616 else if (is_funcref) |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2617 { |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2618 pt->pt_func = find_func(trans_name); |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2619 func_ptr_ref(pt->pt_func); |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2620 vim_free(name); |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2621 } |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2622 else |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2623 { |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2624 pt->pt_name = name; |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2625 func_ref(name); |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2626 } |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2627 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2628 rettv->v_type = VAR_PARTIAL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2629 rettv->vval.v_partial = pt; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2630 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2631 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2632 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2633 // result is a VAR_FUNC |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2634 rettv->v_type = VAR_FUNC; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2635 rettv->vval.v_string = name; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2636 func_ref(name); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2637 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2638 } |
9723
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2639 theend: |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2640 vim_free(trans_name); |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2641 } |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2642 |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2643 /* |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2644 * "funcref()" function |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2645 */ |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2646 static void |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2647 f_funcref(typval_T *argvars, typval_T *rettv) |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2648 { |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2649 common_function(argvars, rettv, TRUE); |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2650 } |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2651 |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2652 /* |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2653 * "function()" function |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2654 */ |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2655 static void |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2656 f_function(typval_T *argvars, typval_T *rettv) |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2657 { |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2658 common_function(argvars, rettv, FALSE); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2659 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2660 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2661 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2662 * "garbagecollect()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2663 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2664 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2665 f_garbagecollect(typval_T *argvars, typval_T *rettv UNUSED) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2666 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2667 // This is postponed until we are back at the toplevel, because we may be |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2668 // using Lists and Dicts internally. E.g.: ":echo [garbagecollect()]". |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2669 want_garbage_collect = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2670 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
2671 if (argvars[0].v_type != VAR_UNKNOWN && tv_get_number(&argvars[0]) == 1) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2672 garbage_collect_at_exit = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2673 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2674 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2675 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2676 * "get()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2677 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2678 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2679 f_get(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2680 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2681 listitem_T *li; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2682 list_T *l; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2683 dictitem_T *di; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2684 dict_T *d; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2685 typval_T *tv = NULL; |
17534
2b4c138bf8e9
patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
17530
diff
changeset
|
2686 int what_is_dict = FALSE; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2687 |
15454
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
2688 if (argvars[0].v_type == VAR_BLOB) |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
2689 { |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
2690 int error = FALSE; |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
2691 int idx = tv_get_number_chk(&argvars[1], &error); |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
2692 |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
2693 if (!error) |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
2694 { |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
2695 rettv->v_type = VAR_NUMBER; |
15494
74a8f44b5322
patch 8.1.0755: error message for get() on a Blob with invalid index
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
2696 if (idx < 0) |
74a8f44b5322
patch 8.1.0755: error message for get() on a Blob with invalid index
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
2697 idx = blob_len(argvars[0].vval.v_blob) + idx; |
74a8f44b5322
patch 8.1.0755: error message for get() on a Blob with invalid index
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
2698 if (idx < 0 || idx >= blob_len(argvars[0].vval.v_blob)) |
74a8f44b5322
patch 8.1.0755: error message for get() on a Blob with invalid index
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
2699 rettv->vval.v_number = -1; |
15454
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
2700 else |
15494
74a8f44b5322
patch 8.1.0755: error message for get() on a Blob with invalid index
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
2701 { |
15454
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
2702 rettv->vval.v_number = blob_get(argvars[0].vval.v_blob, idx); |
15494
74a8f44b5322
patch 8.1.0755: error message for get() on a Blob with invalid index
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
2703 tv = rettv; |
74a8f44b5322
patch 8.1.0755: error message for get() on a Blob with invalid index
Bram Moolenaar <Bram@vim.org>
parents:
15490
diff
changeset
|
2704 } |
15454
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
2705 } |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
2706 } |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
2707 else if (argvars[0].v_type == VAR_LIST) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2708 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2709 if ((l = argvars[0].vval.v_list) != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2710 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2711 int error = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2712 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
2713 li = list_find(l, (long)tv_get_number_chk(&argvars[1], &error)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2714 if (!error && li != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2715 tv = &li->li_tv; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2716 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2717 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2718 else if (argvars[0].v_type == VAR_DICT) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2719 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2720 if ((d = argvars[0].vval.v_dict) != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2721 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
2722 di = dict_find(d, tv_get_string(&argvars[1]), -1); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2723 if (di != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2724 tv = &di->di_tv; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2725 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2726 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2727 else if (argvars[0].v_type == VAR_PARTIAL || argvars[0].v_type == VAR_FUNC) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2728 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2729 partial_T *pt; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2730 partial_T fref_pt; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2731 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2732 if (argvars[0].v_type == VAR_PARTIAL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2733 pt = argvars[0].vval.v_partial; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2734 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2735 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2736 vim_memset(&fref_pt, 0, sizeof(fref_pt)); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2737 fref_pt.pt_name = argvars[0].vval.v_string; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2738 pt = &fref_pt; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2739 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2740 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2741 if (pt != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2742 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
2743 char_u *what = tv_get_string(&argvars[1]); |
9723
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2744 char_u *n; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2745 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2746 if (STRCMP(what, "func") == 0 || STRCMP(what, "name") == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2747 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2748 rettv->v_type = (*what == 'f' ? VAR_FUNC : VAR_STRING); |
9723
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2749 n = partial_name(pt); |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2750 if (n == NULL) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2751 rettv->vval.v_string = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2752 else |
9723
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2753 { |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2754 rettv->vval.v_string = vim_strsave(n); |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2755 if (rettv->v_type == VAR_FUNC) |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2756 func_ref(rettv->vval.v_string); |
80ac9cf77c9b
commit https://github.com/vim/vim/commit/437bafe4c8a83ed71ee006eda7f54b65a90f0d4c
Christian Brabandt <cb@256bit.org>
parents:
9717
diff
changeset
|
2757 } |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2758 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2759 else if (STRCMP(what, "dict") == 0) |
17534
2b4c138bf8e9
patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
17530
diff
changeset
|
2760 { |
2b4c138bf8e9
patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
17530
diff
changeset
|
2761 what_is_dict = TRUE; |
2b4c138bf8e9
patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
17530
diff
changeset
|
2762 if (pt->pt_dict != NULL) |
2b4c138bf8e9
patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
17530
diff
changeset
|
2763 rettv_dict_set(rettv, pt->pt_dict); |
2b4c138bf8e9
patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
17530
diff
changeset
|
2764 } |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2765 else if (STRCMP(what, "args") == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2766 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2767 rettv->v_type = VAR_LIST; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2768 if (rettv_list_alloc(rettv) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2769 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2770 int i; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2771 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2772 for (i = 0; i < pt->pt_argc; ++i) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2773 list_append_tv(rettv->vval.v_list, &pt->pt_argv[i]); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2774 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2775 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2776 else |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
2777 semsg(_(e_invarg2), what); |
17534
2b4c138bf8e9
patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
17530
diff
changeset
|
2778 |
2b4c138bf8e9
patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
17530
diff
changeset
|
2779 // When {what} == "dict" and pt->pt_dict == NULL, evaluate the |
2b4c138bf8e9
patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
17530
diff
changeset
|
2780 // third argument |
2b4c138bf8e9
patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
17530
diff
changeset
|
2781 if (!what_is_dict) |
2b4c138bf8e9
patch 8.1.1765: get(func, dict, def) does not work properly
Bram Moolenaar <Bram@vim.org>
parents:
17530
diff
changeset
|
2782 return; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2783 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2784 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2785 else |
15571
4af72c724093
patch 8.1.0793: incorrect error messages for functions that take a Blob
Bram Moolenaar <Bram@vim.org>
parents:
15543
diff
changeset
|
2786 semsg(_(e_listdictblobarg), "get()"); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2787 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2788 if (tv == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2789 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2790 if (argvars[2].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2791 copy_tv(&argvars[2], rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2792 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2793 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2794 copy_tv(tv, rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2795 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2796 |
9858
3e96d9ed2ca1
commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
9850
diff
changeset
|
2797 /* |
13280
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2798 * "getchangelist()" function |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2799 */ |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2800 static void |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2801 f_getchangelist(typval_T *argvars, typval_T *rettv) |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2802 { |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2803 #ifdef FEAT_JUMPLIST |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2804 buf_T *buf; |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2805 int i; |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2806 list_T *l; |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2807 dict_T *d; |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2808 #endif |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2809 |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2810 if (rettv_list_alloc(rettv) != OK) |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2811 return; |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2812 |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2813 #ifdef FEAT_JUMPLIST |
17857
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
2814 if (argvars[0].v_type == VAR_UNKNOWN) |
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
2815 buf = curbuf; |
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
2816 else |
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
2817 { |
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
2818 (void)tv_get_number(&argvars[0]); // issue errmsg if type error |
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
2819 ++emsg_off; |
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
2820 buf = tv_get_buf(&argvars[0], FALSE); |
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
2821 --emsg_off; |
4935244c1128
patch 8.1.1925: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents:
17855
diff
changeset
|
2822 } |
13280
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2823 if (buf == NULL) |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2824 return; |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2825 |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2826 l = list_alloc(); |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2827 if (l == NULL) |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2828 return; |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2829 |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2830 if (list_append_list(rettv->vval.v_list, l) == FAIL) |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2831 return; |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2832 /* |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2833 * The current window change list index tracks only the position in the |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2834 * current buffer change list. For other buffers, use the change list |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2835 * length as the current index. |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2836 */ |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2837 list_append_number(rettv->vval.v_list, |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2838 (varnumber_T)((buf == curwin->w_buffer) |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2839 ? curwin->w_changelistidx : buf->b_changelistlen)); |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2840 |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2841 for (i = 0; i < buf->b_changelistlen; ++i) |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2842 { |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2843 if (buf->b_changelist[i].lnum == 0) |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2844 continue; |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2845 if ((d = dict_alloc()) == NULL) |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2846 return; |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2847 if (list_append_dict(l, d) == FAIL) |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2848 return; |
14301
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14214
diff
changeset
|
2849 dict_add_number(d, "lnum", (long)buf->b_changelist[i].lnum); |
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14214
diff
changeset
|
2850 dict_add_number(d, "col", (long)buf->b_changelist[i].col); |
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14214
diff
changeset
|
2851 dict_add_number(d, "coladd", (long)buf->b_changelist[i].coladd); |
13280
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2852 } |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2853 #endif |
fbda23eb0996
patch 8.0.1514: getting the list of changes is not easy
Christian Brabandt <cb@256bit.org>
parents:
13278
diff
changeset
|
2854 } |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2855 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2856 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2857 * "getcharsearch()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2858 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2859 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2860 f_getcharsearch(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2861 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2862 if (rettv_dict_alloc(rettv) != FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2863 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2864 dict_T *dict = rettv->vval.v_dict; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2865 |
14301
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14214
diff
changeset
|
2866 dict_add_string(dict, "char", last_csearch()); |
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14214
diff
changeset
|
2867 dict_add_number(dict, "forward", last_csearch_forward()); |
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14214
diff
changeset
|
2868 dict_add_number(dict, "until", last_csearch_until()); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2869 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2870 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2871 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2872 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2873 * "getcmdwintype()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2874 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2875 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2876 f_getcmdwintype(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2877 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2878 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2879 rettv->vval.v_string = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2880 #ifdef FEAT_CMDWIN |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2881 rettv->vval.v_string = alloc(2); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2882 if (rettv->vval.v_string != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2883 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2884 rettv->vval.v_string[0] = cmdwin_type; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2885 rettv->vval.v_string[1] = NUL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2886 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2887 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2888 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2889 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2890 /* |
16604
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2891 * "getenv()" function |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2892 */ |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2893 static void |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2894 f_getenv(typval_T *argvars, typval_T *rettv) |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2895 { |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2896 int mustfree = FALSE; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2897 char_u *p = vim_getenv(tv_get_string(&argvars[0]), &mustfree); |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2898 |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2899 if (p == NULL) |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2900 { |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2901 rettv->v_type = VAR_SPECIAL; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2902 rettv->vval.v_number = VVAL_NULL; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2903 return; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2904 } |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2905 if (!mustfree) |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2906 p = vim_strsave(p); |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2907 rettv->vval.v_string = p; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2908 rettv->v_type = VAR_STRING; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2909 } |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2910 |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
2911 /* |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2912 * "getfontname()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2913 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2914 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2915 f_getfontname(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2916 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2917 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2918 rettv->vval.v_string = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2919 #ifdef FEAT_GUI |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2920 if (gui.in_use) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2921 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2922 GuiFont font; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2923 char_u *name = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2924 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2925 if (argvars[0].v_type == VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2926 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2927 // Get the "Normal" font. Either the name saved by |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2928 // hl_set_font_name() or from the font ID. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2929 font = gui.norm_font; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2930 name = hl_get_font_name(); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2931 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2932 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2933 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
2934 name = tv_get_string(&argvars[0]); |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2935 if (STRCMP(name, "*") == 0) // don't use font dialog |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2936 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2937 font = gui_mch_get_font(name, FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2938 if (font == NOFONT) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
2939 return; // Invalid font name, return empty string. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2940 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2941 rettv->vval.v_string = gui_mch_get_fontname(font, name); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2942 if (argvars[0].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2943 gui_mch_free_font(font); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2944 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2945 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2946 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2947 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2948 /* |
13246
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2949 * "getjumplist()" function |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2950 */ |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2951 static void |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2952 f_getjumplist(typval_T *argvars, typval_T *rettv) |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2953 { |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2954 #ifdef FEAT_JUMPLIST |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2955 win_T *wp; |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2956 int i; |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2957 list_T *l; |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2958 dict_T *d; |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2959 #endif |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2960 |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2961 if (rettv_list_alloc(rettv) != OK) |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2962 return; |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2963 |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2964 #ifdef FEAT_JUMPLIST |
16427
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
16411
diff
changeset
|
2965 wp = find_tabwin(&argvars[0], &argvars[1], NULL); |
13246
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2966 if (wp == NULL) |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2967 return; |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2968 |
15788
c24572e66556
patch 8.1.0901: index in getjumplist() may be wrong
Bram Moolenaar <Bram@vim.org>
parents:
15780
diff
changeset
|
2969 cleanup_jumplist(wp, TRUE); |
c24572e66556
patch 8.1.0901: index in getjumplist() may be wrong
Bram Moolenaar <Bram@vim.org>
parents:
15780
diff
changeset
|
2970 |
13246
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2971 l = list_alloc(); |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2972 if (l == NULL) |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2973 return; |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2974 |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2975 if (list_append_list(rettv->vval.v_list, l) == FAIL) |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2976 return; |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2977 list_append_number(rettv->vval.v_list, (varnumber_T)wp->w_jumplistidx); |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2978 |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2979 for (i = 0; i < wp->w_jumplistlen; ++i) |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2980 { |
13248
5958573d8a72
patch 8.0.1498: getjumplist() returns duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13246
diff
changeset
|
2981 if (wp->w_jumplist[i].fmark.mark.lnum == 0) |
5958573d8a72
patch 8.0.1498: getjumplist() returns duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13246
diff
changeset
|
2982 continue; |
13246
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2983 if ((d = dict_alloc()) == NULL) |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2984 return; |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2985 if (list_append_dict(l, d) == FAIL) |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2986 return; |
14301
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14214
diff
changeset
|
2987 dict_add_number(d, "lnum", (long)wp->w_jumplist[i].fmark.mark.lnum); |
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14214
diff
changeset
|
2988 dict_add_number(d, "col", (long)wp->w_jumplist[i].fmark.mark.col); |
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14214
diff
changeset
|
2989 dict_add_number(d, "coladd", (long)wp->w_jumplist[i].fmark.mark.coladd); |
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14214
diff
changeset
|
2990 dict_add_number(d, "bufnr", (long)wp->w_jumplist[i].fmark.fnum); |
13248
5958573d8a72
patch 8.0.1498: getjumplist() returns duplicate entries
Christian Brabandt <cb@256bit.org>
parents:
13246
diff
changeset
|
2991 if (wp->w_jumplist[i].fname != NULL) |
14301
3c80092eb211
patch 8.1.0166: using dict_add_nr_str() is clumsy
Christian Brabandt <cb@256bit.org>
parents:
14214
diff
changeset
|
2992 dict_add_string(d, "filename", wp->w_jumplist[i].fname); |
13246
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2993 } |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2994 #endif |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2995 } |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2996 |
dd3b2ecf91f6
patch 8.0.1497: getting the jump list requires parsing the output of :jumps
Christian Brabandt <cb@256bit.org>
parents:
13244
diff
changeset
|
2997 /* |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2998 * "getpid()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2999 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3000 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3001 f_getpid(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3002 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3003 rettv->vval.v_number = mch_get_pid(); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3004 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3005 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3006 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3007 getpos_both( |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3008 typval_T *argvars, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3009 typval_T *rettv, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3010 int getcurpos) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3011 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3012 pos_T *fp; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3013 list_T *l; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3014 int fnum = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3015 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3016 if (rettv_list_alloc(rettv) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3017 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3018 l = rettv->vval.v_list; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3019 if (getcurpos) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3020 fp = &curwin->w_cursor; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3021 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3022 fp = var2fpos(&argvars[0], TRUE, &fnum); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3023 if (fnum != -1) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3024 list_append_number(l, (varnumber_T)fnum); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3025 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3026 list_append_number(l, (varnumber_T)0); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3027 list_append_number(l, (fp != NULL) ? (varnumber_T)fp->lnum |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3028 : (varnumber_T)0); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3029 list_append_number(l, (fp != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3030 ? (varnumber_T)(fp->col == MAXCOL ? MAXCOL : fp->col + 1) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3031 : (varnumber_T)0); |
15636
6f1c7e9a6393
patch 8.1.0826: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15615
diff
changeset
|
3032 list_append_number(l, (fp != NULL) ? (varnumber_T)fp->coladd : |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3033 (varnumber_T)0); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3034 if (getcurpos) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3035 { |
15985
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15979
diff
changeset
|
3036 int save_set_curswant = curwin->w_set_curswant; |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15979
diff
changeset
|
3037 colnr_T save_curswant = curwin->w_curswant; |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15979
diff
changeset
|
3038 colnr_T save_virtcol = curwin->w_virtcol; |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15979
diff
changeset
|
3039 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3040 update_curswant(); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3041 list_append_number(l, curwin->w_curswant == MAXCOL ? |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3042 (varnumber_T)MAXCOL : (varnumber_T)curwin->w_curswant + 1); |
15985
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15979
diff
changeset
|
3043 |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15979
diff
changeset
|
3044 // Do not change "curswant", as it is unexpected that a get |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15979
diff
changeset
|
3045 // function has a side effect. |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15979
diff
changeset
|
3046 if (save_set_curswant) |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15979
diff
changeset
|
3047 { |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15979
diff
changeset
|
3048 curwin->w_set_curswant = save_set_curswant; |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15979
diff
changeset
|
3049 curwin->w_curswant = save_curswant; |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15979
diff
changeset
|
3050 curwin->w_virtcol = save_virtcol; |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15979
diff
changeset
|
3051 curwin->w_valid &= ~VALID_VIRTCOL; |
e91750e8adb5
patch 8.1.0998: getcurpos() unexpectedly changes "curswant"
Bram Moolenaar <Bram@vim.org>
parents:
15979
diff
changeset
|
3052 } |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3053 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3054 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3055 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3056 rettv->vval.v_number = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3057 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3058 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3059 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3060 * "getcurpos()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3061 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3062 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3063 f_getcurpos(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3064 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3065 getpos_both(argvars, rettv, TRUE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3066 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3067 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3068 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3069 * "getpos(string)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3070 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3071 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3072 f_getpos(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3073 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3074 getpos_both(argvars, rettv, FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3075 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3076 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3077 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3078 * "getreg()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3079 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3080 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3081 f_getreg(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3082 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3083 char_u *strregname; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3084 int regname; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3085 int arg2 = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3086 int return_list = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3087 int error = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3088 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3089 if (argvars[0].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3090 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
3091 strregname = tv_get_string_chk(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3092 error = strregname == NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3093 if (argvars[1].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3094 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
3095 arg2 = (int)tv_get_number_chk(&argvars[1], &error); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3096 if (!error && argvars[2].v_type != VAR_UNKNOWN) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
3097 return_list = (int)tv_get_number_chk(&argvars[2], &error); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3098 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3099 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3100 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3101 strregname = get_vim_var_str(VV_REG); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3102 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3103 if (error) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3104 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3105 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3106 regname = (strregname == NULL ? '"' : *strregname); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3107 if (regname == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3108 regname = '"'; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3109 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3110 if (return_list) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3111 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3112 rettv->v_type = VAR_LIST; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3113 rettv->vval.v_list = (list_T *)get_reg_contents(regname, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3114 (arg2 ? GREG_EXPR_SRC : 0) | GREG_LIST); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3115 if (rettv->vval.v_list == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3116 (void)rettv_list_alloc(rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3117 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3118 ++rettv->vval.v_list->lv_refcount; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3119 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3120 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3121 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3122 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3123 rettv->vval.v_string = get_reg_contents(regname, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3124 arg2 ? GREG_EXPR_SRC : 0); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3125 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3126 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3127 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3128 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3129 * "getregtype()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3130 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3131 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3132 f_getregtype(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3133 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3134 char_u *strregname; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3135 int regname; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3136 char_u buf[NUMBUFLEN + 2]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3137 long reglen = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3138 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3139 if (argvars[0].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3140 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
3141 strregname = tv_get_string_chk(&argvars[0]); |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3142 if (strregname == NULL) // type error; errmsg already given |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3143 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3144 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3145 rettv->vval.v_string = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3146 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3147 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3148 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3149 else |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3150 // Default to v:register |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3151 strregname = get_vim_var_str(VV_REG); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3152 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3153 regname = (strregname == NULL ? '"' : *strregname); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3154 if (regname == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3155 regname = '"'; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3156 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3157 buf[0] = NUL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3158 buf[1] = NUL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3159 switch (get_reg_type(regname, ®len)) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3160 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3161 case MLINE: buf[0] = 'V'; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3162 case MCHAR: buf[0] = 'v'; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3163 case MBLOCK: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3164 buf[0] = Ctrl_V; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3165 sprintf((char *)buf + 1, "%ld", reglen + 1); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3166 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3167 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3168 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3169 rettv->vval.v_string = vim_strsave(buf); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3170 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3171 |
9858
3e96d9ed2ca1
commit https://github.com/vim/vim/commit/b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f
Christian Brabandt <cb@256bit.org>
parents:
9850
diff
changeset
|
3172 /* |
15016
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3173 * "gettagstack()" function |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3174 */ |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3175 static void |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3176 f_gettagstack(typval_T *argvars, typval_T *rettv) |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3177 { |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3178 win_T *wp = curwin; // default is current window |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3179 |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3180 if (rettv_dict_alloc(rettv) != OK) |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3181 return; |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3182 |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3183 if (argvars[0].v_type != VAR_UNKNOWN) |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3184 { |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3185 wp = find_win_by_nr_or_id(&argvars[0]); |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3186 if (wp == NULL) |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3187 return; |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3188 } |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3189 |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3190 get_tagstack(wp, rettv->vval.v_dict); |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3191 } |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
3192 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3193 // for VIM_VERSION_ defines |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3194 #include "version.h" |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3195 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3196 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3197 * "has()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3198 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3199 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3200 f_has(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3201 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3202 int i; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3203 char_u *name; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3204 int n = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3205 static char *(has_list[]) = |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3206 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3207 #ifdef AMIGA |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3208 "amiga", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3209 # ifdef FEAT_ARP |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3210 "arp", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3211 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3212 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3213 #ifdef __BEOS__ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3214 "beos", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3215 #endif |
15677
772e72b046a3
patch 8.1.0846: not easy to recognize the system Vim runs on
Bram Moolenaar <Bram@vim.org>
parents:
15636
diff
changeset
|
3216 #if defined(BSD) && !defined(MACOS_X) |
772e72b046a3
patch 8.1.0846: not easy to recognize the system Vim runs on
Bram Moolenaar <Bram@vim.org>
parents:
15636
diff
changeset
|
3217 "bsd", |
772e72b046a3
patch 8.1.0846: not easy to recognize the system Vim runs on
Bram Moolenaar <Bram@vim.org>
parents:
15636
diff
changeset
|
3218 #endif |
772e72b046a3
patch 8.1.0846: not easy to recognize the system Vim runs on
Bram Moolenaar <Bram@vim.org>
parents:
15636
diff
changeset
|
3219 #ifdef hpux |
772e72b046a3
patch 8.1.0846: not easy to recognize the system Vim runs on
Bram Moolenaar <Bram@vim.org>
parents:
15636
diff
changeset
|
3220 "hpux", |
772e72b046a3
patch 8.1.0846: not easy to recognize the system Vim runs on
Bram Moolenaar <Bram@vim.org>
parents:
15636
diff
changeset
|
3221 #endif |
772e72b046a3
patch 8.1.0846: not easy to recognize the system Vim runs on
Bram Moolenaar <Bram@vim.org>
parents:
15636
diff
changeset
|
3222 #ifdef __linux__ |
772e72b046a3
patch 8.1.0846: not easy to recognize the system Vim runs on
Bram Moolenaar <Bram@vim.org>
parents:
15636
diff
changeset
|
3223 "linux", |
772e72b046a3
patch 8.1.0846: not easy to recognize the system Vim runs on
Bram Moolenaar <Bram@vim.org>
parents:
15636
diff
changeset
|
3224 #endif |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
12564
diff
changeset
|
3225 #ifdef MACOS_X |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3226 "mac", // Mac OS X (and, once, Mac OS Classic) |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3227 "osx", // Mac OS X |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
12564
diff
changeset
|
3228 # ifdef MACOS_X_DARWIN |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3229 "macunix", // Mac OS X, with the darwin feature |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3230 "osxdarwin", // synonym for macunix |
12716
351cf7c67bbe
patch 8.0.1236: Mac features are confusing
Christian Brabandt <cb@256bit.org>
parents:
12564
diff
changeset
|
3231 # endif |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3232 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3233 #ifdef __QNX__ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3234 "qnx", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3235 #endif |
15677
772e72b046a3
patch 8.1.0846: not easy to recognize the system Vim runs on
Bram Moolenaar <Bram@vim.org>
parents:
15636
diff
changeset
|
3236 #ifdef SUN_SYSTEM |
772e72b046a3
patch 8.1.0846: not easy to recognize the system Vim runs on
Bram Moolenaar <Bram@vim.org>
parents:
15636
diff
changeset
|
3237 "sun", |
772e72b046a3
patch 8.1.0846: not easy to recognize the system Vim runs on
Bram Moolenaar <Bram@vim.org>
parents:
15636
diff
changeset
|
3238 #else |
772e72b046a3
patch 8.1.0846: not easy to recognize the system Vim runs on
Bram Moolenaar <Bram@vim.org>
parents:
15636
diff
changeset
|
3239 "moon", |
772e72b046a3
patch 8.1.0846: not easy to recognize the system Vim runs on
Bram Moolenaar <Bram@vim.org>
parents:
15636
diff
changeset
|
3240 #endif |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3241 #ifdef UNIX |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3242 "unix", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3243 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3244 #ifdef VMS |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3245 "vms", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3246 #endif |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
3247 #ifdef MSWIN |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3248 "win32", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3249 #endif |
15955
907481b9260f
patch 8.1.0983: checking __CYGWIN32__ unnecessarily
Bram Moolenaar <Bram@vim.org>
parents:
15890
diff
changeset
|
3250 #if defined(UNIX) && defined(__CYGWIN__) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3251 "win32unix", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3252 #endif |
15890
de2c2a378cd1
patch 8.1.0951: using WIN64 even though it is never defined
Bram Moolenaar <Bram@vim.org>
parents:
15868
diff
changeset
|
3253 #ifdef _WIN64 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3254 "win64", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3255 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3256 #ifdef EBCDIC |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3257 "ebcdic", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3258 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3259 #ifndef CASE_INSENSITIVE_FILENAME |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3260 "fname_case", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3261 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3262 #ifdef HAVE_ACL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3263 "acl", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3264 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3265 #ifdef FEAT_ARABIC |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3266 "arabic", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3267 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3268 "autocmd", |
14399
e7d1bc5ee3b8
patch 8.1.0214: +autochdir feature not reported by has() or :version
Christian Brabandt <cb@256bit.org>
parents:
14393
diff
changeset
|
3269 #ifdef FEAT_AUTOCHDIR |
15677
772e72b046a3
patch 8.1.0846: not easy to recognize the system Vim runs on
Bram Moolenaar <Bram@vim.org>
parents:
15636
diff
changeset
|
3270 "autochdir", |
14399
e7d1bc5ee3b8
patch 8.1.0214: +autochdir feature not reported by has() or :version
Christian Brabandt <cb@256bit.org>
parents:
14393
diff
changeset
|
3271 #endif |
12837
963cdeb42c41
patch 8.0.1295: cannot automatically get a server name in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12794
diff
changeset
|
3272 #ifdef FEAT_AUTOSERVERNAME |
963cdeb42c41
patch 8.0.1295: cannot automatically get a server name in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12794
diff
changeset
|
3273 "autoservername", |
963cdeb42c41
patch 8.0.1295: cannot automatically get a server name in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12794
diff
changeset
|
3274 #endif |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
12865
diff
changeset
|
3275 #ifdef FEAT_BEVAL_GUI |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3276 "balloon_eval", |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3277 # ifndef FEAT_GUI_MSWIN // other GUIs always have multiline balloons |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3278 "balloon_multiline", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3279 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3280 #endif |
12871
1a450ce6980c
patch 8.0.1312: balloon_show() only works in terminal when compiled with GUI
Christian Brabandt <cb@256bit.org>
parents:
12865
diff
changeset
|
3281 #ifdef FEAT_BEVAL_TERM |
12865
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12857
diff
changeset
|
3282 "balloon_eval_term", |
ebb4f6c93598
patch 8.0.1309: cannot use 'balloonexpr' in a terminal
Christian Brabandt <cb@256bit.org>
parents:
12857
diff
changeset
|
3283 #endif |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3284 #if defined(SOME_BUILTIN_TCAPS) || defined(ALL_BUILTIN_TCAPS) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3285 "builtin_terms", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3286 # ifdef ALL_BUILTIN_TCAPS |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3287 "all_builtin_terms", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3288 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3289 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3290 #if defined(FEAT_BROWSE) && (defined(USE_FILE_CHOOSER) \ |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
3291 || defined(FEAT_GUI_MSWIN) \ |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3292 || defined(FEAT_GUI_MOTIF)) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3293 "browsefilter", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3294 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3295 #ifdef FEAT_BYTEOFF |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3296 "byte_offset", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3297 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3298 #ifdef FEAT_JOB_CHANNEL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3299 "channel", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3300 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3301 #ifdef FEAT_CINDENT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3302 "cindent", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3303 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3304 #ifdef FEAT_CLIENTSERVER |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3305 "clientserver", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3306 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3307 #ifdef FEAT_CLIPBOARD |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3308 "clipboard", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3309 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3310 "cmdline_compl", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3311 "cmdline_hist", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3312 "comments", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3313 #ifdef FEAT_CONCEAL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3314 "conceal", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3315 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3316 #ifdef FEAT_CRYPT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3317 "cryptv", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3318 "crypt-blowfish", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3319 "crypt-blowfish2", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3320 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3321 #ifdef FEAT_CSCOPE |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3322 "cscope", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3323 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3324 "cursorbind", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3325 #ifdef CURSOR_SHAPE |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3326 "cursorshape", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3327 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3328 #ifdef DEBUG |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3329 "debug", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3330 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3331 #ifdef FEAT_CON_DIALOG |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3332 "dialog_con", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3333 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3334 #ifdef FEAT_GUI_DIALOG |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3335 "dialog_gui", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3336 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3337 #ifdef FEAT_DIFF |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3338 "diff", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3339 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3340 #ifdef FEAT_DIGRAPHS |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3341 "digraphs", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3342 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3343 #ifdef FEAT_DIRECTX |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3344 "directx", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3345 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3346 #ifdef FEAT_DND |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3347 "dnd", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3348 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3349 #ifdef FEAT_EMACS_TAGS |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3350 "emacs_tags", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3351 #endif |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3352 "eval", // always present, of course! |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3353 "ex_extra", // graduated feature |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3354 #ifdef FEAT_SEARCH_EXTRA |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3355 "extra_search", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3356 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3357 #ifdef FEAT_SEARCHPATH |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3358 "file_in_path", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3359 #endif |
18742
e9b2ade1adbd
patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
18738
diff
changeset
|
3360 #if defined(FEAT_FILTERPIPE) && !defined(VIMDLL) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3361 "filterpipe", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3362 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3363 #ifdef FEAT_FIND_ID |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3364 "find_in_path", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3365 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3366 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3367 "float", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3368 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3369 #ifdef FEAT_FOLDING |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3370 "folding", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3371 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3372 #ifdef FEAT_FOOTER |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3373 "footer", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3374 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3375 #if !defined(USE_SYSTEM) && defined(UNIX) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3376 "fork", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3377 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3378 #ifdef FEAT_GETTEXT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3379 "gettext", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3380 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3381 #ifdef FEAT_GUI |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3382 "gui", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3383 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3384 #ifdef FEAT_GUI_ATHENA |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3385 # ifdef FEAT_GUI_NEXTAW |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3386 "gui_neXtaw", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3387 # else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3388 "gui_athena", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3389 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3390 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3391 #ifdef FEAT_GUI_GTK |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3392 "gui_gtk", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3393 # ifdef USE_GTK3 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3394 "gui_gtk3", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3395 # else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3396 "gui_gtk2", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3397 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3398 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3399 #ifdef FEAT_GUI_GNOME |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3400 "gui_gnome", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3401 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3402 #ifdef FEAT_GUI_MAC |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3403 "gui_mac", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3404 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3405 #ifdef FEAT_GUI_MOTIF |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3406 "gui_motif", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3407 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3408 #ifdef FEAT_GUI_PHOTON |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3409 "gui_photon", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3410 #endif |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
3411 #ifdef FEAT_GUI_MSWIN |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3412 "gui_win32", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3413 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3414 #if defined(HAVE_ICONV_H) && defined(USE_ICONV) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3415 "iconv", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3416 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3417 "insert_expand", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3418 #ifdef FEAT_JOB_CHANNEL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3419 "job", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3420 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3421 #ifdef FEAT_JUMPLIST |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3422 "jumplist", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3423 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3424 #ifdef FEAT_KEYMAP |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3425 "keymap", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3426 #endif |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3427 "lambda", // always with FEAT_EVAL, since 7.4.2120 with closure |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3428 #ifdef FEAT_LANGMAP |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3429 "langmap", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3430 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3431 #ifdef FEAT_LIBCALL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3432 "libcall", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3433 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3434 #ifdef FEAT_LINEBREAK |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3435 "linebreak", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3436 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3437 #ifdef FEAT_LISP |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3438 "lispindent", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3439 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3440 "listcmds", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3441 "localmap", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3442 #ifdef FEAT_LUA |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3443 # ifndef DYNAMIC_LUA |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3444 "lua", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3445 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3446 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3447 #ifdef FEAT_MENU |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3448 "menu", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3449 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3450 #ifdef FEAT_SESSION |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3451 "mksession", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3452 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3453 "modify_fname", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3454 "mouse", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3455 #ifdef FEAT_MOUSESHAPE |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3456 "mouseshape", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3457 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3458 #if defined(UNIX) || defined(VMS) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3459 # ifdef FEAT_MOUSE_DEC |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3460 "mouse_dec", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3461 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3462 # ifdef FEAT_MOUSE_GPM |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3463 "mouse_gpm", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3464 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3465 # ifdef FEAT_MOUSE_JSB |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3466 "mouse_jsbterm", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3467 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3468 # ifdef FEAT_MOUSE_NET |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3469 "mouse_netterm", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3470 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3471 # ifdef FEAT_MOUSE_PTERM |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3472 "mouse_pterm", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3473 # endif |
16058
012f03e583e2
patch 8.1.1034: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15985
diff
changeset
|
3474 # ifdef FEAT_MOUSE_XTERM |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3475 "mouse_sgr", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3476 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3477 # ifdef FEAT_SYSMOUSE |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3478 "mouse_sysmouse", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3479 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3480 # ifdef FEAT_MOUSE_URXVT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3481 "mouse_urxvt", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3482 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3483 # ifdef FEAT_MOUSE_XTERM |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3484 "mouse_xterm", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3485 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3486 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3487 "multi_byte", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3488 #ifdef FEAT_MBYTE_IME |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3489 "multi_byte_ime", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3490 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3491 #ifdef FEAT_MULTI_LANG |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3492 "multi_lang", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3493 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3494 #ifdef FEAT_MZSCHEME |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3495 #ifndef DYNAMIC_MZSCHEME |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3496 "mzscheme", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3497 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3498 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3499 #ifdef FEAT_NUM64 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3500 "num64", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3501 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3502 #ifdef FEAT_OLE |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3503 "ole", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3504 #endif |
14375
e5d7dd985b53
patch 8.1.0202: :version always shows +packages
Christian Brabandt <cb@256bit.org>
parents:
14368
diff
changeset
|
3505 #ifdef FEAT_EVAL |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3506 "packages", |
14375
e5d7dd985b53
patch 8.1.0202: :version always shows +packages
Christian Brabandt <cb@256bit.org>
parents:
14368
diff
changeset
|
3507 #endif |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3508 #ifdef FEAT_PATH_EXTRA |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3509 "path_extra", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3510 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3511 #ifdef FEAT_PERL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3512 #ifndef DYNAMIC_PERL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3513 "perl", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3514 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3515 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3516 #ifdef FEAT_PERSISTENT_UNDO |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3517 "persistent_undo", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3518 #endif |
13123
aaead5b4d77d
patch 8.0.1436: not enough information about what Python version may work
Christian Brabandt <cb@256bit.org>
parents:
13101
diff
changeset
|
3519 #if defined(FEAT_PYTHON) |
aaead5b4d77d
patch 8.0.1436: not enough information about what Python version may work
Christian Brabandt <cb@256bit.org>
parents:
13101
diff
changeset
|
3520 "python_compiled", |
aaead5b4d77d
patch 8.0.1436: not enough information about what Python version may work
Christian Brabandt <cb@256bit.org>
parents:
13101
diff
changeset
|
3521 # if defined(DYNAMIC_PYTHON) |
aaead5b4d77d
patch 8.0.1436: not enough information about what Python version may work
Christian Brabandt <cb@256bit.org>
parents:
13101
diff
changeset
|
3522 "python_dynamic", |
aaead5b4d77d
patch 8.0.1436: not enough information about what Python version may work
Christian Brabandt <cb@256bit.org>
parents:
13101
diff
changeset
|
3523 # else |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3524 "python", |
10722
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
3525 "pythonx", |
13123
aaead5b4d77d
patch 8.0.1436: not enough information about what Python version may work
Christian Brabandt <cb@256bit.org>
parents:
13101
diff
changeset
|
3526 # endif |
aaead5b4d77d
patch 8.0.1436: not enough information about what Python version may work
Christian Brabandt <cb@256bit.org>
parents:
13101
diff
changeset
|
3527 #endif |
aaead5b4d77d
patch 8.0.1436: not enough information about what Python version may work
Christian Brabandt <cb@256bit.org>
parents:
13101
diff
changeset
|
3528 #if defined(FEAT_PYTHON3) |
aaead5b4d77d
patch 8.0.1436: not enough information about what Python version may work
Christian Brabandt <cb@256bit.org>
parents:
13101
diff
changeset
|
3529 "python3_compiled", |
aaead5b4d77d
patch 8.0.1436: not enough information about what Python version may work
Christian Brabandt <cb@256bit.org>
parents:
13101
diff
changeset
|
3530 # if defined(DYNAMIC_PYTHON3) |
aaead5b4d77d
patch 8.0.1436: not enough information about what Python version may work
Christian Brabandt <cb@256bit.org>
parents:
13101
diff
changeset
|
3531 "python3_dynamic", |
aaead5b4d77d
patch 8.0.1436: not enough information about what Python version may work
Christian Brabandt <cb@256bit.org>
parents:
13101
diff
changeset
|
3532 # else |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3533 "python3", |
10722
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
3534 "pythonx", |
13123
aaead5b4d77d
patch 8.0.1436: not enough information about what Python version may work
Christian Brabandt <cb@256bit.org>
parents:
13101
diff
changeset
|
3535 # endif |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3536 #endif |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18742
diff
changeset
|
3537 #ifdef FEAT_PROP_POPUP |
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18742
diff
changeset
|
3538 "popupwin", |
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18742
diff
changeset
|
3539 #endif |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3540 #ifdef FEAT_POSTSCRIPT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3541 "postscript", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3542 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3543 #ifdef FEAT_PRINTER |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3544 "printer", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3545 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3546 #ifdef FEAT_PROFILE |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3547 "profile", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3548 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3549 #ifdef FEAT_RELTIME |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3550 "reltime", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3551 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3552 #ifdef FEAT_QUICKFIX |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3553 "quickfix", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3554 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3555 #ifdef FEAT_RIGHTLEFT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3556 "rightleft", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3557 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3558 #if defined(FEAT_RUBY) && !defined(DYNAMIC_RUBY) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3559 "ruby", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3560 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3561 "scrollbind", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3562 #ifdef FEAT_CMDL_INFO |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3563 "showcmd", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3564 "cmdline_info", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3565 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3566 #ifdef FEAT_SIGNS |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3567 "signs", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3568 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3569 #ifdef FEAT_SMARTINDENT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3570 "smartindent", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3571 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3572 #ifdef STARTUPTIME |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3573 "startuptime", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3574 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3575 #ifdef FEAT_STL_OPT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3576 "statusline", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3577 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3578 #ifdef FEAT_NETBEANS_INTG |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3579 "netbeans_intg", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3580 #endif |
17004
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
3581 #ifdef FEAT_SOUND |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
3582 "sound", |
353ed7ef78df
patch 8.1.1502: cannot play any sound
Bram Moolenaar <Bram@vim.org>
parents:
16890
diff
changeset
|
3583 #endif |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3584 #ifdef FEAT_SPELL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3585 "spell", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3586 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3587 #ifdef FEAT_SYN_HL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3588 "syntax", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3589 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3590 #if defined(USE_SYSTEM) || !defined(UNIX) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3591 "system", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3592 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3593 #ifdef FEAT_TAG_BINS |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3594 "tag_binary", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3595 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3596 #ifdef FEAT_TCL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3597 # ifndef DYNAMIC_TCL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3598 "tcl", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3599 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3600 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3601 #ifdef FEAT_TERMGUICOLORS |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3602 "termguicolors", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3603 #endif |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
3604 #if defined(FEAT_TERMINAL) && !defined(MSWIN) |
11621
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
11587
diff
changeset
|
3605 "terminal", |
b8299e742f41
patch 8.0.0693: no terminal emulator support
Christian Brabandt <cb@256bit.org>
parents:
11587
diff
changeset
|
3606 #endif |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3607 #ifdef TERMINFO |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3608 "terminfo", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3609 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3610 #ifdef FEAT_TERMRESPONSE |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3611 "termresponse", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3612 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3613 #ifdef FEAT_TEXTOBJ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3614 "textobjects", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3615 #endif |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18742
diff
changeset
|
3616 #ifdef FEAT_PROP_POPUP |
15138
9df130fd5e0d
patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
3617 "textprop", |
9df130fd5e0d
patch 8.1.0579: cannot attach properties to text
Bram Moolenaar <Bram@vim.org>
parents:
15121
diff
changeset
|
3618 #endif |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3619 #ifdef HAVE_TGETENT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3620 "tgetent", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3621 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3622 #ifdef FEAT_TIMERS |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3623 "timers", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3624 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3625 #ifdef FEAT_TITLE |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3626 "title", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3627 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3628 #ifdef FEAT_TOOLBAR |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3629 "toolbar", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3630 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3631 #if defined(FEAT_CLIPBOARD) && defined(FEAT_X11) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3632 "unnamedplus", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3633 #endif |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3634 "user-commands", // was accidentally included in 5.4 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3635 "user_commands", |
14175
2ad722003b36
patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
14161
diff
changeset
|
3636 #ifdef FEAT_VARTABS |
2ad722003b36
patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
14161
diff
changeset
|
3637 "vartabs", |
2ad722003b36
patch 8.1.0105: all tab stops are the same
Christian Brabandt <cb@256bit.org>
parents:
14161
diff
changeset
|
3638 #endif |
16223
abb67309c1ca
patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents:
16213
diff
changeset
|
3639 "vertsplit", |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3640 #ifdef FEAT_VIMINFO |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3641 "viminfo", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3642 #endif |
16223
abb67309c1ca
patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents:
16213
diff
changeset
|
3643 "vimscript-1", |
abb67309c1ca
patch 8.1.1116: cannot enforce a Vim script style
Bram Moolenaar <Bram@vim.org>
parents:
16213
diff
changeset
|
3644 "vimscript-2", |
16370
235a2b941498
patch 8.1.1190: has('vimscript-3') does not work
Bram Moolenaar <Bram@vim.org>
parents:
16362
diff
changeset
|
3645 "vimscript-3", |
18086
9d6832a5426f
patch 8.1.2038: has('vimscript-4') is always 0
Bram Moolenaar <Bram@vim.org>
parents:
18080
diff
changeset
|
3646 "vimscript-4", |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3647 "virtualedit", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3648 "visual", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3649 "visualextra", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3650 "vreplace", |
13454
1720b96e53b6
patch 8.0.1601: highlight test fails on Win32
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
3651 #ifdef FEAT_VTP |
1720b96e53b6
patch 8.0.1601: highlight test fails on Win32
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
3652 "vtp", |
1720b96e53b6
patch 8.0.1601: highlight test fails on Win32
Christian Brabandt <cb@256bit.org>
parents:
13438
diff
changeset
|
3653 #endif |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3654 #ifdef FEAT_WILDIGN |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3655 "wildignore", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3656 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3657 #ifdef FEAT_WILDMENU |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3658 "wildmenu", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3659 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3660 "windows", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3661 #ifdef FEAT_WAK |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3662 "winaltkeys", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3663 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3664 #ifdef FEAT_WRITEBACKUP |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3665 "writebackup", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3666 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3667 #ifdef FEAT_XIM |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3668 "xim", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3669 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3670 #ifdef FEAT_XFONTSET |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3671 "xfontset", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3672 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3673 #ifdef FEAT_XPM_W32 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3674 "xpm", |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3675 "xpm_w32", // for backward compatibility |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3676 #else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3677 # if defined(HAVE_XPM) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3678 "xpm", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3679 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3680 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3681 #ifdef USE_XSMP |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3682 "xsmp", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3683 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3684 #ifdef USE_XSMP_INTERACT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3685 "xsmp_interact", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3686 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3687 #ifdef FEAT_XCLIPBOARD |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3688 "xterm_clipboard", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3689 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3690 #ifdef FEAT_XTERM_SAVE |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3691 "xterm_save", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3692 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3693 #if defined(UNIX) && defined(FEAT_X11) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3694 "X11", |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3695 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3696 NULL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3697 }; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3698 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
3699 name = tv_get_string(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3700 for (i = 0; has_list[i] != NULL; ++i) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3701 if (STRICMP(name, has_list[i]) == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3702 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3703 n = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3704 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3705 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3706 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3707 if (n == FALSE) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3708 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3709 if (STRNICMP(name, "patch", 5) == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3710 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3711 if (name[5] == '-' |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3712 && STRLEN(name) >= 11 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3713 && vim_isdigit(name[6]) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3714 && vim_isdigit(name[8]) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3715 && vim_isdigit(name[10])) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3716 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3717 int major = atoi((char *)name + 6); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3718 int minor = atoi((char *)name + 8); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3719 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3720 // Expect "patch-9.9.01234". |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3721 n = (major < VIM_VERSION_MAJOR |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3722 || (major == VIM_VERSION_MAJOR |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3723 && (minor < VIM_VERSION_MINOR |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3724 || (minor == VIM_VERSION_MINOR |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3725 && has_patch(atoi((char *)name + 10)))))); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3726 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3727 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3728 n = has_patch(atoi((char *)name + 5)); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3729 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3730 else if (STRICMP(name, "vim_starting") == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3731 n = (starting != 0); |
10404
65e0537a4560
commit https://github.com/vim/vim/commit/2cab0e191055a8145ccd46cd52869fbb9798b971
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
3732 else if (STRICMP(name, "ttyin") == 0) |
65e0537a4560
commit https://github.com/vim/vim/commit/2cab0e191055a8145ccd46cd52869fbb9798b971
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
3733 n = mch_input_isatty(); |
65e0537a4560
commit https://github.com/vim/vim/commit/2cab0e191055a8145ccd46cd52869fbb9798b971
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
3734 else if (STRICMP(name, "ttyout") == 0) |
65e0537a4560
commit https://github.com/vim/vim/commit/2cab0e191055a8145ccd46cd52869fbb9798b971
Christian Brabandt <cb@256bit.org>
parents:
10359
diff
changeset
|
3735 n = stdout_isatty; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3736 else if (STRICMP(name, "multi_byte_encoding") == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3737 n = has_mbyte; |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
3738 #if defined(FEAT_BEVAL) && defined(FEAT_GUI_MSWIN) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3739 else if (STRICMP(name, "balloon_multiline") == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3740 n = multiline_balloon_available(); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3741 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3742 #ifdef DYNAMIC_TCL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3743 else if (STRICMP(name, "tcl") == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3744 n = tcl_enabled(FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3745 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3746 #if defined(USE_ICONV) && defined(DYNAMIC_ICONV) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3747 else if (STRICMP(name, "iconv") == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3748 n = iconv_enabled(FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3749 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3750 #ifdef DYNAMIC_LUA |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3751 else if (STRICMP(name, "lua") == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3752 n = lua_enabled(FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3753 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3754 #ifdef DYNAMIC_MZSCHEME |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3755 else if (STRICMP(name, "mzscheme") == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3756 n = mzscheme_enabled(FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3757 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3758 #ifdef DYNAMIC_RUBY |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3759 else if (STRICMP(name, "ruby") == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3760 n = ruby_enabled(FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3761 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3762 #ifdef DYNAMIC_PYTHON |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3763 else if (STRICMP(name, "python") == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3764 n = python_enabled(FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3765 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3766 #ifdef DYNAMIC_PYTHON3 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3767 else if (STRICMP(name, "python3") == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3768 n = python3_enabled(FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3769 #endif |
10722
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
3770 #if defined(DYNAMIC_PYTHON) || defined(DYNAMIC_PYTHON3) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
3771 else if (STRICMP(name, "pythonx") == 0) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
3772 { |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
3773 # if defined(DYNAMIC_PYTHON) && defined(DYNAMIC_PYTHON3) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
3774 if (p_pyx == 0) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
3775 n = python3_enabled(FALSE) || python_enabled(FALSE); |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
3776 else if (p_pyx == 3) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
3777 n = python3_enabled(FALSE); |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
3778 else if (p_pyx == 2) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
3779 n = python_enabled(FALSE); |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
3780 # elif defined(DYNAMIC_PYTHON) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
3781 n = python_enabled(FALSE); |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
3782 # elif defined(DYNAMIC_PYTHON3) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
3783 n = python3_enabled(FALSE); |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
3784 # endif |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
3785 } |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3786 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3787 #ifdef DYNAMIC_PERL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3788 else if (STRICMP(name, "perl") == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3789 n = perl_enabled(FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3790 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3791 #ifdef FEAT_GUI |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3792 else if (STRICMP(name, "gui_running") == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3793 n = (gui.in_use || gui.starting); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3794 # ifdef FEAT_BROWSE |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3795 else if (STRICMP(name, "browse") == 0) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3796 n = gui.in_use; // gui_mch_browse() works when GUI is running |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3797 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3798 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3799 #ifdef FEAT_SYN_HL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3800 else if (STRICMP(name, "syntax_items") == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3801 n = syntax_present(curwin); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3802 #endif |
13314
65c3e8259124
patch 8.0.1531: cannot use 24 bit colors in MS-Windows console
Christian Brabandt <cb@256bit.org>
parents:
13298
diff
changeset
|
3803 #ifdef FEAT_VTP |
65c3e8259124
patch 8.0.1531: cannot use 24 bit colors in MS-Windows console
Christian Brabandt <cb@256bit.org>
parents:
13298
diff
changeset
|
3804 else if (STRICMP(name, "vcon") == 0) |
14214
68166b841ee9
patch 8.1.0124: has('vcon') returns true even for non-win32 terminal
Christian Brabandt <cb@256bit.org>
parents:
14189
diff
changeset
|
3805 n = is_term_win32() && has_vtp_working(); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3806 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3807 #ifdef FEAT_NETBEANS_INTG |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3808 else if (STRICMP(name, "netbeans_enabled") == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3809 n = netbeans_active(); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3810 #endif |
16527
5412fcd03ecb
patch 8.1.1267: cannot check if GPM mouse support is working
Bram Moolenaar <Bram@vim.org>
parents:
16517
diff
changeset
|
3811 #ifdef FEAT_MOUSE_GPM |
5412fcd03ecb
patch 8.1.1267: cannot check if GPM mouse support is working
Bram Moolenaar <Bram@vim.org>
parents:
16517
diff
changeset
|
3812 else if (STRICMP(name, "mouse_gpm_enabled") == 0) |
5412fcd03ecb
patch 8.1.1267: cannot check if GPM mouse support is working
Bram Moolenaar <Bram@vim.org>
parents:
16517
diff
changeset
|
3813 n = gpm_enabled(); |
5412fcd03ecb
patch 8.1.1267: cannot check if GPM mouse support is working
Bram Moolenaar <Bram@vim.org>
parents:
16517
diff
changeset
|
3814 #endif |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
3815 #if defined(FEAT_TERMINAL) && defined(MSWIN) |
12144
abd69cea3459
patch 8.0.0952: has('terminal') does not check existence of dll file
Christian Brabandt <cb@256bit.org>
parents:
12136
diff
changeset
|
3816 else if (STRICMP(name, "terminal") == 0) |
abd69cea3459
patch 8.0.0952: has('terminal') does not check existence of dll file
Christian Brabandt <cb@256bit.org>
parents:
12136
diff
changeset
|
3817 n = terminal_enabled(); |
abd69cea3459
patch 8.0.0952: has('terminal') does not check existence of dll file
Christian Brabandt <cb@256bit.org>
parents:
12136
diff
changeset
|
3818 #endif |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
3819 #if defined(FEAT_TERMINAL) && defined(MSWIN) |
15725
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
3820 else if (STRICMP(name, "conpty") == 0) |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
3821 n = use_conpty(); |
a3e2e7948ee4
patch 8.1.0870: Vim doesn't use the new ConPTY support in Windows 10
Bram Moolenaar <Bram@vim.org>
parents:
15687
diff
changeset
|
3822 #endif |
17680
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17676
diff
changeset
|
3823 #ifdef FEAT_CLIPBOARD |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17676
diff
changeset
|
3824 else if (STRICMP(name, "clipboard_working") == 0) |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17676
diff
changeset
|
3825 n = clip_star.available; |
55704f587945
patch 8.1.1837: popup test fails if clipboard is supported but not working
Bram Moolenaar <Bram@vim.org>
parents:
17676
diff
changeset
|
3826 #endif |
18742
e9b2ade1adbd
patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
18738
diff
changeset
|
3827 #ifdef VIMDLL |
e9b2ade1adbd
patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
18738
diff
changeset
|
3828 else if (STRICMP(name, "filterpipe") == 0) |
e9b2ade1adbd
patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
18738
diff
changeset
|
3829 n = gui.in_use || gui.starting; |
e9b2ade1adbd
patch 8.1.2361: MS-Windows: test failures related to VIMDLL
Bram Moolenaar <Bram@vim.org>
parents:
18738
diff
changeset
|
3830 #endif |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3831 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3832 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3833 rettv->vval.v_number = n; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3834 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3835 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3836 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3837 * "haslocaldir()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3838 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3839 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3840 f_haslocaldir(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3841 { |
16427
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
16411
diff
changeset
|
3842 tabpage_T *tp = NULL; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3843 win_T *wp = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3844 |
16427
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
16411
diff
changeset
|
3845 wp = find_tabwin(&argvars[0], &argvars[1], &tp); |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
16411
diff
changeset
|
3846 |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
16411
diff
changeset
|
3847 // Check for window-local and tab-local directories |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
16411
diff
changeset
|
3848 if (wp != NULL && wp->w_localdir != NULL) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
16411
diff
changeset
|
3849 rettv->vval.v_number = 1; |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
16411
diff
changeset
|
3850 else if (tp != NULL && tp->tp_localdir != NULL) |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
16411
diff
changeset
|
3851 rettv->vval.v_number = 2; |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
16411
diff
changeset
|
3852 else |
8c3a1bd270bb
patch 8.1.1218: cannot set a directory for a tab page
Bram Moolenaar <Bram@vim.org>
parents:
16411
diff
changeset
|
3853 rettv->vval.v_number = 0; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3854 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3855 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3856 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3857 * "hasmapto()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3858 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3859 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3860 f_hasmapto(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3861 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3862 char_u *name; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3863 char_u *mode; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3864 char_u buf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3865 int abbr = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3866 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
3867 name = tv_get_string(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3868 if (argvars[1].v_type == VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3869 mode = (char_u *)"nvo"; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3870 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3871 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
3872 mode = tv_get_string_buf(&argvars[1], buf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3873 if (argvars[2].v_type != VAR_UNKNOWN) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
3874 abbr = (int)tv_get_number(&argvars[2]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3875 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3876 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3877 if (map_to_exists(name, mode, abbr)) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3878 rettv->vval.v_number = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3879 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3880 rettv->vval.v_number = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3881 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3882 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3883 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3884 * "highlightID(name)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3885 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3886 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3887 f_hlID(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3888 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
3889 rettv->vval.v_number = syn_name2id(tv_get_string(&argvars[0])); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3890 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3891 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3892 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3893 * "highlight_exists()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3894 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3895 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3896 f_hlexists(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3897 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
3898 rettv->vval.v_number = highlight_exists(tv_get_string(&argvars[0])); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3899 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3900 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3901 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3902 * "hostname()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3903 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3904 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3905 f_hostname(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3906 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3907 char_u hostname[256]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3908 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3909 mch_get_host_name(hostname, 256); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3910 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3911 rettv->vval.v_string = vim_strsave(hostname); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3912 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3913 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3914 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3915 * iconv() function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3916 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3917 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3918 f_iconv(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3919 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3920 char_u buf1[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3921 char_u buf2[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3922 char_u *from, *to, *str; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3923 vimconv_T vimconv; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3924 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3925 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3926 rettv->vval.v_string = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3927 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
3928 str = tv_get_string(&argvars[0]); |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
3929 from = enc_canonize(enc_skip(tv_get_string_buf(&argvars[1], buf1))); |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
3930 to = enc_canonize(enc_skip(tv_get_string_buf(&argvars[2], buf2))); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3931 vimconv.vc_type = CONV_NONE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3932 convert_setup(&vimconv, from, to); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3933 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
3934 // If the encodings are equal, no conversion needed. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3935 if (vimconv.vc_type == CONV_NONE) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3936 rettv->vval.v_string = vim_strsave(str); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3937 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3938 rettv->vval.v_string = string_convert(&vimconv, str, NULL); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3939 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3940 convert_setup(&vimconv, NULL, NULL); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3941 vim_free(from); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3942 vim_free(to); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3943 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3944 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3945 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3946 * "index()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3947 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3948 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3949 f_index(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3950 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3951 list_T *l; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3952 listitem_T *item; |
15454
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3953 blob_T *b; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3954 long idx = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3955 int ic = FALSE; |
15454
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3956 int error = FALSE; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3957 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3958 rettv->vval.v_number = -1; |
15454
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3959 if (argvars[0].v_type == VAR_BLOB) |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3960 { |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3961 typval_T tv; |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3962 int start = 0; |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3963 |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3964 if (argvars[2].v_type != VAR_UNKNOWN) |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3965 { |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3966 start = tv_get_number_chk(&argvars[2], &error); |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3967 if (error) |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3968 return; |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3969 } |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3970 b = argvars[0].vval.v_blob; |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3971 if (b == NULL) |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3972 return; |
15468
1550cc188ff6
patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents:
15456
diff
changeset
|
3973 if (start < 0) |
1550cc188ff6
patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents:
15456
diff
changeset
|
3974 { |
1550cc188ff6
patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents:
15456
diff
changeset
|
3975 start = blob_len(b) + start; |
1550cc188ff6
patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents:
15456
diff
changeset
|
3976 if (start < 0) |
1550cc188ff6
patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents:
15456
diff
changeset
|
3977 start = 0; |
1550cc188ff6
patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents:
15456
diff
changeset
|
3978 } |
1550cc188ff6
patch 8.1.0742: not all Blob operations are tested
Bram Moolenaar <Bram@vim.org>
parents:
15456
diff
changeset
|
3979 |
15454
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3980 for (idx = start; idx < blob_len(b); ++idx) |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3981 { |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3982 tv.v_type = VAR_NUMBER; |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3983 tv.vval.v_number = blob_get(b, idx); |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3984 if (tv_equal(&tv, &argvars[1], ic, FALSE)) |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3985 { |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3986 rettv->vval.v_number = idx; |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3987 return; |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3988 } |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3989 } |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3990 return; |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3991 } |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3992 else if (argvars[0].v_type != VAR_LIST) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3993 { |
15571
4af72c724093
patch 8.1.0793: incorrect error messages for functions that take a Blob
Bram Moolenaar <Bram@vim.org>
parents:
15543
diff
changeset
|
3994 emsg(_(e_listblobreq)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3995 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3996 } |
15454
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
3997 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3998 l = argvars[0].vval.v_list; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
3999 if (l != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4000 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4001 item = l->lv_first; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4002 if (argvars[2].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4003 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4004 // Start at specified item. Use the cached index that list_find() |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4005 // sets, so that a negative number also works. |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4006 item = list_find(l, (long)tv_get_number_chk(&argvars[2], &error)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4007 idx = l->lv_idx; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4008 if (argvars[3].v_type != VAR_UNKNOWN) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4009 ic = (int)tv_get_number_chk(&argvars[3], &error); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4010 if (error) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4011 item = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4012 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4013 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4014 for ( ; item != NULL; item = item->li_next, ++idx) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4015 if (tv_equal(&item->li_tv, &argvars[1], ic, FALSE)) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4016 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4017 rettv->vval.v_number = idx; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4018 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4019 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4020 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4021 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4022 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4023 static int inputsecret_flag = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4024 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4025 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4026 * "input()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4027 * Also handles inputsecret() when inputsecret is set. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4028 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4029 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4030 f_input(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4031 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4032 get_user_input(argvars, rettv, FALSE, inputsecret_flag); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4033 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4034 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4035 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4036 * "inputdialog()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4037 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4038 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4039 f_inputdialog(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4040 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4041 #if defined(FEAT_GUI_TEXTDIALOG) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4042 // Use a GUI dialog if the GUI is running and 'c' is not in 'guioptions' |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4043 if (gui.in_use && vim_strchr(p_go, GO_CONDIALOG) == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4044 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4045 char_u *message; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4046 char_u buf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4047 char_u *defstr = (char_u *)""; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4048 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4049 message = tv_get_string_chk(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4050 if (argvars[1].v_type != VAR_UNKNOWN |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4051 && (defstr = tv_get_string_buf_chk(&argvars[1], buf)) != NULL) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4052 vim_strncpy(IObuff, defstr, IOSIZE - 1); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4053 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4054 IObuff[0] = NUL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4055 if (message != NULL && defstr != NULL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4056 && do_dialog(VIM_QUESTION, NULL, message, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4057 (char_u *)_("&OK\n&Cancel"), 1, IObuff, FALSE) == 1) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4058 rettv->vval.v_string = vim_strsave(IObuff); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4059 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4060 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4061 if (message != NULL && defstr != NULL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4062 && argvars[1].v_type != VAR_UNKNOWN |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4063 && argvars[2].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4064 rettv->vval.v_string = vim_strsave( |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4065 tv_get_string_buf(&argvars[2], buf)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4066 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4067 rettv->vval.v_string = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4068 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4069 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4070 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4071 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4072 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4073 get_user_input(argvars, rettv, TRUE, inputsecret_flag); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4074 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4075 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4076 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4077 * "inputlist()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4078 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4079 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4080 f_inputlist(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4081 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4082 listitem_T *li; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4083 int selected; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4084 int mouse_used; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4085 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4086 #ifdef NO_CONSOLE_INPUT |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4087 // While starting up, there is no place to enter text. When running tests |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4088 // with --not-a-term we assume feedkeys() will be used. |
11848
f5968ca369b5
patch 8.0.0804: running tests fails when stdin is /dev/null
Christian Brabandt <cb@256bit.org>
parents:
11846
diff
changeset
|
4089 if (no_console_input() && !is_not_a_term()) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4090 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4091 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4092 if (argvars[0].v_type != VAR_LIST || argvars[0].vval.v_list == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4093 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
4094 semsg(_(e_listarg), "inputlist()"); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4095 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4096 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4097 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4098 msg_start(); |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4099 msg_row = Rows - 1; // for when 'cmdheight' > 1 |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4100 lines_left = Rows; // avoid more prompt |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4101 msg_scroll = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4102 msg_clr_eos(); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4103 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4104 for (li = argvars[0].vval.v_list->lv_first; li != NULL; li = li->li_next) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4105 { |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15510
diff
changeset
|
4106 msg_puts((char *)tv_get_string(&li->li_tv)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4107 msg_putchar('\n'); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4108 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4109 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4110 // Ask for choice. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4111 selected = prompt_for_number(&mouse_used); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4112 if (mouse_used) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4113 selected -= lines_left; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4114 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4115 rettv->vval.v_number = selected; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4116 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4117 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4118 static garray_T ga_userinput = {0, 0, sizeof(tasave_T), 4, NULL}; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4119 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4120 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4121 * "inputrestore()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4122 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4123 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4124 f_inputrestore(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4125 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4126 if (ga_userinput.ga_len > 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4127 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4128 --ga_userinput.ga_len; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4129 restore_typeahead((tasave_T *)(ga_userinput.ga_data) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4130 + ga_userinput.ga_len); |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4131 // default return is zero == OK |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4132 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4133 else if (p_verbose > 1) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4134 { |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15510
diff
changeset
|
4135 verb_msg(_("called inputrestore() more often than inputsave()")); |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4136 rettv->vval.v_number = 1; // Failed |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4137 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4138 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4139 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4140 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4141 * "inputsave()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4142 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4143 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4144 f_inputsave(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4145 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4146 // Add an entry to the stack of typeahead storage. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4147 if (ga_grow(&ga_userinput, 1) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4148 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4149 save_typeahead((tasave_T *)(ga_userinput.ga_data) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4150 + ga_userinput.ga_len); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4151 ++ga_userinput.ga_len; |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4152 // default return is zero == OK |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4153 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4154 else |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4155 rettv->vval.v_number = 1; // Failed |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4156 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4157 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4158 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4159 * "inputsecret()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4160 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4161 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4162 f_inputsecret(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4163 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4164 ++cmdline_star; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4165 ++inputsecret_flag; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4166 f_input(argvars, rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4167 --cmdline_star; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4168 --inputsecret_flag; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4169 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4170 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4171 /* |
18699
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
18687
diff
changeset
|
4172 * "interrupt()" function |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
18687
diff
changeset
|
4173 */ |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
18687
diff
changeset
|
4174 static void |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
18687
diff
changeset
|
4175 f_interrupt(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
18687
diff
changeset
|
4176 { |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
18687
diff
changeset
|
4177 got_int = TRUE; |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
18687
diff
changeset
|
4178 } |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
18687
diff
changeset
|
4179 |
1febd1aa9930
patch 8.1.2341: not so easy to interrupt a script programatically
Bram Moolenaar <Bram@vim.org>
parents:
18687
diff
changeset
|
4180 /* |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4181 * "invert(expr)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4182 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4183 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4184 f_invert(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4185 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4186 rettv->vval.v_number = ~tv_get_number_chk(&argvars[0], NULL); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4187 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4188 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4189 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4190 * Return TRUE if typeval "tv" is locked: Either that value is locked itself |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4191 * or it refers to a List or Dictionary that is locked. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4192 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4193 static int |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4194 tv_islocked(typval_T *tv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4195 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4196 return (tv->v_lock & VAR_LOCKED) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4197 || (tv->v_type == VAR_LIST |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4198 && tv->vval.v_list != NULL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4199 && (tv->vval.v_list->lv_lock & VAR_LOCKED)) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4200 || (tv->v_type == VAR_DICT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4201 && tv->vval.v_dict != NULL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4202 && (tv->vval.v_dict->dv_lock & VAR_LOCKED)); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4203 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4204 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4205 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4206 * "islocked()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4207 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4208 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4209 f_islocked(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4210 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4211 lval_T lv; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4212 char_u *end; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4213 dictitem_T *di; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4214 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4215 rettv->vval.v_number = -1; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4216 end = get_lval(tv_get_string(&argvars[0]), NULL, &lv, FALSE, FALSE, |
10912
fd1760f8c215
patch 8.0.0345: islocked('d.changedtick') does not work
Christian Brabandt <cb@256bit.org>
parents:
10889
diff
changeset
|
4217 GLV_NO_AUTOLOAD | GLV_READ_ONLY, FNE_CHECK_START); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4218 if (end != NULL && lv.ll_name != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4219 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4220 if (*end != NUL) |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
4221 emsg(_(e_trailing)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4222 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4223 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4224 if (lv.ll_tv == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4225 { |
10889
5780bd3a5a7e
patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
10787
diff
changeset
|
4226 di = find_var(lv.ll_name, NULL, TRUE); |
5780bd3a5a7e
patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
10787
diff
changeset
|
4227 if (di != NULL) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4228 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4229 // Consider a variable locked when: |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4230 // 1. the variable itself is locked |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4231 // 2. the value of the variable is locked. |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4232 // 3. the List or Dict value is locked. |
10889
5780bd3a5a7e
patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
10787
diff
changeset
|
4233 rettv->vval.v_number = ((di->di_flags & DI_FLAGS_LOCK) |
5780bd3a5a7e
patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
10787
diff
changeset
|
4234 || tv_islocked(&di->di_tv)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4235 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4236 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4237 else if (lv.ll_range) |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
4238 emsg(_("E786: Range not allowed")); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4239 else if (lv.ll_newkey != NULL) |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
4240 semsg(_(e_dictkey), lv.ll_newkey); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4241 else if (lv.ll_list != NULL) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4242 // List item. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4243 rettv->vval.v_number = tv_islocked(&lv.ll_li->li_tv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4244 else |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4245 // Dictionary item. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4246 rettv->vval.v_number = tv_islocked(&lv.ll_di->di_tv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4247 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4248 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4249 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4250 clear_lval(&lv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4251 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4252 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4253 #if defined(FEAT_FLOAT) && defined(HAVE_MATH_H) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4254 /* |
16213
2c33b119ba92
patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
4255 * "isinf()" function |
2c33b119ba92
patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
4256 */ |
2c33b119ba92
patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
4257 static void |
2c33b119ba92
patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
4258 f_isinf(typval_T *argvars, typval_T *rettv) |
2c33b119ba92
patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
4259 { |
2c33b119ba92
patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
4260 if (argvars[0].v_type == VAR_FLOAT && isinf(argvars[0].vval.v_float)) |
2c33b119ba92
patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
4261 rettv->vval.v_number = argvars[0].vval.v_float > 0.0 ? 1 : -1; |
2c33b119ba92
patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
4262 } |
2c33b119ba92
patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
4263 |
2c33b119ba92
patch 8.1.1111: it is not easy to check for infinity
Bram Moolenaar <Bram@vim.org>
parents:
16162
diff
changeset
|
4264 /* |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4265 * "isnan()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4266 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4267 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4268 f_isnan(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4269 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4270 rettv->vval.v_number = argvars[0].v_type == VAR_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4271 && isnan(argvars[0].vval.v_float); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4272 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4273 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4274 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4275 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4276 * "last_buffer_nr()" function. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4277 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4278 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4279 f_last_buffer_nr(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4280 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4281 int n = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4282 buf_T *buf; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4283 |
9649
fd9727ae3c49
commit https://github.com/vim/vim/commit/2932359000b2f918d5fade79ea4d124d5943cd07
Christian Brabandt <cb@256bit.org>
parents:
9636
diff
changeset
|
4284 FOR_ALL_BUFFERS(buf) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4285 if (n < buf->b_fnum) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4286 n = buf->b_fnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4287 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4288 rettv->vval.v_number = n; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4289 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4290 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4291 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4292 * "len()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4293 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4294 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4295 f_len(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4296 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4297 switch (argvars[0].v_type) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4298 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4299 case VAR_STRING: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4300 case VAR_NUMBER: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4301 rettv->vval.v_number = (varnumber_T)STRLEN( |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4302 tv_get_string(&argvars[0])); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4303 break; |
15454
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
4304 case VAR_BLOB: |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
4305 rettv->vval.v_number = blob_len(argvars[0].vval.v_blob); |
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
4306 break; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4307 case VAR_LIST: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4308 rettv->vval.v_number = list_len(argvars[0].vval.v_list); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4309 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4310 case VAR_DICT: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4311 rettv->vval.v_number = dict_len(argvars[0].vval.v_dict); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4312 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4313 case VAR_UNKNOWN: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4314 case VAR_SPECIAL: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4315 case VAR_FLOAT: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4316 case VAR_FUNC: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4317 case VAR_PARTIAL: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4318 case VAR_JOB: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4319 case VAR_CHANNEL: |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
4320 emsg(_("E701: Invalid type for len()")); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4321 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4322 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4323 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4324 |
10620
2198b53b9ffe
patch 8.0.0199: compiler warnings for libcall
Christian Brabandt <cb@256bit.org>
parents:
10567
diff
changeset
|
4325 static void |
2198b53b9ffe
patch 8.0.0199: compiler warnings for libcall
Christian Brabandt <cb@256bit.org>
parents:
10567
diff
changeset
|
4326 libcall_common(typval_T *argvars UNUSED, typval_T *rettv, int type) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4327 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4328 #ifdef FEAT_LIBCALL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4329 char_u *string_in; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4330 char_u **string_result; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4331 int nr_result; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4332 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4333 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4334 rettv->v_type = type; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4335 if (type != VAR_NUMBER) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4336 rettv->vval.v_string = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4337 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4338 if (check_restricted() || check_secure()) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4339 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4340 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4341 #ifdef FEAT_LIBCALL |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4342 // The first two args must be strings, otherwise it's meaningless |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4343 if (argvars[0].v_type == VAR_STRING && argvars[1].v_type == VAR_STRING) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4344 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4345 string_in = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4346 if (argvars[2].v_type == VAR_STRING) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4347 string_in = argvars[2].vval.v_string; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4348 if (type == VAR_NUMBER) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4349 string_result = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4350 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4351 string_result = &rettv->vval.v_string; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4352 if (mch_libcall(argvars[0].vval.v_string, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4353 argvars[1].vval.v_string, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4354 string_in, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4355 argvars[2].vval.v_number, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4356 string_result, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4357 &nr_result) == OK |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4358 && type == VAR_NUMBER) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4359 rettv->vval.v_number = nr_result; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4360 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4361 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4362 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4363 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4364 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4365 * "libcall()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4366 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4367 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4368 f_libcall(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4369 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4370 libcall_common(argvars, rettv, VAR_STRING); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4371 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4372 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4373 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4374 * "libcallnr()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4375 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4376 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4377 f_libcallnr(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4378 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4379 libcall_common(argvars, rettv, VAR_NUMBER); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4380 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4381 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4382 /* |
17942
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4383 * "line(string, [winid])" function |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4384 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4385 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4386 f_line(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4387 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4388 linenr_T lnum = 0; |
17942
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4389 pos_T *fp = NULL; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4390 int fnum; |
17942
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4391 int id; |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4392 tabpage_T *tp; |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4393 win_T *wp; |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4394 win_T *save_curwin; |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4395 tabpage_T *save_curtab; |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4396 |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4397 if (argvars[1].v_type != VAR_UNKNOWN) |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4398 { |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4399 // use window specified in the second argument |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4400 id = (int)tv_get_number(&argvars[1]); |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4401 wp = win_id2wp_tp(id, &tp); |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4402 if (wp != NULL && tp != NULL) |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4403 { |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4404 if (switch_win_noblock(&save_curwin, &save_curtab, wp, tp, TRUE) |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4405 == OK) |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4406 { |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4407 check_cursor(); |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4408 fp = var2fpos(&argvars[0], TRUE, &fnum); |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4409 } |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4410 restore_win_noblock(save_curwin, save_curtab, TRUE); |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4411 } |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4412 } |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4413 else |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4414 // use current window |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4415 fp = var2fpos(&argvars[0], TRUE, &fnum); |
664cc72f50c5
patch 8.1.1967: line() only works for the current window
Bram Moolenaar <Bram@vim.org>
parents:
17940
diff
changeset
|
4416 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4417 if (fp != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4418 lnum = fp->lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4419 rettv->vval.v_number = lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4420 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4421 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4422 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4423 * "line2byte(lnum)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4424 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4425 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4426 f_line2byte(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4427 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4428 #ifndef FEAT_BYTEOFF |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4429 rettv->vval.v_number = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4430 #else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4431 linenr_T lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4432 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4433 lnum = tv_get_lnum(argvars); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4434 if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count + 1) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4435 rettv->vval.v_number = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4436 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4437 rettv->vval.v_number = ml_find_line_or_offset(curbuf, lnum, NULL); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4438 if (rettv->vval.v_number >= 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4439 ++rettv->vval.v_number; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4440 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4441 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4442 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4443 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4444 * "localtime()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4445 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4446 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4447 f_localtime(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4448 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4449 rettv->vval.v_number = (varnumber_T)time(NULL); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4450 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4451 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4452 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4453 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4454 * "log()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4455 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4456 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4457 f_log(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4458 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4459 float_T f = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4460 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4461 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4462 if (get_float_arg(argvars, &f) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4463 rettv->vval.v_float = log(f); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4464 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4465 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4466 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4467 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4468 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4469 * "log10()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4470 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4471 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4472 f_log10(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4473 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4474 float_T f = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4475 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4476 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4477 if (get_float_arg(argvars, &f) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4478 rettv->vval.v_float = log10(f); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4479 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4480 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4481 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4482 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4483 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4484 #ifdef FEAT_LUA |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4485 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4486 * "luaeval()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4487 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4488 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4489 f_luaeval(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4490 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4491 char_u *str; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4492 char_u buf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4493 |
15748
93b78c4a7cd5
patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
4494 if (check_restricted() || check_secure()) |
93b78c4a7cd5
patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
4495 return; |
93b78c4a7cd5
patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
4496 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4497 str = tv_get_string_buf(&argvars[0], buf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4498 do_luaeval(str, argvars + 1, rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4499 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4500 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4501 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4502 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4503 * "maparg()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4504 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4505 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4506 f_maparg(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4507 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4508 get_maparg(argvars, rettv, TRUE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4509 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4510 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4511 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4512 * "mapcheck()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4513 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4514 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4515 f_mapcheck(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4516 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4517 get_maparg(argvars, rettv, FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4518 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4519 |
12248
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4520 typedef enum |
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4521 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4522 MATCH_END, // matchend() |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4523 MATCH_MATCH, // match() |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4524 MATCH_STR, // matchstr() |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4525 MATCH_LIST, // matchlist() |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4526 MATCH_POS // matchstrpos() |
12248
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4527 } matchtype_T; |
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4528 |
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4529 static void |
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4530 find_some_match(typval_T *argvars, typval_T *rettv, matchtype_T type) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4531 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4532 char_u *str = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4533 long len = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4534 char_u *expr = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4535 char_u *pat; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4536 regmatch_T regmatch; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4537 char_u patbuf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4538 char_u strbuf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4539 char_u *save_cpo; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4540 long start = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4541 long nth = 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4542 colnr_T startcol = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4543 int match = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4544 list_T *l = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4545 listitem_T *li = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4546 long idx = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4547 char_u *tofree = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4548 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4549 // Make 'cpoptions' empty, the 'l' flag should not be used here. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4550 save_cpo = p_cpo; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4551 p_cpo = (char_u *)""; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4552 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4553 rettv->vval.v_number = -1; |
12248
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4554 if (type == MATCH_LIST || type == MATCH_POS) |
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4555 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4556 // type MATCH_LIST: return empty list when there are no matches. |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4557 // type MATCH_POS: return ["", -1, -1, -1] |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4558 if (rettv_list_alloc(rettv) == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4559 goto theend; |
12248
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4560 if (type == MATCH_POS |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4561 && (list_append_string(rettv->vval.v_list, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4562 (char_u *)"", 0) == FAIL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4563 || list_append_number(rettv->vval.v_list, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4564 (varnumber_T)-1) == FAIL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4565 || list_append_number(rettv->vval.v_list, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4566 (varnumber_T)-1) == FAIL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4567 || list_append_number(rettv->vval.v_list, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4568 (varnumber_T)-1) == FAIL)) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4569 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4570 list_free(rettv->vval.v_list); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4571 rettv->vval.v_list = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4572 goto theend; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4573 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4574 } |
12248
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4575 else if (type == MATCH_STR) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4576 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4577 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4578 rettv->vval.v_string = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4579 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4580 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4581 if (argvars[0].v_type == VAR_LIST) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4582 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4583 if ((l = argvars[0].vval.v_list) == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4584 goto theend; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4585 li = l->lv_first; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4586 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4587 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4588 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4589 expr = str = tv_get_string(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4590 len = (long)STRLEN(str); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4591 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4592 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4593 pat = tv_get_string_buf_chk(&argvars[1], patbuf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4594 if (pat == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4595 goto theend; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4596 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4597 if (argvars[2].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4598 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4599 int error = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4600 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4601 start = (long)tv_get_number_chk(&argvars[2], &error); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4602 if (error) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4603 goto theend; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4604 if (l != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4605 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4606 li = list_find(l, start); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4607 if (li == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4608 goto theend; |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4609 idx = l->lv_idx; // use the cached index |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4610 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4611 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4612 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4613 if (start < 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4614 start = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4615 if (start > len) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4616 goto theend; |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4617 // When "count" argument is there ignore matches before "start", |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4618 // otherwise skip part of the string. Differs when pattern is "^" |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4619 // or "\<". |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4620 if (argvars[3].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4621 startcol = start; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4622 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4623 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4624 str += start; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4625 len -= start; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4626 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4627 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4628 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4629 if (argvars[3].v_type != VAR_UNKNOWN) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4630 nth = (long)tv_get_number_chk(&argvars[3], &error); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4631 if (error) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4632 goto theend; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4633 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4634 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4635 regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4636 if (regmatch.regprog != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4637 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4638 regmatch.rm_ic = p_ic; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4639 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4640 for (;;) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4641 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4642 if (l != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4643 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4644 if (li == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4645 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4646 match = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4647 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4648 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4649 vim_free(tofree); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4650 expr = str = echo_string(&li->li_tv, &tofree, strbuf, 0); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4651 if (str == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4652 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4653 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4654 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4655 match = vim_regexec_nl(®match, str, (colnr_T)startcol); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4656 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4657 if (match && --nth <= 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4658 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4659 if (l == NULL && !match) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4660 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4661 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4662 // Advance to just after the match. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4663 if (l != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4664 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4665 li = li->li_next; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4666 ++idx; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4667 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4668 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4669 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4670 startcol = (colnr_T)(regmatch.startp[0] |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4671 + (*mb_ptr2len)(regmatch.startp[0]) - str); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4672 if (startcol > (colnr_T)len |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4673 || str + startcol <= regmatch.startp[0]) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4674 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4675 match = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4676 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4677 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4678 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4679 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4680 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4681 if (match) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4682 { |
12248
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4683 if (type == MATCH_POS) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4684 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4685 listitem_T *li1 = rettv->vval.v_list->lv_first; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4686 listitem_T *li2 = li1->li_next; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4687 listitem_T *li3 = li2->li_next; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4688 listitem_T *li4 = li3->li_next; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4689 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4690 vim_free(li1->li_tv.vval.v_string); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4691 li1->li_tv.vval.v_string = vim_strnsave(regmatch.startp[0], |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4692 (int)(regmatch.endp[0] - regmatch.startp[0])); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4693 li3->li_tv.vval.v_number = |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4694 (varnumber_T)(regmatch.startp[0] - expr); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4695 li4->li_tv.vval.v_number = |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4696 (varnumber_T)(regmatch.endp[0] - expr); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4697 if (l != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4698 li2->li_tv.vval.v_number = (varnumber_T)idx; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4699 } |
12248
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4700 else if (type == MATCH_LIST) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4701 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4702 int i; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4703 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4704 // return list with matched string and submatches |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4705 for (i = 0; i < NSUBEXP; ++i) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4706 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4707 if (regmatch.endp[i] == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4708 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4709 if (list_append_string(rettv->vval.v_list, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4710 (char_u *)"", 0) == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4711 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4712 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4713 else if (list_append_string(rettv->vval.v_list, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4714 regmatch.startp[i], |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4715 (int)(regmatch.endp[i] - regmatch.startp[i])) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4716 == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4717 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4718 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4719 } |
12248
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4720 else if (type == MATCH_STR) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4721 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4722 // return matched string |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4723 if (l != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4724 copy_tv(&li->li_tv, rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4725 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4726 rettv->vval.v_string = vim_strnsave(regmatch.startp[0], |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4727 (int)(regmatch.endp[0] - regmatch.startp[0])); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4728 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4729 else if (l != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4730 rettv->vval.v_number = idx; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4731 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4732 { |
12248
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4733 if (type != MATCH_END) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4734 rettv->vval.v_number = |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4735 (varnumber_T)(regmatch.startp[0] - str); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4736 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4737 rettv->vval.v_number = |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4738 (varnumber_T)(regmatch.endp[0] - str); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4739 rettv->vval.v_number += (varnumber_T)(str - expr); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4740 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4741 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4742 vim_regfree(regmatch.regprog); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4743 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4744 |
12248
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4745 theend: |
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4746 if (type == MATCH_POS && l == NULL && rettv->vval.v_list != NULL) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
4747 // matchstrpos() without a list: drop the second item. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4748 listitem_remove(rettv->vval.v_list, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4749 rettv->vval.v_list->lv_first->li_next); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4750 vim_free(tofree); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4751 p_cpo = save_cpo; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4752 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4753 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4754 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4755 * "match()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4756 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4757 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4758 f_match(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4759 { |
12248
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4760 find_some_match(argvars, rettv, MATCH_MATCH); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4761 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4762 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4763 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4764 * "matchend()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4765 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4766 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4767 f_matchend(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4768 { |
12248
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4769 find_some_match(argvars, rettv, MATCH_END); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4770 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4771 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4772 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4773 * "matchlist()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4774 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4775 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4776 f_matchlist(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4777 { |
12248
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4778 find_some_match(argvars, rettv, MATCH_LIST); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4779 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4780 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4781 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4782 * "matchstr()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4783 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4784 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4785 f_matchstr(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4786 { |
12248
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4787 find_some_match(argvars, rettv, MATCH_STR); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4788 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4789 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4790 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4791 * "matchstrpos()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4792 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4793 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4794 f_matchstrpos(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4795 { |
12248
f9de19f981a4
patch 8.0.1004: matchstrpos() without a match returns too many items
Christian Brabandt <cb@256bit.org>
parents:
12144
diff
changeset
|
4796 find_some_match(argvars, rettv, MATCH_POS); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4797 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4798 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4799 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4800 max_min(typval_T *argvars, typval_T *rettv, int domax) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4801 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4802 varnumber_T n = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4803 varnumber_T i; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4804 int error = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4805 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4806 if (argvars[0].v_type == VAR_LIST) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4807 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4808 list_T *l; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4809 listitem_T *li; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4810 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4811 l = argvars[0].vval.v_list; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4812 if (l != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4813 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4814 li = l->lv_first; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4815 if (li != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4816 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4817 n = tv_get_number_chk(&li->li_tv, &error); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4818 for (;;) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4819 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4820 li = li->li_next; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4821 if (li == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4822 break; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4823 i = tv_get_number_chk(&li->li_tv, &error); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4824 if (domax ? i > n : i < n) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4825 n = i; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4826 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4827 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4828 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4829 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4830 else if (argvars[0].v_type == VAR_DICT) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4831 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4832 dict_T *d; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4833 int first = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4834 hashitem_T *hi; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4835 int todo; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4836 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4837 d = argvars[0].vval.v_dict; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4838 if (d != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4839 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4840 todo = (int)d->dv_hashtab.ht_used; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4841 for (hi = d->dv_hashtab.ht_array; todo > 0; ++hi) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4842 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4843 if (!HASHITEM_EMPTY(hi)) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4844 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4845 --todo; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4846 i = tv_get_number_chk(&HI2DI(hi)->di_tv, &error); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4847 if (first) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4848 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4849 n = i; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4850 first = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4851 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4852 else if (domax ? i > n : i < n) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4853 n = i; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4854 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4855 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4856 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4857 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4858 else |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
4859 semsg(_(e_listdictarg), domax ? "max()" : "min()"); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4860 rettv->vval.v_number = error ? 0 : n; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4861 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4862 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4863 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4864 * "max()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4865 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4866 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4867 f_max(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4868 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4869 max_min(argvars, rettv, TRUE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4870 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4871 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4872 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4873 * "min()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4874 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4875 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4876 f_min(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4877 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4878 max_min(argvars, rettv, FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4879 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4880 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4881 #if defined(FEAT_MZSCHEME) || defined(PROTO) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4882 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4883 * "mzeval()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4884 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4885 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4886 f_mzeval(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4887 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4888 char_u *str; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4889 char_u buf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4890 |
15748
93b78c4a7cd5
patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
4891 if (check_restricted() || check_secure()) |
93b78c4a7cd5
patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
4892 return; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4893 str = tv_get_string_buf(&argvars[0], buf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4894 do_mzeval(str, rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4895 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4896 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4897 void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4898 mzscheme_call_vim(char_u *name, typval_T *args, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4899 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4900 typval_T argvars[3]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4901 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4902 argvars[0].v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4903 argvars[0].vval.v_string = name; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4904 copy_tv(args, &argvars[1]); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4905 argvars[2].v_type = VAR_UNKNOWN; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4906 f_call(argvars, rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4907 clear_tv(&argvars[1]); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4908 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4909 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4910 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4911 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4912 * "nextnonblank()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4913 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4914 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4915 f_nextnonblank(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4916 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4917 linenr_T lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4918 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4919 for (lnum = tv_get_lnum(argvars); ; ++lnum) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4920 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4921 if (lnum < 0 || lnum > curbuf->b_ml.ml_line_count) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4922 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4923 lnum = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4924 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4925 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4926 if (*skipwhite(ml_get(lnum)) != NUL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4927 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4928 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4929 rettv->vval.v_number = lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4930 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4931 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4932 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4933 * "nr2char()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4934 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4935 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4936 f_nr2char(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4937 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4938 char_u buf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4939 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4940 if (has_mbyte) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4941 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4942 int utf8 = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4943 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4944 if (argvars[1].v_type != VAR_UNKNOWN) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4945 utf8 = (int)tv_get_number_chk(&argvars[1], NULL); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4946 if (utf8) |
15967
ddd82b1c9e9d
patch 8.1.0989: various small code ugliness
Bram Moolenaar <Bram@vim.org>
parents:
15955
diff
changeset
|
4947 buf[utf_char2bytes((int)tv_get_number(&argvars[0]), buf)] = NUL; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4948 else |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4949 buf[(*mb_char2bytes)((int)tv_get_number(&argvars[0]), buf)] = NUL; |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4950 } |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4951 else |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4952 { |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4953 buf[0] = (char_u)tv_get_number(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4954 buf[1] = NUL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4955 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4956 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4957 rettv->vval.v_string = vim_strsave(buf); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4958 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4959 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4960 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4961 * "or(expr, expr)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4962 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4963 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4964 f_or(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4965 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4966 rettv->vval.v_number = tv_get_number_chk(&argvars[0], NULL) |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4967 | tv_get_number_chk(&argvars[1], NULL); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4968 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4969 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4970 #ifdef FEAT_PERL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4971 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4972 * "perleval()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4973 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4974 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4975 f_perleval(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4976 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4977 char_u *str; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4978 char_u buf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4979 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
4980 str = tv_get_string_buf(&argvars[0], buf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4981 do_perleval(str, rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4982 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4983 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4984 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4985 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4986 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4987 * "pow()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4988 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4989 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4990 f_pow(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4991 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4992 float_T fx = 0.0, fy = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4993 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4994 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4995 if (get_float_arg(argvars, &fx) == OK |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4996 && get_float_arg(&argvars[1], &fy) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4997 rettv->vval.v_float = pow(fx, fy); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4998 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
4999 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5000 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5001 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5002 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5003 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5004 * "prevnonblank()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5005 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5006 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5007 f_prevnonblank(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5008 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5009 linenr_T lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5010 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5011 lnum = tv_get_lnum(argvars); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5012 if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5013 lnum = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5014 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5015 while (lnum >= 1 && *skipwhite(ml_get(lnum)) == NUL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5016 --lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5017 rettv->vval.v_number = lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5018 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5019 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5020 // This dummy va_list is here because: |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5021 // - passing a NULL pointer doesn't work when va_list isn't a pointer |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5022 // - locally in the function results in a "used before set" warning |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5023 // - using va_start() to initialize it gives "function with fixed args" error |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5024 static va_list ap; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5025 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5026 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5027 * "printf()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5028 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5029 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5030 f_printf(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5031 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5032 char_u buf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5033 int len; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5034 char_u *s; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5035 int saved_did_emsg = did_emsg; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5036 char *fmt; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5037 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5038 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5039 rettv->vval.v_string = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5040 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5041 // Get the required length, allocate the buffer and do it for real. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5042 did_emsg = FALSE; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5043 fmt = (char *)tv_get_string_buf(&argvars[0], buf); |
11653
67cf0d45b006
patch 8.0.0709: libvterm cannot use vsnprintf()
Christian Brabandt <cb@256bit.org>
parents:
11621
diff
changeset
|
5044 len = vim_vsnprintf_typval(NULL, 0, fmt, ap, argvars + 1); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5045 if (!did_emsg) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5046 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5047 s = alloc(len + 1); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5048 if (s != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5049 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5050 rettv->vval.v_string = s; |
11653
67cf0d45b006
patch 8.0.0709: libvterm cannot use vsnprintf()
Christian Brabandt <cb@256bit.org>
parents:
11621
diff
changeset
|
5051 (void)vim_vsnprintf_typval((char *)s, len + 1, fmt, |
67cf0d45b006
patch 8.0.0709: libvterm cannot use vsnprintf()
Christian Brabandt <cb@256bit.org>
parents:
11621
diff
changeset
|
5052 ap, argvars + 1); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5053 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5054 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5055 did_emsg |= saved_did_emsg; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5056 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5057 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5058 /* |
17756
a7afcea6f40a
patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17744
diff
changeset
|
5059 * "pum_getpos()" function |
a7afcea6f40a
patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17744
diff
changeset
|
5060 */ |
a7afcea6f40a
patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17744
diff
changeset
|
5061 static void |
a7afcea6f40a
patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17744
diff
changeset
|
5062 f_pum_getpos(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
a7afcea6f40a
patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17744
diff
changeset
|
5063 { |
a7afcea6f40a
patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17744
diff
changeset
|
5064 if (rettv_dict_alloc(rettv) != OK) |
a7afcea6f40a
patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17744
diff
changeset
|
5065 return; |
a7afcea6f40a
patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17744
diff
changeset
|
5066 pum_set_event_info(rettv->vval.v_dict); |
a7afcea6f40a
patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17744
diff
changeset
|
5067 } |
a7afcea6f40a
patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17744
diff
changeset
|
5068 |
a7afcea6f40a
patch 8.1.1875: cannot get size and position of the popup menu
Bram Moolenaar <Bram@vim.org>
parents:
17744
diff
changeset
|
5069 /* |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5070 * "pumvisible()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5071 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5072 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5073 f_pumvisible(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5074 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5075 if (pum_visible()) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5076 rettv->vval.v_number = 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5077 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5078 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5079 #ifdef FEAT_PYTHON3 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5080 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5081 * "py3eval()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5082 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5083 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5084 f_py3eval(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5085 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5086 char_u *str; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5087 char_u buf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5088 |
15748
93b78c4a7cd5
patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
5089 if (check_restricted() || check_secure()) |
93b78c4a7cd5
patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
5090 return; |
93b78c4a7cd5
patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
5091 |
10722
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5092 if (p_pyx == 0) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5093 p_pyx = 3; |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5094 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5095 str = tv_get_string_buf(&argvars[0], buf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5096 do_py3eval(str, rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5097 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5098 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5099 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5100 #ifdef FEAT_PYTHON |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5101 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5102 * "pyeval()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5103 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5104 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5105 f_pyeval(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5106 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5107 char_u *str; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5108 char_u buf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5109 |
15748
93b78c4a7cd5
patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
5110 if (check_restricted() || check_secure()) |
93b78c4a7cd5
patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
5111 return; |
93b78c4a7cd5
patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
5112 |
10722
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5113 if (p_pyx == 0) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5114 p_pyx = 2; |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5115 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5116 str = tv_get_string_buf(&argvars[0], buf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5117 do_pyeval(str, rettv); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5118 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5119 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5120 |
10722
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5121 #if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5122 /* |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5123 * "pyxeval()" function |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5124 */ |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5125 static void |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5126 f_pyxeval(typval_T *argvars, typval_T *rettv) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5127 { |
15748
93b78c4a7cd5
patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
5128 if (check_restricted() || check_secure()) |
93b78c4a7cd5
patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
5129 return; |
93b78c4a7cd5
patch 8.1.0881: can execute shell commands in rvim through interfaces
Bram Moolenaar <Bram@vim.org>
parents:
15725
diff
changeset
|
5130 |
10722
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5131 # if defined(FEAT_PYTHON) && defined(FEAT_PYTHON3) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5132 init_pyxversion(); |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5133 if (p_pyx == 2) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5134 f_pyeval(argvars, rettv); |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5135 else |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5136 f_py3eval(argvars, rettv); |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5137 # elif defined(FEAT_PYTHON) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5138 f_pyeval(argvars, rettv); |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5139 # elif defined(FEAT_PYTHON3) |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5140 f_py3eval(argvars, rettv); |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5141 # endif |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5142 } |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5143 #endif |
7598ce51bf2a
patch 8.0.0251: not easy to select Python 2 or 3
Christian Brabandt <cb@256bit.org>
parents:
10706
diff
changeset
|
5144 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5145 /* |
18701
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5146 * "rand()" function |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5147 */ |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5148 static void |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5149 f_rand(typval_T *argvars, typval_T *rettv) |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5150 { |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5151 list_T *l = NULL; |
18732
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5152 static list_T *globl = NULL; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5153 UINT32_T x, y, z, w, t, result; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5154 listitem_T *lx, *ly, *lz, *lw; |
18701
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5155 |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5156 if (argvars[0].v_type == VAR_UNKNOWN) |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5157 { |
18732
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5158 // When no argument is given use the global seed list. |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5159 if (globl == NULL) |
18701
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5160 { |
18732
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5161 // Initialize the global seed list. |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5162 f_srand(argvars, rettv); |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5163 l = rettv->vval.v_list; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5164 if (l == NULL || list_len(l) != 4) |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5165 { |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5166 clear_tv(rettv); |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5167 goto theend; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5168 } |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5169 globl = l; |
18701
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5170 } |
18732
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5171 else |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5172 l = globl; |
18701
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5173 } |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5174 else if (argvars[0].v_type == VAR_LIST) |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5175 { |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5176 l = argvars[0].vval.v_list; |
18732
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5177 if (l == NULL || list_len(l) != 4) |
18701
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5178 goto theend; |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5179 } |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5180 else |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5181 goto theend; |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5182 |
18732
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5183 lx = list_find(l, 0L); |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5184 ly = list_find(l, 1L); |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5185 lz = list_find(l, 2L); |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5186 lw = list_find(l, 3L); |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5187 if (lx->li_tv.v_type != VAR_NUMBER) goto theend; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5188 if (ly->li_tv.v_type != VAR_NUMBER) goto theend; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5189 if (lz->li_tv.v_type != VAR_NUMBER) goto theend; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5190 if (lw->li_tv.v_type != VAR_NUMBER) goto theend; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5191 x = (UINT32_T)lx->li_tv.vval.v_number; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5192 y = (UINT32_T)ly->li_tv.vval.v_number; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5193 z = (UINT32_T)lz->li_tv.vval.v_number; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5194 w = (UINT32_T)lw->li_tv.vval.v_number; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5195 |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5196 // SHUFFLE_XOSHIRO128STARSTAR |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5197 #define ROTL(x, k) ((x << k) | (x >> (32 - k))) |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5198 result = ROTL(y * 5, 7) * 9; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5199 t = y << 9; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5200 z ^= x; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5201 w ^= y; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5202 y ^= z, x ^= w; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5203 z ^= t; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5204 w = ROTL(w, 11); |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5205 #undef ROTL |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5206 |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5207 lx->li_tv.vval.v_number = (varnumber_T)x; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5208 ly->li_tv.vval.v_number = (varnumber_T)y; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5209 lz->li_tv.vval.v_number = (varnumber_T)z; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5210 lw->li_tv.vval.v_number = (varnumber_T)w; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5211 |
18701
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5212 rettv->v_type = VAR_NUMBER; |
18732
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5213 rettv->vval.v_number = (varnumber_T)result; |
18701
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5214 return; |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5215 |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5216 theend: |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5217 semsg(_(e_invarg2), tv_get_string(&argvars[0])); |
18732
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5218 rettv->v_type = VAR_NUMBER; |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
5219 rettv->vval.v_number = -1; |
18701
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5220 } |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5221 |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
5222 /* |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5223 * "range()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5224 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5225 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5226 f_range(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5227 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5228 varnumber_T start; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5229 varnumber_T end; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5230 varnumber_T stride = 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5231 varnumber_T i; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5232 int error = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5233 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5234 start = tv_get_number_chk(&argvars[0], &error); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5235 if (argvars[1].v_type == VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5236 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5237 end = start - 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5238 start = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5239 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5240 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5241 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5242 end = tv_get_number_chk(&argvars[1], &error); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5243 if (argvars[2].v_type != VAR_UNKNOWN) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5244 stride = tv_get_number_chk(&argvars[2], &error); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5245 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5246 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5247 if (error) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5248 return; // type error; errmsg already given |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5249 if (stride == 0) |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
5250 emsg(_("E726: Stride is zero")); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5251 else if (stride > 0 ? end + 1 < start : end - 1 > start) |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
5252 emsg(_("E727: Start past end")); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5253 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5254 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5255 if (rettv_list_alloc(rettv) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5256 for (i = start; stride > 0 ? i <= end : i >= end; i += stride) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5257 if (list_append_number(rettv->vval.v_list, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5258 (varnumber_T)i) == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5259 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5260 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5261 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5262 |
14004
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5263 static void |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5264 return_register(int regname, typval_T *rettv) |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5265 { |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5266 char_u buf[2] = {0, 0}; |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5267 |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5268 buf[0] = (char_u)regname; |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5269 rettv->v_type = VAR_STRING; |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5270 rettv->vval.v_string = vim_strsave(buf); |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5271 } |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5272 |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5273 /* |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5274 * "reg_executing()" function |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5275 */ |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5276 static void |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5277 f_reg_executing(typval_T *argvars UNUSED, typval_T *rettv) |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5278 { |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5279 return_register(reg_executing, rettv); |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5280 } |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5281 |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5282 /* |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5283 * "reg_recording()" function |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5284 */ |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5285 static void |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5286 f_reg_recording(typval_T *argvars UNUSED, typval_T *rettv) |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5287 { |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5288 return_register(reg_recording, rettv); |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5289 } |
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13986
diff
changeset
|
5290 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5291 #if defined(FEAT_RELTIME) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5292 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5293 * Convert a List to proftime_T. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5294 * Return FAIL when there is something wrong. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5295 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5296 static int |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5297 list2proftime(typval_T *arg, proftime_T *tm) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5298 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5299 long n1, n2; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5300 int error = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5301 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5302 if (arg->v_type != VAR_LIST || arg->vval.v_list == NULL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5303 || arg->vval.v_list->lv_len != 2) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5304 return FAIL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5305 n1 = list_find_nr(arg->vval.v_list, 0L, &error); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5306 n2 = list_find_nr(arg->vval.v_list, 1L, &error); |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
5307 # ifdef MSWIN |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5308 tm->HighPart = n1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5309 tm->LowPart = n2; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5310 # else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5311 tm->tv_sec = n1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5312 tm->tv_usec = n2; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5313 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5314 return error ? FAIL : OK; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5315 } |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5316 #endif // FEAT_RELTIME |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5317 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5318 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5319 * "reltime()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5320 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5321 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5322 f_reltime(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5323 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5324 #ifdef FEAT_RELTIME |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5325 proftime_T res; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5326 proftime_T start; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5327 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5328 if (argvars[0].v_type == VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5329 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5330 // No arguments: get current time. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5331 profile_start(&res); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5332 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5333 else if (argvars[1].v_type == VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5334 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5335 if (list2proftime(&argvars[0], &res) == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5336 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5337 profile_end(&res); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5338 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5339 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5340 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5341 // Two arguments: compute the difference. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5342 if (list2proftime(&argvars[0], &start) == FAIL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5343 || list2proftime(&argvars[1], &res) == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5344 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5345 profile_sub(&res, &start); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5346 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5347 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5348 if (rettv_list_alloc(rettv) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5349 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5350 long n1, n2; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5351 |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
5352 # ifdef MSWIN |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5353 n1 = res.HighPart; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5354 n2 = res.LowPart; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5355 # else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5356 n1 = res.tv_sec; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5357 n2 = res.tv_usec; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5358 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5359 list_append_number(rettv->vval.v_list, (varnumber_T)n1); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5360 list_append_number(rettv->vval.v_list, (varnumber_T)n2); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5361 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5362 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5363 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5364 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5365 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5366 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5367 * "reltimefloat()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5368 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5369 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5370 f_reltimefloat(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5371 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5372 # ifdef FEAT_RELTIME |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5373 proftime_T tm; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5374 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5375 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5376 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5377 rettv->vval.v_float = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5378 # ifdef FEAT_RELTIME |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5379 if (list2proftime(&argvars[0], &tm) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5380 rettv->vval.v_float = profile_float(&tm); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5381 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5382 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5383 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5384 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5385 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5386 * "reltimestr()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5387 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5388 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5389 f_reltimestr(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5390 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5391 #ifdef FEAT_RELTIME |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5392 proftime_T tm; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5393 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5394 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5395 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5396 rettv->vval.v_string = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5397 #ifdef FEAT_RELTIME |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5398 if (list2proftime(&argvars[0], &tm) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5399 rettv->vval.v_string = vim_strsave((char_u *)profile_msg(&tm)); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5400 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5401 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5402 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5403 #if defined(FEAT_CLIENTSERVER) && defined(FEAT_X11) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5404 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5405 make_connection(void) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5406 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5407 if (X_DISPLAY == NULL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5408 # ifdef FEAT_GUI |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5409 && !gui.in_use |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5410 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5411 ) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5412 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5413 x_force_connect = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5414 setup_term_clip(); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5415 x_force_connect = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5416 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5417 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5418 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5419 static int |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5420 check_connection(void) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5421 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5422 make_connection(); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5423 if (X_DISPLAY == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5424 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
5425 emsg(_("E240: No connection to the X server")); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5426 return FAIL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5427 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5428 return OK; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5429 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5430 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5431 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5432 #ifdef FEAT_CLIENTSERVER |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5433 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5434 remote_common(typval_T *argvars, typval_T *rettv, int expr) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5435 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5436 char_u *server_name; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5437 char_u *keys; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5438 char_u *r = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5439 char_u buf[NUMBUFLEN]; |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5440 int timeout = 0; |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
5441 # ifdef MSWIN |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5442 HWND w; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5443 # else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5444 Window w; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5445 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5446 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5447 if (check_restricted() || check_secure()) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5448 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5449 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5450 # ifdef FEAT_X11 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5451 if (check_connection() == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5452 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5453 # endif |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5454 if (argvars[2].v_type != VAR_UNKNOWN |
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5455 && argvars[3].v_type != VAR_UNKNOWN) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5456 timeout = tv_get_number(&argvars[3]); |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5457 |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5458 server_name = tv_get_string_chk(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5459 if (server_name == NULL) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5460 return; // type error; errmsg already given |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5461 keys = tv_get_string_buf(&argvars[1], buf); |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
5462 # ifdef MSWIN |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5463 if (serverSendToVim(server_name, keys, &r, &w, expr, timeout, TRUE) < 0) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5464 # else |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5465 if (serverSendToVim(X_DISPLAY, server_name, keys, &r, &w, expr, timeout, |
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5466 0, TRUE) < 0) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5467 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5468 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5469 if (r != NULL) |
12399
de1ae9d8ef57
patch 8.0.1079: memory leak when remote_foreground() fails
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
5470 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
5471 emsg((char *)r); // sending worked but evaluation failed |
12399
de1ae9d8ef57
patch 8.0.1079: memory leak when remote_foreground() fails
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
5472 vim_free(r); |
de1ae9d8ef57
patch 8.0.1079: memory leak when remote_foreground() fails
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
5473 } |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5474 else |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
5475 semsg(_("E241: Unable to send to %s"), server_name); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5476 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5477 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5478 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5479 rettv->vval.v_string = r; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5480 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5481 if (argvars[2].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5482 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5483 dictitem_T v; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5484 char_u str[30]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5485 char_u *idvar; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5486 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5487 idvar = tv_get_string_chk(&argvars[2]); |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5488 if (idvar != NULL && *idvar != NUL) |
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5489 { |
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5490 sprintf((char *)str, PRINTF_HEX_LONG_U, (long_u)w); |
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5491 v.di_tv.v_type = VAR_STRING; |
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5492 v.di_tv.vval.v_string = vim_strsave(str); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5493 set_var(idvar, &v.di_tv, FALSE); |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5494 vim_free(v.di_tv.vval.v_string); |
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5495 } |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5496 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5497 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5498 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5499 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5500 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5501 * "remote_expr()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5502 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5503 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5504 f_remote_expr(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5505 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5506 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5507 rettv->vval.v_string = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5508 #ifdef FEAT_CLIENTSERVER |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5509 remote_common(argvars, rettv, TRUE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5510 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5511 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5512 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5513 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5514 * "remote_foreground()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5515 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5516 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5517 f_remote_foreground(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5518 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5519 #ifdef FEAT_CLIENTSERVER |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
5520 # ifdef MSWIN |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5521 // On Win32 it's done in this application. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5522 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5523 char_u *server_name = tv_get_string_chk(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5524 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5525 if (server_name != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5526 serverForeground(server_name); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5527 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5528 # else |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5529 // Send a foreground() expression to the server. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5530 argvars[1].v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5531 argvars[1].vval.v_string = vim_strsave((char_u *)"foreground()"); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5532 argvars[2].v_type = VAR_UNKNOWN; |
12399
de1ae9d8ef57
patch 8.0.1079: memory leak when remote_foreground() fails
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
5533 rettv->v_type = VAR_STRING; |
de1ae9d8ef57
patch 8.0.1079: memory leak when remote_foreground() fails
Christian Brabandt <cb@256bit.org>
parents:
12389
diff
changeset
|
5534 rettv->vval.v_string = NULL; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5535 remote_common(argvars, rettv, TRUE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5536 vim_free(argvars[1].vval.v_string); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5537 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5538 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5539 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5540 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5541 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5542 f_remote_peek(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5543 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5544 #ifdef FEAT_CLIENTSERVER |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5545 dictitem_T v; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5546 char_u *s = NULL; |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
5547 # ifdef MSWIN |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5548 long_u n = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5549 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5550 char_u *serverid; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5551 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5552 if (check_restricted() || check_secure()) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5553 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5554 rettv->vval.v_number = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5555 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5556 } |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5557 serverid = tv_get_string_chk(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5558 if (serverid == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5559 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5560 rettv->vval.v_number = -1; |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5561 return; // type error; errmsg already given |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5562 } |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
5563 # ifdef MSWIN |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5564 sscanf((const char *)serverid, SCANF_HEX_LONG_U, &n); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5565 if (n == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5566 rettv->vval.v_number = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5567 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5568 { |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5569 s = serverGetReply((HWND)n, FALSE, FALSE, FALSE, 0); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5570 rettv->vval.v_number = (s != NULL); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5571 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5572 # else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5573 if (check_connection() == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5574 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5575 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5576 rettv->vval.v_number = serverPeekReply(X_DISPLAY, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5577 serverStrToWin(serverid), &s); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5578 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5579 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5580 if (argvars[1].v_type != VAR_UNKNOWN && rettv->vval.v_number > 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5581 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5582 char_u *retvar; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5583 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5584 v.di_tv.v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5585 v.di_tv.vval.v_string = vim_strsave(s); |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5586 retvar = tv_get_string_chk(&argvars[1]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5587 if (retvar != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5588 set_var(retvar, &v.di_tv, FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5589 vim_free(v.di_tv.vval.v_string); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5590 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5591 #else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5592 rettv->vval.v_number = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5593 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5594 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5595 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5596 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5597 f_remote_read(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5598 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5599 char_u *r = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5600 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5601 #ifdef FEAT_CLIENTSERVER |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5602 char_u *serverid = tv_get_string_chk(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5603 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5604 if (serverid != NULL && !check_restricted() && !check_secure()) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5605 { |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5606 int timeout = 0; |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
5607 # ifdef MSWIN |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5608 // The server's HWND is encoded in the 'id' parameter |
11215
2e4877acfe0a
patch 8.0.0494: build failure with older compiler on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11211
diff
changeset
|
5609 long_u n = 0; |
2e4877acfe0a
patch 8.0.0494: build failure with older compiler on MS-Windows
Christian Brabandt <cb@256bit.org>
parents:
11211
diff
changeset
|
5610 # endif |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5611 |
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5612 if (argvars[1].v_type != VAR_UNKNOWN) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5613 timeout = tv_get_number(&argvars[1]); |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5614 |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
5615 # ifdef MSWIN |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5616 sscanf((char *)serverid, SCANF_HEX_LONG_U, &n); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5617 if (n != 0) |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5618 r = serverGetReply((HWND)n, FALSE, TRUE, TRUE, timeout); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5619 if (r == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5620 # else |
11211
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5621 if (check_connection() == FAIL |
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5622 || serverReadReply(X_DISPLAY, serverStrToWin(serverid), |
71311d899b42
patch 8.0.0492: a failing client-server request can make Vim hang
Christian Brabandt <cb@256bit.org>
parents:
11181
diff
changeset
|
5623 &r, FALSE, timeout) < 0) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5624 # endif |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
5625 emsg(_("E277: Unable to read a server reply")); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5626 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5627 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5628 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5629 rettv->vval.v_string = r; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5630 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5631 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5632 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5633 * "remote_send()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5634 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5635 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5636 f_remote_send(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5637 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5638 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5639 rettv->vval.v_string = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5640 #ifdef FEAT_CLIENTSERVER |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5641 remote_common(argvars, rettv, FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5642 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5643 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5644 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5645 /* |
11177
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5646 * "remote_startserver()" function |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5647 */ |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5648 static void |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5649 f_remote_startserver(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5650 { |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5651 #ifdef FEAT_CLIENTSERVER |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5652 char_u *server = tv_get_string_chk(&argvars[0]); |
11177
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5653 |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5654 if (server == NULL) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5655 return; // type error; errmsg already given |
11177
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5656 if (serverName != NULL) |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
5657 emsg(_("E941: already started a server")); |
11177
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5658 else |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5659 { |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5660 # ifdef FEAT_X11 |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5661 if (check_connection() == OK) |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5662 serverRegisterName(X_DISPLAY, server); |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5663 # else |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5664 serverSetName(server); |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5665 # endif |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5666 } |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5667 #else |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
5668 emsg(_("E942: +clientserver feature not available")); |
11177
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5669 #endif |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5670 } |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5671 |
76fb679a310e
patch 8.0.0475: not enough testing for the client-server feature
Christian Brabandt <cb@256bit.org>
parents:
11129
diff
changeset
|
5672 /* |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5673 * "rename({from}, {to})" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5674 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5675 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5676 f_rename(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5677 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5678 char_u buf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5679 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5680 if (check_restricted() || check_secure()) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5681 rettv->vval.v_number = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5682 else |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5683 rettv->vval.v_number = vim_rename(tv_get_string(&argvars[0]), |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5684 tv_get_string_buf(&argvars[1], buf)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5685 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5686 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5687 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5688 * "repeat()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5689 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5690 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5691 f_repeat(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5692 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5693 char_u *p; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5694 int n; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5695 int slen; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5696 int len; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5697 char_u *r; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5698 int i; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5699 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5700 n = (int)tv_get_number(&argvars[1]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5701 if (argvars[0].v_type == VAR_LIST) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5702 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5703 if (rettv_list_alloc(rettv) == OK && argvars[0].vval.v_list != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5704 while (n-- > 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5705 if (list_extend(rettv->vval.v_list, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5706 argvars[0].vval.v_list, NULL) == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5707 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5708 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5709 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5710 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5711 p = tv_get_string(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5712 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5713 rettv->vval.v_string = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5714 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5715 slen = (int)STRLEN(p); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5716 len = slen * n; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5717 if (len <= 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5718 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5719 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5720 r = alloc(len + 1); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5721 if (r != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5722 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5723 for (i = 0; i < n; i++) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5724 mch_memmove(r + i * slen, p, (size_t)slen); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5725 r[len] = NUL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5726 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5727 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5728 rettv->vval.v_string = r; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5729 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5730 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5731 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5732 #define SP_NOMOVE 0x01 // don't move cursor |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5733 #define SP_REPEAT 0x02 // repeat to find outer pair |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5734 #define SP_RETCOUNT 0x04 // return matchcount |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5735 #define SP_SETPCMARK 0x08 // set previous context mark |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5736 #define SP_START 0x10 // accept match at start position |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5737 #define SP_SUBPAT 0x20 // return nr of matching sub-pattern |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5738 #define SP_END 0x40 // leave cursor at end of match |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5739 #define SP_COLUMN 0x80 // start at cursor column |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5740 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5741 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5742 * Get flags for a search function. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5743 * Possibly sets "p_ws". |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5744 * Returns BACKWARD, FORWARD or zero (for an error). |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5745 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5746 static int |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5747 get_search_arg(typval_T *varp, int *flagsp) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5748 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5749 int dir = FORWARD; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5750 char_u *flags; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5751 char_u nbuf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5752 int mask; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5753 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5754 if (varp->v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5755 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5756 flags = tv_get_string_buf_chk(varp, nbuf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5757 if (flags == NULL) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5758 return 0; // type error; errmsg already given |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5759 while (*flags != NUL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5760 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5761 switch (*flags) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5762 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5763 case 'b': dir = BACKWARD; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5764 case 'w': p_ws = TRUE; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5765 case 'W': p_ws = FALSE; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5766 default: mask = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5767 if (flagsp != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5768 switch (*flags) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5769 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5770 case 'c': mask = SP_START; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5771 case 'e': mask = SP_END; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5772 case 'm': mask = SP_RETCOUNT; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5773 case 'n': mask = SP_NOMOVE; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5774 case 'p': mask = SP_SUBPAT; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5775 case 'r': mask = SP_REPEAT; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5776 case 's': mask = SP_SETPCMARK; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5777 case 'z': mask = SP_COLUMN; break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5778 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5779 if (mask == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5780 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
5781 semsg(_(e_invarg2), flags); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5782 dir = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5783 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5784 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5785 *flagsp |= mask; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5786 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5787 if (dir == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5788 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5789 ++flags; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5790 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5791 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5792 return dir; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5793 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5794 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5795 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5796 * Shared by search() and searchpos() functions. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5797 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5798 static int |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5799 search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5800 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5801 int flags; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5802 char_u *pat; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5803 pos_T pos; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5804 pos_T save_cursor; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5805 int save_p_ws = p_ws; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5806 int dir; |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5807 int retval = 0; // default: FAIL |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5808 long lnum_stop = 0; |
18358
34d5cd432cac
patch 8.1.2173: searchit() has too many arguments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
5809 #ifdef FEAT_RELTIME |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5810 proftime_T tm; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5811 long time_limit = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5812 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5813 int options = SEARCH_KEEP; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5814 int subpatnum; |
18358
34d5cd432cac
patch 8.1.2173: searchit() has too many arguments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
5815 searchit_arg_T sia; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5816 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5817 pat = tv_get_string(&argvars[0]); |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5818 dir = get_search_arg(&argvars[1], flagsp); // may set p_ws |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5819 if (dir == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5820 goto theend; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5821 flags = *flagsp; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5822 if (flags & SP_START) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5823 options |= SEARCH_START; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5824 if (flags & SP_END) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5825 options |= SEARCH_END; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5826 if (flags & SP_COLUMN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5827 options |= SEARCH_COL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5828 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5829 // Optional arguments: line number to stop searching and timeout. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5830 if (argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5831 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5832 lnum_stop = (long)tv_get_number_chk(&argvars[2], NULL); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5833 if (lnum_stop < 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5834 goto theend; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5835 #ifdef FEAT_RELTIME |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5836 if (argvars[3].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5837 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5838 time_limit = (long)tv_get_number_chk(&argvars[3], NULL); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5839 if (time_limit < 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5840 goto theend; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5841 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5842 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5843 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5844 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5845 #ifdef FEAT_RELTIME |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5846 // Set the time limit, if there is one. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5847 profile_setlimit(time_limit, &tm); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5848 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5849 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5850 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5851 * This function does not accept SP_REPEAT and SP_RETCOUNT flags. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5852 * Check to make sure only those flags are set. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5853 * Also, Only the SP_NOMOVE or the SP_SETPCMARK flag can be set. Both |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5854 * flags cannot be set. Check for that condition also. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5855 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5856 if (((flags & (SP_REPEAT | SP_RETCOUNT)) != 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5857 || ((flags & SP_NOMOVE) && (flags & SP_SETPCMARK))) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5858 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
5859 semsg(_(e_invarg2), tv_get_string(&argvars[1])); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5860 goto theend; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5861 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5862 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5863 pos = save_cursor = curwin->w_cursor; |
18358
34d5cd432cac
patch 8.1.2173: searchit() has too many arguments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
5864 vim_memset(&sia, 0, sizeof(sia)); |
34d5cd432cac
patch 8.1.2173: searchit() has too many arguments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
5865 sia.sa_stop_lnum = (linenr_T)lnum_stop; |
34d5cd432cac
patch 8.1.2173: searchit() has too many arguments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
5866 #ifdef FEAT_RELTIME |
34d5cd432cac
patch 8.1.2173: searchit() has too many arguments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
5867 sia.sa_tm = &tm; |
34d5cd432cac
patch 8.1.2173: searchit() has too many arguments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
5868 #endif |
15239
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
15219
diff
changeset
|
5869 subpatnum = searchit(curwin, curbuf, &pos, NULL, dir, pat, 1L, |
18358
34d5cd432cac
patch 8.1.2173: searchit() has too many arguments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
5870 options, RE_SEARCH, &sia); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5871 if (subpatnum != FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5872 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5873 if (flags & SP_SUBPAT) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5874 retval = subpatnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5875 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5876 retval = pos.lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5877 if (flags & SP_SETPCMARK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5878 setpcmark(); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5879 curwin->w_cursor = pos; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5880 if (match_pos != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5881 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5882 // Store the match cursor position |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5883 match_pos->lnum = pos.lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5884 match_pos->col = pos.col + 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5885 } |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5886 // "/$" will put the cursor after the end of the line, may need to |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5887 // correct that here |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5888 check_cursor(); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5889 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5890 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
5891 // If 'n' flag is used: restore cursor position. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5892 if (flags & SP_NOMOVE) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5893 curwin->w_cursor = save_cursor; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5894 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5895 curwin->w_set_curswant = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5896 theend: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5897 p_ws = save_p_ws; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5898 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5899 return retval; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5900 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5901 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5902 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5903 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5904 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5905 * round() is not in C90, use ceil() or floor() instead. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5906 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5907 float_T |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5908 vim_round(float_T f) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5909 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5910 return f > 0 ? floor(f + 0.5) : ceil(f - 0.5); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5911 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5912 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5913 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5914 * "round({float})" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5915 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5916 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5917 f_round(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5918 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5919 float_T f = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5920 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5921 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5922 if (get_float_arg(argvars, &f) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5923 rettv->vval.v_float = vim_round(f); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5924 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5925 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5926 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5927 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5928 |
16103
518f44125207
patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents:
16078
diff
changeset
|
5929 #ifdef FEAT_RUBY |
518f44125207
patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents:
16078
diff
changeset
|
5930 /* |
518f44125207
patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents:
16078
diff
changeset
|
5931 * "rubyeval()" function |
518f44125207
patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents:
16078
diff
changeset
|
5932 */ |
518f44125207
patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents:
16078
diff
changeset
|
5933 static void |
518f44125207
patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents:
16078
diff
changeset
|
5934 f_rubyeval(typval_T *argvars, typval_T *rettv) |
518f44125207
patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents:
16078
diff
changeset
|
5935 { |
518f44125207
patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents:
16078
diff
changeset
|
5936 char_u *str; |
518f44125207
patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents:
16078
diff
changeset
|
5937 char_u buf[NUMBUFLEN]; |
518f44125207
patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents:
16078
diff
changeset
|
5938 |
518f44125207
patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents:
16078
diff
changeset
|
5939 str = tv_get_string_buf(&argvars[0], buf); |
518f44125207
patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents:
16078
diff
changeset
|
5940 do_rubyeval(str, rettv); |
518f44125207
patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents:
16078
diff
changeset
|
5941 } |
518f44125207
patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents:
16078
diff
changeset
|
5942 #endif |
518f44125207
patch 8.1.1056: no eval function for Ruby
Bram Moolenaar <Bram@vim.org>
parents:
16078
diff
changeset
|
5943 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5944 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5945 * "screenattr()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5946 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5947 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5948 f_screenattr(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5949 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5950 int row; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5951 int col; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5952 int c; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5953 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5954 row = (int)tv_get_number_chk(&argvars[0], NULL) - 1; |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5955 col = (int)tv_get_number_chk(&argvars[1], NULL) - 1; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5956 if (row < 0 || row >= screen_Rows |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5957 || col < 0 || col >= screen_Columns) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5958 c = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5959 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5960 c = ScreenAttrs[LineOffset[row] + col]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5961 rettv->vval.v_number = c; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5962 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5963 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5964 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5965 * "screenchar()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5966 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5967 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5968 f_screenchar(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5969 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5970 int row; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5971 int col; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5972 int off; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5973 int c; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5974 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5975 row = (int)tv_get_number_chk(&argvars[0], NULL) - 1; |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
5976 col = (int)tv_get_number_chk(&argvars[1], NULL) - 1; |
16133
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
5977 if (row < 0 || row >= screen_Rows || col < 0 || col >= screen_Columns) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5978 c = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5979 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5980 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5981 off = LineOffset[row] + col; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5982 if (enc_utf8 && ScreenLinesUC[off] != 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5983 c = ScreenLinesUC[off]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5984 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5985 c = ScreenLines[off]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5986 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5987 rettv->vval.v_number = c; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5988 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5989 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5990 /* |
16133
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
5991 * "screenchars()" function |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
5992 */ |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
5993 static void |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
5994 f_screenchars(typval_T *argvars, typval_T *rettv) |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
5995 { |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
5996 int row; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
5997 int col; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
5998 int off; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
5999 int c; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6000 int i; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6001 |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6002 if (rettv_list_alloc(rettv) == FAIL) |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6003 return; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6004 row = (int)tv_get_number_chk(&argvars[0], NULL) - 1; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6005 col = (int)tv_get_number_chk(&argvars[1], NULL) - 1; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6006 if (row < 0 || row >= screen_Rows || col < 0 || col >= screen_Columns) |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6007 return; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6008 |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6009 off = LineOffset[row] + col; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6010 if (enc_utf8 && ScreenLinesUC[off] != 0) |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6011 c = ScreenLinesUC[off]; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6012 else |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6013 c = ScreenLines[off]; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6014 list_append_number(rettv->vval.v_list, (varnumber_T)c); |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6015 |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6016 if (enc_utf8) |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6017 |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6018 for (i = 0; i < Screen_mco && ScreenLinesC[i][off] != 0; ++i) |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6019 list_append_number(rettv->vval.v_list, |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6020 (varnumber_T)ScreenLinesC[i][off]); |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6021 } |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6022 |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6023 /* |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6024 * "screencol()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6025 * |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6026 * First column is 1 to be consistent with virtcol(). |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6027 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6028 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6029 f_screencol(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6030 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6031 rettv->vval.v_number = screen_screencol() + 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6032 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6033 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6034 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6035 * "screenrow()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6036 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6037 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6038 f_screenrow(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6039 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6040 rettv->vval.v_number = screen_screenrow() + 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6041 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6042 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6043 /* |
16133
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6044 * "screenstring()" function |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6045 */ |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6046 static void |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6047 f_screenstring(typval_T *argvars, typval_T *rettv) |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6048 { |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6049 int row; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6050 int col; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6051 int off; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6052 int c; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6053 int i; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6054 char_u buf[MB_MAXBYTES + 1]; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6055 int buflen = 0; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6056 |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6057 rettv->vval.v_string = NULL; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6058 rettv->v_type = VAR_STRING; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6059 |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6060 row = (int)tv_get_number_chk(&argvars[0], NULL) - 1; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6061 col = (int)tv_get_number_chk(&argvars[1], NULL) - 1; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6062 if (row < 0 || row >= screen_Rows || col < 0 || col >= screen_Columns) |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6063 return; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6064 |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6065 off = LineOffset[row] + col; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6066 if (enc_utf8 && ScreenLinesUC[off] != 0) |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6067 c = ScreenLinesUC[off]; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6068 else |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6069 c = ScreenLines[off]; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6070 buflen += mb_char2bytes(c, buf); |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6071 |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6072 if (enc_utf8) |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6073 for (i = 0; i < Screen_mco && ScreenLinesC[i][off] != 0; ++i) |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6074 buflen += mb_char2bytes(ScreenLinesC[i][off], buf + buflen); |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6075 |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6076 buf[buflen] = NUL; |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6077 rettv->vval.v_string = vim_strsave(buf); |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6078 } |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6079 |
eb087f8a26a8
patch 8.1.1071: cannot get composing characters from the screen
Bram Moolenaar <Bram@vim.org>
parents:
16127
diff
changeset
|
6080 /* |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6081 * "search()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6082 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6083 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6084 f_search(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6085 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6086 int flags = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6087 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6088 rettv->vval.v_number = search_cmn(argvars, NULL, &flags); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6089 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6090 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6091 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6092 * "searchdecl()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6093 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6094 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6095 f_searchdecl(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6096 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6097 int locally = 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6098 int thisblock = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6099 int error = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6100 char_u *name; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6101 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6102 rettv->vval.v_number = 1; // default: FAIL |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6103 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6104 name = tv_get_string_chk(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6105 if (argvars[1].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6106 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6107 locally = (int)tv_get_number_chk(&argvars[1], &error) == 0; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6108 if (!error && argvars[2].v_type != VAR_UNKNOWN) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6109 thisblock = (int)tv_get_number_chk(&argvars[2], &error) != 0; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6110 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6111 if (!error && name != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6112 rettv->vval.v_number = find_decl(name, (int)STRLEN(name), |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6113 locally, thisblock, SEARCH_KEEP) == FAIL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6114 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6115 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6116 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6117 * Used by searchpair() and searchpairpos() |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6118 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6119 static int |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6120 searchpair_cmn(typval_T *argvars, pos_T *match_pos) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6121 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6122 char_u *spat, *mpat, *epat; |
12722
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6123 typval_T *skip; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6124 int save_p_ws = p_ws; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6125 int dir; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6126 int flags = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6127 char_u nbuf1[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6128 char_u nbuf2[NUMBUFLEN]; |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6129 int retval = 0; // default: FAIL |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6130 long lnum_stop = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6131 long time_limit = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6132 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6133 // Get the three pattern arguments: start, middle, end. Will result in an |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6134 // error if not a valid argument. |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6135 spat = tv_get_string_chk(&argvars[0]); |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6136 mpat = tv_get_string_buf_chk(&argvars[1], nbuf1); |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6137 epat = tv_get_string_buf_chk(&argvars[2], nbuf2); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6138 if (spat == NULL || mpat == NULL || epat == NULL) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6139 goto theend; // type error |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6140 |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6141 // Handle the optional fourth argument: flags |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6142 dir = get_search_arg(&argvars[3], &flags); // may set p_ws |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6143 if (dir == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6144 goto theend; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6145 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6146 // Don't accept SP_END or SP_SUBPAT. |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6147 // Only one of the SP_NOMOVE or SP_SETPCMARK flags can be set. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6148 if ((flags & (SP_END | SP_SUBPAT)) != 0 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6149 || ((flags & SP_NOMOVE) && (flags & SP_SETPCMARK))) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6150 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
6151 semsg(_(e_invarg2), tv_get_string(&argvars[3])); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6152 goto theend; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6153 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6154 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6155 // Using 'r' implies 'W', otherwise it doesn't work. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6156 if (flags & SP_REPEAT) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6157 p_ws = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6158 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6159 // Optional fifth argument: skip expression |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6160 if (argvars[3].v_type == VAR_UNKNOWN |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6161 || argvars[4].v_type == VAR_UNKNOWN) |
12722
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6162 skip = NULL; |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6163 else |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6164 { |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6165 skip = &argvars[4]; |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6166 if (skip->v_type != VAR_FUNC && skip->v_type != VAR_PARTIAL |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6167 && skip->v_type != VAR_STRING) |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6168 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6169 // Type error |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
6170 semsg(_(e_invarg2), tv_get_string(&argvars[4])); |
12722
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6171 goto theend; |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6172 } |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6173 if (argvars[5].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6174 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6175 lnum_stop = (long)tv_get_number_chk(&argvars[5], NULL); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6176 if (lnum_stop < 0) |
14189
0181a2cad0a1
patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents:
14175
diff
changeset
|
6177 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
6178 semsg(_(e_invarg2), tv_get_string(&argvars[5])); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6179 goto theend; |
14189
0181a2cad0a1
patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents:
14175
diff
changeset
|
6180 } |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6181 #ifdef FEAT_RELTIME |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6182 if (argvars[6].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6183 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6184 time_limit = (long)tv_get_number_chk(&argvars[6], NULL); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6185 if (time_limit < 0) |
14189
0181a2cad0a1
patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents:
14175
diff
changeset
|
6186 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
6187 semsg(_(e_invarg2), tv_get_string(&argvars[6])); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6188 goto theend; |
14189
0181a2cad0a1
patch 8.1.0112: no error when using bad arguments with searchpair()
Christian Brabandt <cb@256bit.org>
parents:
14175
diff
changeset
|
6189 } |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6190 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6191 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6192 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6193 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6194 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6195 retval = do_searchpair(spat, mpat, epat, dir, skip, flags, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6196 match_pos, lnum_stop, time_limit); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6197 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6198 theend: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6199 p_ws = save_p_ws; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6200 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6201 return retval; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6202 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6203 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6204 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6205 * "searchpair()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6206 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6207 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6208 f_searchpair(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6209 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6210 rettv->vval.v_number = searchpair_cmn(argvars, NULL); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6211 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6212 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6213 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6214 * "searchpairpos()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6215 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6216 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6217 f_searchpairpos(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6218 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6219 pos_T match_pos; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6220 int lnum = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6221 int col = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6222 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6223 if (rettv_list_alloc(rettv) == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6224 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6225 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6226 if (searchpair_cmn(argvars, &match_pos) > 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6227 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6228 lnum = match_pos.lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6229 col = match_pos.col; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6230 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6231 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6232 list_append_number(rettv->vval.v_list, (varnumber_T)lnum); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6233 list_append_number(rettv->vval.v_list, (varnumber_T)col); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6234 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6235 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6236 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6237 * Search for a start/middle/end thing. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6238 * Used by searchpair(), see its documentation for the details. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6239 * Returns 0 or -1 for no match, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6240 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6241 long |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6242 do_searchpair( |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6243 char_u *spat, // start pattern |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6244 char_u *mpat, // middle pattern |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6245 char_u *epat, // end pattern |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6246 int dir, // BACKWARD or FORWARD |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6247 typval_T *skip, // skip expression |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6248 int flags, // SP_SETPCMARK and other SP_ values |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6249 pos_T *match_pos, |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6250 linenr_T lnum_stop, // stop at this line if not zero |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6251 long time_limit UNUSED) // stop after this many msec |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6252 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6253 char_u *save_cpo; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6254 char_u *pat, *pat2 = NULL, *pat3 = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6255 long retval = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6256 pos_T pos; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6257 pos_T firstpos; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6258 pos_T foundpos; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6259 pos_T save_cursor; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6260 pos_T save_pos; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6261 int n; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6262 int r; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6263 int nest = 1; |
12722
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6264 int use_skip = FALSE; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6265 int err; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6266 int options = SEARCH_KEEP; |
18358
34d5cd432cac
patch 8.1.2173: searchit() has too many arguments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
6267 #ifdef FEAT_RELTIME |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6268 proftime_T tm; |
18358
34d5cd432cac
patch 8.1.2173: searchit() has too many arguments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
6269 #endif |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6270 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6271 // Make 'cpoptions' empty, the 'l' flag should not be used here. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6272 save_cpo = p_cpo; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6273 p_cpo = empty_option; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6274 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6275 #ifdef FEAT_RELTIME |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6276 // Set the time limit, if there is one. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6277 profile_setlimit(time_limit, &tm); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6278 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6279 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6280 // Make two search patterns: start/end (pat2, for in nested pairs) and |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6281 // start/middle/end (pat3, for the top pair). |
16764
ef00b6bc186b
patch 8.1.1384: using "int" for alloc() often results in compiler warnings
Bram Moolenaar <Bram@vim.org>
parents:
16752
diff
changeset
|
6282 pat2 = alloc(STRLEN(spat) + STRLEN(epat) + 17); |
ef00b6bc186b
patch 8.1.1384: using "int" for alloc() often results in compiler warnings
Bram Moolenaar <Bram@vim.org>
parents:
16752
diff
changeset
|
6283 pat3 = alloc(STRLEN(spat) + STRLEN(mpat) + STRLEN(epat) + 25); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6284 if (pat2 == NULL || pat3 == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6285 goto theend; |
10514
1435e45ee6fa
commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents:
10501
diff
changeset
|
6286 sprintf((char *)pat2, "\\m\\(%s\\m\\)\\|\\(%s\\m\\)", spat, epat); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6287 if (*mpat == NUL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6288 STRCPY(pat3, pat2); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6289 else |
10514
1435e45ee6fa
commit https://github.com/vim/vim/commit/6e450a57541676036203a72d40b2e604e938371e
Christian Brabandt <cb@256bit.org>
parents:
10501
diff
changeset
|
6290 sprintf((char *)pat3, "\\m\\(%s\\m\\)\\|\\(%s\\m\\)\\|\\(%s\\m\\)", |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6291 spat, epat, mpat); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6292 if (flags & SP_START) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6293 options |= SEARCH_START; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6294 |
12722
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6295 if (skip != NULL) |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6296 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6297 // Empty string means to not use the skip expression. |
12722
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6298 if (skip->v_type == VAR_STRING || skip->v_type == VAR_FUNC) |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6299 use_skip = skip->vval.v_string != NULL |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6300 && *skip->vval.v_string != NUL; |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6301 } |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6302 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6303 save_cursor = curwin->w_cursor; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6304 pos = curwin->w_cursor; |
11121
778c10516955
patch 8.0.0448: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
6305 CLEAR_POS(&firstpos); |
778c10516955
patch 8.0.0448: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
6306 CLEAR_POS(&foundpos); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6307 pat = pat3; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6308 for (;;) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6309 { |
18358
34d5cd432cac
patch 8.1.2173: searchit() has too many arguments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
6310 searchit_arg_T sia; |
34d5cd432cac
patch 8.1.2173: searchit() has too many arguments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
6311 |
34d5cd432cac
patch 8.1.2173: searchit() has too many arguments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
6312 vim_memset(&sia, 0, sizeof(sia)); |
34d5cd432cac
patch 8.1.2173: searchit() has too many arguments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
6313 sia.sa_stop_lnum = lnum_stop; |
34d5cd432cac
patch 8.1.2173: searchit() has too many arguments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
6314 #ifdef FEAT_RELTIME |
34d5cd432cac
patch 8.1.2173: searchit() has too many arguments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
6315 sia.sa_tm = &tm; |
34d5cd432cac
patch 8.1.2173: searchit() has too many arguments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
6316 #endif |
15239
db5d2429bda3
patch 8.1.0629: "gn" selects the wrong text with a multi-line match
Bram Moolenaar <Bram@vim.org>
parents:
15219
diff
changeset
|
6317 n = searchit(curwin, curbuf, &pos, NULL, dir, pat, 1L, |
18358
34d5cd432cac
patch 8.1.2173: searchit() has too many arguments
Bram Moolenaar <Bram@vim.org>
parents:
18354
diff
changeset
|
6318 options, RE_SEARCH, &sia); |
11121
778c10516955
patch 8.0.0448: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
6319 if (n == FAIL || (firstpos.lnum != 0 && EQUAL_POS(pos, firstpos))) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6320 // didn't find it or found the first match again: FAIL |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6321 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6322 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6323 if (firstpos.lnum == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6324 firstpos = pos; |
11121
778c10516955
patch 8.0.0448: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents:
11105
diff
changeset
|
6325 if (EQUAL_POS(pos, foundpos)) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6326 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6327 // Found the same position again. Can happen with a pattern that |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6328 // has "\zs" at the end and searching backwards. Advance one |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6329 // character and try again. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6330 if (dir == BACKWARD) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6331 decl(&pos); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6332 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6333 incl(&pos); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6334 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6335 foundpos = pos; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6336 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6337 // clear the start flag to avoid getting stuck here |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6338 options &= ~SEARCH_START; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6339 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6340 // If the skip pattern matches, ignore this match. |
12722
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6341 if (use_skip) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6342 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6343 save_pos = curwin->w_cursor; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6344 curwin->w_cursor = pos; |
12722
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6345 err = FALSE; |
7749260f261c
patch 8.0.1239: cannot use a lambda for the skip argument to searchpair()
Christian Brabandt <cb@256bit.org>
parents:
12716
diff
changeset
|
6346 r = eval_expr_to_bool(skip, &err); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6347 curwin->w_cursor = save_pos; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6348 if (err) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6349 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6350 // Evaluating {skip} caused an error, break here. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6351 curwin->w_cursor = save_cursor; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6352 retval = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6353 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6354 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6355 if (r) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6356 continue; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6357 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6358 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6359 if ((dir == BACKWARD && n == 3) || (dir == FORWARD && n == 2)) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6360 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6361 // Found end when searching backwards or start when searching |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6362 // forward: nested pair. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6363 ++nest; |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6364 pat = pat2; // nested, don't search for middle |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6365 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6366 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6367 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6368 // Found end when searching forward or start when searching |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6369 // backward: end of (nested) pair; or found middle in outer pair. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6370 if (--nest == 1) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6371 pat = pat3; // outer level, search for middle |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6372 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6373 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6374 if (nest == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6375 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6376 // Found the match: return matchcount or line number. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6377 if (flags & SP_RETCOUNT) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6378 ++retval; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6379 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6380 retval = pos.lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6381 if (flags & SP_SETPCMARK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6382 setpcmark(); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6383 curwin->w_cursor = pos; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6384 if (!(flags & SP_REPEAT)) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6385 break; |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6386 nest = 1; // search for next unmatched |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6387 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6388 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6389 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6390 if (match_pos != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6391 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6392 // Store the match cursor position |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6393 match_pos->lnum = curwin->w_cursor.lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6394 match_pos->col = curwin->w_cursor.col + 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6395 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6396 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6397 // If 'n' flag is used or search failed: restore cursor position. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6398 if ((flags & SP_NOMOVE) || retval == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6399 curwin->w_cursor = save_cursor; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6400 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6401 theend: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6402 vim_free(pat2); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6403 vim_free(pat3); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6404 if (p_cpo == empty_option) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6405 p_cpo = save_cpo; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6406 else |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6407 // Darn, evaluating the {skip} expression changed the value. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6408 free_string_option(save_cpo); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6409 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6410 return retval; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6411 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6412 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6413 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6414 * "searchpos()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6415 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6416 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6417 f_searchpos(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6418 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6419 pos_T match_pos; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6420 int lnum = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6421 int col = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6422 int n; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6423 int flags = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6424 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6425 if (rettv_list_alloc(rettv) == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6426 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6427 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6428 n = search_cmn(argvars, &match_pos, &flags); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6429 if (n > 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6430 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6431 lnum = match_pos.lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6432 col = match_pos.col; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6433 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6434 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6435 list_append_number(rettv->vval.v_list, (varnumber_T)lnum); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6436 list_append_number(rettv->vval.v_list, (varnumber_T)col); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6437 if (flags & SP_SUBPAT) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6438 list_append_number(rettv->vval.v_list, (varnumber_T)n); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6439 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6440 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6441 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6442 f_server2client(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6443 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6444 #ifdef FEAT_CLIENTSERVER |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6445 char_u buf[NUMBUFLEN]; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6446 char_u *server = tv_get_string_chk(&argvars[0]); |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6447 char_u *reply = tv_get_string_buf_chk(&argvars[1], buf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6448 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6449 rettv->vval.v_number = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6450 if (server == NULL || reply == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6451 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6452 if (check_restricted() || check_secure()) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6453 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6454 # ifdef FEAT_X11 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6455 if (check_connection() == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6456 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6457 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6458 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6459 if (serverSendReply(server, reply) < 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6460 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
6461 emsg(_("E258: Unable to send to client")); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6462 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6463 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6464 rettv->vval.v_number = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6465 #else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6466 rettv->vval.v_number = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6467 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6468 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6469 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6470 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6471 f_serverlist(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6472 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6473 char_u *r = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6474 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6475 #ifdef FEAT_CLIENTSERVER |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
6476 # ifdef MSWIN |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6477 r = serverGetVimNames(); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6478 # else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6479 make_connection(); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6480 if (X_DISPLAY != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6481 r = serverGetVimNames(X_DISPLAY); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6482 # endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6483 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6484 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6485 rettv->vval.v_string = r; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6486 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6487 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6488 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6489 f_setcharsearch(typval_T *argvars, typval_T *rettv UNUSED) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6490 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6491 dict_T *d; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6492 dictitem_T *di; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6493 char_u *csearch; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6494 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6495 if (argvars[0].v_type != VAR_DICT) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6496 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
6497 emsg(_(e_dictreq)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6498 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6499 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6500 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6501 if ((d = argvars[0].vval.v_dict) != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6502 { |
15146
7903dce131d4
patch 8.1.0583: using illogical name for get_dict_number()/get_dict_string()
Bram Moolenaar <Bram@vim.org>
parents:
15138
diff
changeset
|
6503 csearch = dict_get_string(d, (char_u *)"char", FALSE); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6504 if (csearch != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6505 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6506 if (enc_utf8) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6507 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6508 int pcc[MAX_MCO]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6509 int c = utfc_ptr2char(csearch, pcc); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6510 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6511 set_last_csearch(c, csearch, utfc_ptr2len(csearch)); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6512 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6513 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6514 set_last_csearch(PTR2CHAR(csearch), |
18251
c8a53c0daeed
patch 8.1.2120: some MB_ macros are more complicated than necessary
Bram Moolenaar <Bram@vim.org>
parents:
18225
diff
changeset
|
6515 csearch, mb_ptr2len(csearch)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6516 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6517 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6518 di = dict_find(d, (char_u *)"forward", -1); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6519 if (di != NULL) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6520 set_csearch_direction((int)tv_get_number(&di->di_tv) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6521 ? FORWARD : BACKWARD); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6522 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6523 di = dict_find(d, (char_u *)"until", -1); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6524 if (di != NULL) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6525 set_csearch_until(!!tv_get_number(&di->di_tv)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6526 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6527 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6528 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6529 /* |
16604
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
6530 * "setenv()" function |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
6531 */ |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
6532 static void |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
6533 f_setenv(typval_T *argvars, typval_T *rettv UNUSED) |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
6534 { |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
6535 char_u namebuf[NUMBUFLEN]; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
6536 char_u valbuf[NUMBUFLEN]; |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
6537 char_u *name = tv_get_string_buf(&argvars[0], namebuf); |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
6538 |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
6539 if (argvars[1].v_type == VAR_SPECIAL |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
6540 && argvars[1].vval.v_number == VVAL_NULL) |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
6541 vim_unsetenv(name); |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
6542 else |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
6543 vim_setenv(name, tv_get_string_buf(&argvars[1], valbuf)); |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
6544 } |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
6545 |
1e0a5f09fdf1
patch 8.1.1305: there is no easy way to manipulate environment variables
Bram Moolenaar <Bram@vim.org>
parents:
16600
diff
changeset
|
6546 /* |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6547 * "setfperm({fname}, {mode})" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6548 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6549 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6550 f_setfperm(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6551 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6552 char_u *fname; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6553 char_u modebuf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6554 char_u *mode_str; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6555 int i; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6556 int mask; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6557 int mode = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6558 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6559 rettv->vval.v_number = 0; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6560 fname = tv_get_string_chk(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6561 if (fname == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6562 return; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6563 mode_str = tv_get_string_buf_chk(&argvars[1], modebuf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6564 if (mode_str == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6565 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6566 if (STRLEN(mode_str) != 9) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6567 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
6568 semsg(_(e_invarg2), mode_str); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6569 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6570 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6571 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6572 mask = 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6573 for (i = 8; i >= 0; --i) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6574 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6575 if (mode_str[i] != '-') |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6576 mode |= mask; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6577 mask = mask << 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6578 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6579 rettv->vval.v_number = mch_setperm(fname, mode) == OK; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6580 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6581 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6582 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6583 * "setpos()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6584 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6585 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6586 f_setpos(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6587 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6588 pos_T pos; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6589 int fnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6590 char_u *name; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6591 colnr_T curswant = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6592 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6593 rettv->vval.v_number = -1; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6594 name = tv_get_string_chk(argvars); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6595 if (name != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6596 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6597 if (list2fpos(&argvars[1], &pos, &fnum, &curswant) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6598 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6599 if (--pos.col < 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6600 pos.col = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6601 if (name[0] == '.' && name[1] == NUL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6602 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6603 // set cursor; "fnum" is ignored |
10732
390ad2cccd3f
patch 8.0.0256: missing changes to one file breaks test
Christian Brabandt <cb@256bit.org>
parents:
10722
diff
changeset
|
6604 curwin->w_cursor = pos; |
390ad2cccd3f
patch 8.0.0256: missing changes to one file breaks test
Christian Brabandt <cb@256bit.org>
parents:
10722
diff
changeset
|
6605 if (curswant >= 0) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6606 { |
10732
390ad2cccd3f
patch 8.0.0256: missing changes to one file breaks test
Christian Brabandt <cb@256bit.org>
parents:
10722
diff
changeset
|
6607 curwin->w_curswant = curswant - 1; |
390ad2cccd3f
patch 8.0.0256: missing changes to one file breaks test
Christian Brabandt <cb@256bit.org>
parents:
10722
diff
changeset
|
6608 curwin->w_set_curswant = FALSE; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6609 } |
10732
390ad2cccd3f
patch 8.0.0256: missing changes to one file breaks test
Christian Brabandt <cb@256bit.org>
parents:
10722
diff
changeset
|
6610 check_cursor(); |
390ad2cccd3f
patch 8.0.0256: missing changes to one file breaks test
Christian Brabandt <cb@256bit.org>
parents:
10722
diff
changeset
|
6611 rettv->vval.v_number = 0; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6612 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6613 else if (name[0] == '\'' && name[1] != NUL && name[2] == NUL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6614 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6615 // set mark |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6616 if (setmark_pos(name[1], &pos, fnum) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6617 rettv->vval.v_number = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6618 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6619 else |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
6620 emsg(_(e_invarg)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6621 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6622 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6623 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6624 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6625 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6626 * "setreg()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6627 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6628 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6629 f_setreg(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6630 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6631 int regname; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6632 char_u *strregname; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6633 char_u *stropt; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6634 char_u *strval; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6635 int append; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6636 char_u yank_type; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6637 long block_len; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6638 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6639 block_len = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6640 yank_type = MAUTO; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6641 append = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6642 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6643 strregname = tv_get_string_chk(argvars); |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6644 rettv->vval.v_number = 1; // FAIL is default |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6645 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6646 if (strregname == NULL) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6647 return; // type error; errmsg already given |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6648 regname = *strregname; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6649 if (regname == 0 || regname == '@') |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6650 regname = '"'; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6651 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6652 if (argvars[2].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6653 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6654 stropt = tv_get_string_chk(&argvars[2]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6655 if (stropt == NULL) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6656 return; // type error |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6657 for (; *stropt != NUL; ++stropt) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6658 switch (*stropt) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6659 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6660 case 'a': case 'A': // append |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6661 append = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6662 break; |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6663 case 'v': case 'c': // character-wise selection |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6664 yank_type = MCHAR; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6665 break; |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6666 case 'V': case 'l': // line-wise selection |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6667 yank_type = MLINE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6668 break; |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6669 case 'b': case Ctrl_V: // block-wise selection |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6670 yank_type = MBLOCK; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6671 if (VIM_ISDIGIT(stropt[1])) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6672 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6673 ++stropt; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6674 block_len = getdigits(&stropt) - 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6675 --stropt; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6676 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6677 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6678 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6679 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6680 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6681 if (argvars[1].v_type == VAR_LIST) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6682 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6683 char_u **lstval; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6684 char_u **allocval; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6685 char_u buf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6686 char_u **curval; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6687 char_u **curallocval; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6688 list_T *ll = argvars[1].vval.v_list; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6689 listitem_T *li; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6690 int len; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6691 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6692 // If the list is NULL handle like an empty list. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6693 len = ll == NULL ? 0 : ll->lv_len; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6694 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6695 // First half: use for pointers to result lines; second half: use for |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6696 // pointers to allocated copies. |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
6697 lstval = ALLOC_MULT(char_u *, (len + 1) * 2); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6698 if (lstval == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6699 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6700 curval = lstval; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6701 allocval = lstval + len + 2; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6702 curallocval = allocval; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6703 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6704 for (li = ll == NULL ? NULL : ll->lv_first; li != NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6705 li = li->li_next) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6706 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6707 strval = tv_get_string_buf_chk(&li->li_tv, buf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6708 if (strval == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6709 goto free_lstval; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6710 if (strval == buf) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6711 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6712 // Need to make a copy, next tv_get_string_buf_chk() will |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6713 // overwrite the string. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6714 strval = vim_strsave(buf); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6715 if (strval == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6716 goto free_lstval; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6717 *curallocval++ = strval; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6718 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6719 *curval++ = strval; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6720 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6721 *curval++ = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6722 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6723 write_reg_contents_lst(regname, lstval, -1, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6724 append, yank_type, block_len); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6725 free_lstval: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6726 while (curallocval > allocval) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6727 vim_free(*--curallocval); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6728 vim_free(lstval); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6729 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6730 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6731 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6732 strval = tv_get_string_chk(&argvars[1]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6733 if (strval == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6734 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6735 write_reg_contents_ex(regname, strval, -1, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6736 append, yank_type, block_len); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6737 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6738 rettv->vval.v_number = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6739 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6740 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6741 /* |
15016
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6742 * "settagstack()" function |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6743 */ |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6744 static void |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6745 f_settagstack(typval_T *argvars, typval_T *rettv) |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6746 { |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6747 static char *e_invact2 = N_("E962: Invalid action: '%s'"); |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6748 win_T *wp; |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6749 dict_T *d; |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6750 int action = 'r'; |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6751 |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6752 rettv->vval.v_number = -1; |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6753 |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6754 // first argument: window number or id |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6755 wp = find_win_by_nr_or_id(&argvars[0]); |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6756 if (wp == NULL) |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6757 return; |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6758 |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6759 // second argument: dict with items to set in the tag stack |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6760 if (argvars[1].v_type != VAR_DICT) |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6761 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
6762 emsg(_(e_dictreq)); |
15016
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6763 return; |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6764 } |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6765 d = argvars[1].vval.v_dict; |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6766 if (d == NULL) |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6767 return; |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6768 |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6769 // third argument: action - 'a' for append and 'r' for replace. |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6770 // default is to replace the stack. |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6771 if (argvars[2].v_type == VAR_UNKNOWN) |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6772 action = 'r'; |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6773 else if (argvars[2].v_type == VAR_STRING) |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6774 { |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6775 char_u *actstr; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6776 actstr = tv_get_string_chk(&argvars[2]); |
15016
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6777 if (actstr == NULL) |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6778 return; |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6779 if ((*actstr == 'r' || *actstr == 'a') && actstr[1] == NUL) |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6780 action = *actstr; |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6781 else |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6782 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
6783 semsg(_(e_invact2), actstr); |
15016
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6784 return; |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6785 } |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6786 } |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6787 else |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6788 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
6789 emsg(_(e_stringreq)); |
15016
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6790 return; |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6791 } |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6792 |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6793 if (set_tagstack(wp, d, action) == OK) |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6794 rettv->vval.v_number = 0; |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6795 } |
c338c91086b9
patch 8.1.0519: cannot save and restore the tag stack
Bram Moolenaar <Bram@vim.org>
parents:
14966
diff
changeset
|
6796 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6797 #ifdef FEAT_CRYPT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6798 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6799 * "sha256({string})" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6800 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6801 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6802 f_sha256(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6803 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6804 char_u *p; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6805 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6806 p = tv_get_string(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6807 rettv->vval.v_string = vim_strsave( |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6808 sha256_bytes(p, (int)STRLEN(p), NULL, 0)); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6809 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6810 } |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6811 #endif // FEAT_CRYPT |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6812 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6813 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6814 * "shellescape({string})" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6815 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6816 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6817 f_shellescape(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6818 { |
11484
3933a3bf9385
patch 8.0.0625: shellescape() always escapes a newline
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
6819 int do_special = non_zero_arg(&argvars[1]); |
3933a3bf9385
patch 8.0.0625: shellescape() always escapes a newline
Christian Brabandt <cb@256bit.org>
parents:
11461
diff
changeset
|
6820 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6821 rettv->vval.v_string = vim_strsave_shellescape( |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6822 tv_get_string(&argvars[0]), do_special, do_special); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6823 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6824 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6825 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6826 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6827 * shiftwidth() function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6828 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6829 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6830 f_shiftwidth(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6831 { |
15062
3a94f7918980
patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents:
15020
diff
changeset
|
6832 rettv->vval.v_number = 0; |
3a94f7918980
patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents:
15020
diff
changeset
|
6833 |
3a94f7918980
patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents:
15020
diff
changeset
|
6834 if (argvars[0].v_type != VAR_UNKNOWN) |
3a94f7918980
patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents:
15020
diff
changeset
|
6835 { |
3a94f7918980
patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents:
15020
diff
changeset
|
6836 long col; |
3a94f7918980
patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents:
15020
diff
changeset
|
6837 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6838 col = (long)tv_get_number_chk(argvars, NULL); |
15062
3a94f7918980
patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents:
15020
diff
changeset
|
6839 if (col < 0) |
3a94f7918980
patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents:
15020
diff
changeset
|
6840 return; // type error; errmsg already given |
3a94f7918980
patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents:
15020
diff
changeset
|
6841 #ifdef FEAT_VARTABS |
3a94f7918980
patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents:
15020
diff
changeset
|
6842 rettv->vval.v_number = get_sw_value_col(curbuf, col); |
3a94f7918980
patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents:
15020
diff
changeset
|
6843 return; |
3a94f7918980
patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents:
15020
diff
changeset
|
6844 #endif |
3a94f7918980
patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents:
15020
diff
changeset
|
6845 } |
3a94f7918980
patch 8.1.0542: shiftwidth() does not take 'vartabstop' into account
Bram Moolenaar <Bram@vim.org>
parents:
15020
diff
changeset
|
6846 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6847 rettv->vval.v_number = get_sw_value(curbuf); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6848 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6849 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6850 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6851 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6852 * "sin()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6853 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6854 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6855 f_sin(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6856 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6857 float_T f = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6858 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6859 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6860 if (get_float_arg(argvars, &f) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6861 rettv->vval.v_float = sin(f); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6862 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6863 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6864 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6865 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6866 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6867 * "sinh()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6868 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6869 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6870 f_sinh(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6871 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6872 float_T f = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6873 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6874 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6875 if (get_float_arg(argvars, &f) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6876 rettv->vval.v_float = sinh(f); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6877 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6878 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6879 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6880 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6881 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6882 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6883 * "soundfold({word})" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6884 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6885 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6886 f_soundfold(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6887 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6888 char_u *s; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6889 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6890 rettv->v_type = VAR_STRING; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6891 s = tv_get_string(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6892 #ifdef FEAT_SPELL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6893 rettv->vval.v_string = eval_soundfold(s); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6894 #else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6895 rettv->vval.v_string = vim_strsave(s); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6896 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6897 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6898 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6899 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6900 * "spellbadword()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6901 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6902 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6903 f_spellbadword(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6904 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6905 char_u *word = (char_u *)""; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6906 hlf_T attr = HLF_COUNT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6907 int len = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6908 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6909 if (rettv_list_alloc(rettv) == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6910 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6911 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6912 #ifdef FEAT_SPELL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6913 if (argvars[0].v_type == VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6914 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6915 // Find the start and length of the badly spelled word. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6916 len = spell_move_to(curwin, FORWARD, TRUE, TRUE, &attr); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6917 if (len != 0) |
13088
3dd37eec73f0
patch 8.0.1419: cursor column is not updated after ]s
Christian Brabandt <cb@256bit.org>
parents:
13070
diff
changeset
|
6918 { |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6919 word = ml_get_cursor(); |
13088
3dd37eec73f0
patch 8.0.1419: cursor column is not updated after ]s
Christian Brabandt <cb@256bit.org>
parents:
13070
diff
changeset
|
6920 curwin->w_set_curswant = TRUE; |
3dd37eec73f0
patch 8.0.1419: cursor column is not updated after ]s
Christian Brabandt <cb@256bit.org>
parents:
13070
diff
changeset
|
6921 } |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6922 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6923 else if (curwin->w_p_spell && *curbuf->b_s.b_p_spl != NUL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6924 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6925 char_u *str = tv_get_string_chk(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6926 int capcol = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6927 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6928 if (str != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6929 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
6930 // Check the argument for spelling. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6931 while (*str != NUL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6932 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6933 len = spell_check(curwin, str, &attr, &capcol, FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6934 if (attr != HLF_COUNT) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6935 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6936 word = str; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6937 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6938 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6939 str += len; |
14368
e78ce11f310b
patch 8.1.0199: spellbadword() does not check for caps error
Christian Brabandt <cb@256bit.org>
parents:
14343
diff
changeset
|
6940 capcol -= len; |
17672
d63b44015f4d
patch 8.1.1833: allocating a bit too much when there is no bad word.
Bram Moolenaar <Bram@vim.org>
parents:
17670
diff
changeset
|
6941 len = 0; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6942 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6943 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6944 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6945 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6946 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6947 list_append_string(rettv->vval.v_list, word, len); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6948 list_append_string(rettv->vval.v_list, (char_u *)( |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6949 attr == HLF_SPB ? "bad" : |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6950 attr == HLF_SPR ? "rare" : |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6951 attr == HLF_SPL ? "local" : |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6952 attr == HLF_SPC ? "caps" : |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6953 ""), -1); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6954 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6955 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6956 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6957 * "spellsuggest()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6958 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6959 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6960 f_spellsuggest(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6961 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6962 #ifdef FEAT_SPELL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6963 char_u *str; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6964 int typeerr = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6965 int maxcount; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6966 garray_T ga; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6967 int i; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6968 listitem_T *li; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6969 int need_capital = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6970 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6971 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6972 if (rettv_list_alloc(rettv) == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6973 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6974 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6975 #ifdef FEAT_SPELL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6976 if (curwin->w_p_spell && *curwin->w_s->b_p_spl != NUL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6977 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6978 str = tv_get_string(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6979 if (argvars[1].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6980 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6981 maxcount = (int)tv_get_number_chk(&argvars[1], &typeerr); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6982 if (maxcount <= 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6983 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6984 if (argvars[2].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6985 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
6986 need_capital = (int)tv_get_number_chk(&argvars[2], &typeerr); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6987 if (typeerr) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6988 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6989 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6990 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6991 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6992 maxcount = 25; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6993 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6994 spell_suggest_list(&ga, str, maxcount, need_capital, FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6995 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6996 for (i = 0; i < ga.ga_len; ++i) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6997 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6998 str = ((char_u **)ga.ga_data)[i]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6999 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7000 li = listitem_alloc(); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7001 if (li == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7002 vim_free(str); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7003 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7004 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7005 li->li_tv.v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7006 li->li_tv.v_lock = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7007 li->li_tv.vval.v_string = str; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7008 list_append(rettv->vval.v_list, li); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7009 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7010 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7011 ga_clear(&ga); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7012 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7013 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7014 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7015 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7016 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7017 f_split(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7018 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7019 char_u *str; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7020 char_u *end; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7021 char_u *pat = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7022 regmatch_T regmatch; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7023 char_u patbuf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7024 char_u *save_cpo; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7025 int match; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7026 colnr_T col = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7027 int keepempty = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7028 int typeerr = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7029 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7030 // Make 'cpoptions' empty, the 'l' flag should not be used here. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7031 save_cpo = p_cpo; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7032 p_cpo = (char_u *)""; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7033 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7034 str = tv_get_string(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7035 if (argvars[1].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7036 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7037 pat = tv_get_string_buf_chk(&argvars[1], patbuf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7038 if (pat == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7039 typeerr = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7040 if (argvars[2].v_type != VAR_UNKNOWN) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7041 keepempty = (int)tv_get_number_chk(&argvars[2], &typeerr); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7042 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7043 if (pat == NULL || *pat == NUL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7044 pat = (char_u *)"[\\x01- ]\\+"; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7045 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7046 if (rettv_list_alloc(rettv) == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7047 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7048 if (typeerr) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7049 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7050 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7051 regmatch.regprog = vim_regcomp(pat, RE_MAGIC + RE_STRING); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7052 if (regmatch.regprog != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7053 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7054 regmatch.rm_ic = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7055 while (*str != NUL || keepempty) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7056 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7057 if (*str == NUL) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7058 match = FALSE; // empty item at the end |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7059 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7060 match = vim_regexec_nl(®match, str, col); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7061 if (match) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7062 end = regmatch.startp[0]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7063 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7064 end = str + STRLEN(str); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7065 if (keepempty || end > str || (rettv->vval.v_list->lv_len > 0 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7066 && *str != NUL && match && end < regmatch.endp[0])) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7067 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7068 if (list_append_string(rettv->vval.v_list, str, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7069 (int)(end - str)) == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7070 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7071 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7072 if (!match) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7073 break; |
15595
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15579
diff
changeset
|
7074 // Advance to just after the match. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7075 if (regmatch.endp[0] > str) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7076 col = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7077 else |
15595
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15579
diff
changeset
|
7078 // Don't get stuck at the same match. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7079 col = (*mb_ptr2len)(regmatch.endp[0]); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7080 str = regmatch.endp[0]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7081 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7082 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7083 vim_regfree(regmatch.regprog); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7084 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7085 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7086 p_cpo = save_cpo; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7087 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7088 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7089 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7090 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7091 * "sqrt()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7092 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7093 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7094 f_sqrt(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7095 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7096 float_T f = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7097 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7098 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7099 if (get_float_arg(argvars, &f) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7100 rettv->vval.v_float = sqrt(f); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7101 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7102 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7103 } |
18738
e0cd10f750e7
patch 8.1.2359: cannot build without FEAT_FLOAT
Bram Moolenaar <Bram@vim.org>
parents:
18732
diff
changeset
|
7104 #endif |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7105 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7106 /* |
18701
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
7107 * "srand()" function |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
7108 */ |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
7109 static void |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
7110 f_srand(typval_T *argvars, typval_T *rettv) |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
7111 { |
18703
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7112 static int dev_urandom_state = -1; // FAIL or OK once tried |
18732
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
7113 UINT32_T x = 0, z; |
18703
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7114 |
18701
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
7115 if (rettv_list_alloc(rettv) == FAIL) |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
7116 return; |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
7117 if (argvars[0].v_type == VAR_UNKNOWN) |
18703
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7118 { |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7119 if (dev_urandom_state != FAIL) |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7120 { |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7121 int fd = open("/dev/urandom", O_RDONLY); |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7122 struct { |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7123 union { |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7124 UINT32_T number; |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7125 char bytes[sizeof(UINT32_T)]; |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7126 } cont; |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7127 } buf; |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7128 |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7129 // Attempt reading /dev/urandom. |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7130 if (fd == -1) |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7131 dev_urandom_state = FAIL; |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7132 else |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7133 { |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7134 buf.cont.number = 0; |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7135 if (read(fd, buf.cont.bytes, sizeof(UINT32_T)) |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7136 != sizeof(UINT32_T)) |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7137 dev_urandom_state = FAIL; |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7138 else |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7139 { |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7140 dev_urandom_state = OK; |
18732
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
7141 x = buf.cont.number; |
18703
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7142 } |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7143 close(fd); |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7144 } |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7145 |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7146 } |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7147 if (dev_urandom_state != OK) |
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7148 // Reading /dev/urandom doesn't work, fall back to time(). |
18732
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
7149 x = vim_time(); |
18703
aef98a646d3e
patch 8.1.2343: using time() for srand() is not very random
Bram Moolenaar <Bram@vim.org>
parents:
18701
diff
changeset
|
7150 } |
18701
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
7151 else |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
7152 { |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
7153 int error = FALSE; |
18732
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
7154 |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
7155 x = (UINT32_T)tv_get_number_chk(&argvars[0], &error); |
18701
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
7156 if (error) |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
7157 return; |
18732
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
7158 } |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
7159 |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
7160 #define SPLITMIX32 ( \ |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
7161 z = (x += 0x9e3779b9), \ |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
7162 z = (z ^ (z >> 16)) * 0x85ebca6b, \ |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
7163 z = (z ^ (z >> 13)) * 0xc2b2ae35, \ |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
7164 z ^ (z >> 16) \ |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
7165 ) |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
7166 |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
7167 list_append_number(rettv->vval.v_list, (varnumber_T)SPLITMIX32); |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
7168 list_append_number(rettv->vval.v_list, (varnumber_T)SPLITMIX32); |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
7169 list_append_number(rettv->vval.v_list, (varnumber_T)SPLITMIX32); |
2513e666aa82
patch 8.1.2356: rand() does not use the best algorithm
Bram Moolenaar <Bram@vim.org>
parents:
18703
diff
changeset
|
7170 list_append_number(rettv->vval.v_list, (varnumber_T)SPLITMIX32); |
18701
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
7171 } |
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
7172 |
18738
e0cd10f750e7
patch 8.1.2359: cannot build without FEAT_FLOAT
Bram Moolenaar <Bram@vim.org>
parents:
18732
diff
changeset
|
7173 #ifdef FEAT_FLOAT |
18701
128662297ddf
patch 8.1.2342: random number generator in Vim script is slow
Bram Moolenaar <Bram@vim.org>
parents:
18699
diff
changeset
|
7174 /* |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7175 * "str2float()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7176 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7177 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7178 f_str2float(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7179 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7180 char_u *p = skipwhite(tv_get_string(&argvars[0])); |
10555
fff45421182b
patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents:
10553
diff
changeset
|
7181 int isneg = (*p == '-'); |
fff45421182b
patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents:
10553
diff
changeset
|
7182 |
fff45421182b
patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents:
10553
diff
changeset
|
7183 if (*p == '+' || *p == '-') |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7184 p = skipwhite(p + 1); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7185 (void)string2float(p, &rettv->vval.v_float); |
10555
fff45421182b
patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents:
10553
diff
changeset
|
7186 if (isneg) |
fff45421182b
patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents:
10553
diff
changeset
|
7187 rettv->vval.v_float *= -1; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7188 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7189 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7190 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7191 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7192 /* |
16235
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7193 * "str2list()" function |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7194 */ |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7195 static void |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7196 f_str2list(typval_T *argvars, typval_T *rettv) |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7197 { |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7198 char_u *p; |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7199 int utf8 = FALSE; |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7200 |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7201 if (rettv_list_alloc(rettv) == FAIL) |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7202 return; |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7203 |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7204 if (argvars[1].v_type != VAR_UNKNOWN) |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7205 utf8 = (int)tv_get_number_chk(&argvars[1], NULL); |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7206 |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7207 p = tv_get_string(&argvars[0]); |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7208 |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7209 if (has_mbyte || utf8) |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7210 { |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7211 int (*ptr2len)(char_u *); |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7212 int (*ptr2char)(char_u *); |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7213 |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7214 if (utf8 || enc_utf8) |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7215 { |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7216 ptr2len = utf_ptr2len; |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7217 ptr2char = utf_ptr2char; |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7218 } |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7219 else |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7220 { |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7221 ptr2len = mb_ptr2len; |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7222 ptr2char = mb_ptr2char; |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7223 } |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7224 |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7225 for ( ; *p != NUL; p += (*ptr2len)(p)) |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7226 list_append_number(rettv->vval.v_list, (*ptr2char)(p)); |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7227 } |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7228 else |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7229 for ( ; *p != NUL; ++p) |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7230 list_append_number(rettv->vval.v_list, *p); |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7231 } |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7232 |
219c58b3879c
patch 8.1.1122: char2nr() does not handle composing characters
Bram Moolenaar <Bram@vim.org>
parents:
16231
diff
changeset
|
7233 /* |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7234 * "str2nr()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7235 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7236 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7237 f_str2nr(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7238 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7239 int base = 10; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7240 char_u *p; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7241 varnumber_T n; |
18080
a6d218f99ff7
patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
7242 int what = 0; |
10555
fff45421182b
patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents:
10553
diff
changeset
|
7243 int isneg; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7244 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7245 if (argvars[1].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7246 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7247 base = (int)tv_get_number(&argvars[1]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7248 if (base != 2 && base != 8 && base != 10 && base != 16) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7249 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
7250 emsg(_(e_invarg)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7251 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7252 } |
18080
a6d218f99ff7
patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
7253 if (argvars[2].v_type != VAR_UNKNOWN && tv_get_number(&argvars[2])) |
a6d218f99ff7
patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
7254 what |= STR2NR_QUOTE; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7255 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7256 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7257 p = skipwhite(tv_get_string(&argvars[0])); |
10555
fff45421182b
patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents:
10553
diff
changeset
|
7258 isneg = (*p == '-'); |
fff45421182b
patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents:
10553
diff
changeset
|
7259 if (*p == '+' || *p == '-') |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7260 p = skipwhite(p + 1); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7261 switch (base) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7262 { |
18080
a6d218f99ff7
patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
7263 case 2: what |= STR2NR_BIN + STR2NR_FORCE; break; |
a6d218f99ff7
patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
7264 case 8: what |= STR2NR_OCT + STR2NR_FORCE; break; |
a6d218f99ff7
patch 8.1.2035: recognizing octal numbers is confusing
Bram Moolenaar <Bram@vim.org>
parents:
18049
diff
changeset
|
7265 case 16: what |= STR2NR_HEX + STR2NR_FORCE; break; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7266 } |
16706
77bcb5055fec
patch 8.1.1355: obvious mistakes are accepted as valid expressions
Bram Moolenaar <Bram@vim.org>
parents:
16700
diff
changeset
|
7267 vim_str2nr(p, NULL, NULL, what, &n, NULL, 0, FALSE); |
77bcb5055fec
patch 8.1.1355: obvious mistakes are accepted as valid expressions
Bram Moolenaar <Bram@vim.org>
parents:
16700
diff
changeset
|
7268 // Text after the number is silently ignored. |
10555
fff45421182b
patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents:
10553
diff
changeset
|
7269 if (isneg) |
fff45421182b
patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents:
10553
diff
changeset
|
7270 rettv->vval.v_number = -n; |
fff45421182b
patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents:
10553
diff
changeset
|
7271 else |
fff45421182b
patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents:
10553
diff
changeset
|
7272 rettv->vval.v_number = n; |
fff45421182b
patch 8.0.0167: str2nr()/str2float() fail with negative values
Christian Brabandt <cb@256bit.org>
parents:
10553
diff
changeset
|
7273 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7274 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7275 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7276 #ifdef HAVE_STRFTIME |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7277 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7278 * "strftime({format}[, {time}])" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7279 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7280 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7281 f_strftime(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7282 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7283 char_u result_buf[256]; |
16621
7ad3fc329e08
patch 8.1.1313: warnings for using localtime() and ctime()
Bram Moolenaar <Bram@vim.org>
parents:
16606
diff
changeset
|
7284 struct tm tmval; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7285 struct tm *curtime; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7286 time_t seconds; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7287 char_u *p; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7288 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7289 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7290 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7291 p = tv_get_string(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7292 if (argvars[1].v_type == VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7293 seconds = time(NULL); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7294 else |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7295 seconds = (time_t)tv_get_number(&argvars[1]); |
17135
d03a52e02f1a
patch 8.1.1567: localtime_r() does not respond to $TZ changes
Bram Moolenaar <Bram@vim.org>
parents:
17123
diff
changeset
|
7296 curtime = vim_localtime(&seconds, &tmval); |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7297 // MSVC returns NULL for an invalid value of seconds. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7298 if (curtime == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7299 rettv->vval.v_string = vim_strsave((char_u *)_("(Invalid)")); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7300 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7301 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7302 vimconv_T conv; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7303 char_u *enc; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7304 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7305 conv.vc_type = CONV_NONE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7306 enc = enc_locale(); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7307 convert_setup(&conv, p_enc, enc); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7308 if (conv.vc_type != CONV_NONE) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7309 p = string_convert(&conv, p, NULL); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7310 if (p != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7311 (void)strftime((char *)result_buf, sizeof(result_buf), |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7312 (char *)p, curtime); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7313 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7314 result_buf[0] = NUL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7315 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7316 if (conv.vc_type != CONV_NONE) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7317 vim_free(p); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7318 convert_setup(&conv, enc, p_enc); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7319 if (conv.vc_type != CONV_NONE) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7320 rettv->vval.v_string = string_convert(&conv, result_buf, NULL); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7321 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7322 rettv->vval.v_string = vim_strsave(result_buf); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7323 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7324 // Release conversion descriptors |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7325 convert_setup(&conv, NULL, NULL); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7326 vim_free(enc); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7327 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7328 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7329 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7330 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7331 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7332 * "strgetchar()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7333 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7334 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7335 f_strgetchar(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7336 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7337 char_u *str; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7338 int len; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7339 int error = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7340 int charidx; |
15595
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15579
diff
changeset
|
7341 int byteidx = 0; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7342 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7343 rettv->vval.v_number = -1; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7344 str = tv_get_string_chk(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7345 if (str == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7346 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7347 len = (int)STRLEN(str); |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7348 charidx = (int)tv_get_number_chk(&argvars[1], &error); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7349 if (error) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7350 return; |
15595
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15579
diff
changeset
|
7351 |
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15579
diff
changeset
|
7352 while (charidx >= 0 && byteidx < len) |
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15579
diff
changeset
|
7353 { |
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15579
diff
changeset
|
7354 if (charidx == 0) |
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15579
diff
changeset
|
7355 { |
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15579
diff
changeset
|
7356 rettv->vval.v_number = mb_ptr2char(str + byteidx); |
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15579
diff
changeset
|
7357 break; |
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15579
diff
changeset
|
7358 } |
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15579
diff
changeset
|
7359 --charidx; |
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15579
diff
changeset
|
7360 byteidx += MB_CPTR2LEN(str + byteidx); |
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15579
diff
changeset
|
7361 } |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7362 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7363 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7364 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7365 * "stridx()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7366 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7367 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7368 f_stridx(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7369 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7370 char_u buf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7371 char_u *needle; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7372 char_u *haystack; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7373 char_u *save_haystack; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7374 char_u *pos; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7375 int start_idx; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7376 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7377 needle = tv_get_string_chk(&argvars[1]); |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7378 save_haystack = haystack = tv_get_string_buf_chk(&argvars[0], buf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7379 rettv->vval.v_number = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7380 if (needle == NULL || haystack == NULL) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7381 return; // type error; errmsg already given |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7382 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7383 if (argvars[2].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7384 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7385 int error = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7386 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7387 start_idx = (int)tv_get_number_chk(&argvars[2], &error); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7388 if (error || start_idx >= (int)STRLEN(haystack)) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7389 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7390 if (start_idx >= 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7391 haystack += start_idx; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7392 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7393 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7394 pos = (char_u *)strstr((char *)haystack, (char *)needle); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7395 if (pos != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7396 rettv->vval.v_number = (varnumber_T)(pos - save_haystack); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7397 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7398 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7399 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7400 * "string()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7401 */ |
15219
dada0b389d4f
patch 8.1.0619: :echomsg and :echoerr do not handle List and Dict
Bram Moolenaar <Bram@vim.org>
parents:
15211
diff
changeset
|
7402 void |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7403 f_string(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7404 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7405 char_u *tofree; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7406 char_u numbuf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7407 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7408 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7409 rettv->vval.v_string = tv2string(&argvars[0], &tofree, numbuf, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7410 get_copyID()); |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7411 // Make a copy if we have a value but it's not in allocated memory. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7412 if (rettv->vval.v_string != NULL && tofree == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7413 rettv->vval.v_string = vim_strsave(rettv->vval.v_string); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7414 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7415 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7416 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7417 * "strlen()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7418 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7419 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7420 f_strlen(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7421 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7422 rettv->vval.v_number = (varnumber_T)(STRLEN( |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7423 tv_get_string(&argvars[0]))); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7424 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7425 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7426 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7427 * "strchars()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7428 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7429 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7430 f_strchars(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7431 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7432 char_u *s = tv_get_string(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7433 int skipcc = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7434 varnumber_T len = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7435 int (*func_mb_ptr2char_adv)(char_u **pp); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7436 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7437 if (argvars[1].v_type != VAR_UNKNOWN) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7438 skipcc = (int)tv_get_number_chk(&argvars[1], NULL); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7439 if (skipcc < 0 || skipcc > 1) |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
7440 emsg(_(e_invarg)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7441 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7442 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7443 func_mb_ptr2char_adv = skipcc ? mb_ptr2char_adv : mb_cptr2char_adv; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7444 while (*s != NUL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7445 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7446 func_mb_ptr2char_adv(&s); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7447 ++len; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7448 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7449 rettv->vval.v_number = len; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7450 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7451 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7452 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7453 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7454 * "strdisplaywidth()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7455 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7456 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7457 f_strdisplaywidth(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7458 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7459 char_u *s = tv_get_string(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7460 int col = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7461 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7462 if (argvars[1].v_type != VAR_UNKNOWN) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7463 col = (int)tv_get_number(&argvars[1]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7464 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7465 rettv->vval.v_number = (varnumber_T)(linetabsize_col(col, s) - col); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7466 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7467 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7468 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7469 * "strwidth()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7470 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7471 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7472 f_strwidth(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7473 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7474 char_u *s = tv_get_string(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7475 |
15595
1ec942f1b648
patch 8.1.0805: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15579
diff
changeset
|
7476 rettv->vval.v_number = (varnumber_T)(mb_string2cells(s, -1)); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7477 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7478 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7479 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7480 * "strcharpart()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7481 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7482 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7483 f_strcharpart(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7484 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7485 char_u *p; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7486 int nchar; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7487 int nbyte = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7488 int charlen; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7489 int len = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7490 int slen; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7491 int error = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7492 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7493 p = tv_get_string(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7494 slen = (int)STRLEN(p); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7495 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7496 nchar = (int)tv_get_number_chk(&argvars[1], &error); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7497 if (!error) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7498 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7499 if (nchar > 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7500 while (nchar > 0 && nbyte < slen) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7501 { |
9898
bff8a09016a5
commit https://github.com/vim/vim/commit/d3c907b5d2b352482b580a0cf687cbbea4c19ea1
Christian Brabandt <cb@256bit.org>
parents:
9881
diff
changeset
|
7502 nbyte += MB_CPTR2LEN(p + nbyte); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7503 --nchar; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7504 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7505 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7506 nbyte = nchar; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7507 if (argvars[2].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7508 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7509 charlen = (int)tv_get_number(&argvars[2]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7510 while (charlen > 0 && nbyte + len < slen) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7511 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7512 int off = nbyte + len; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7513 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7514 if (off < 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7515 len += 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7516 else |
9898
bff8a09016a5
commit https://github.com/vim/vim/commit/d3c907b5d2b352482b580a0cf687cbbea4c19ea1
Christian Brabandt <cb@256bit.org>
parents:
9881
diff
changeset
|
7517 len += MB_CPTR2LEN(p + off); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7518 --charlen; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7519 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7520 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7521 else |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7522 len = slen - nbyte; // default: all bytes that are available. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7523 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7524 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7525 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7526 * Only return the overlap between the specified part and the actual |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7527 * string. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7528 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7529 if (nbyte < 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7530 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7531 len += nbyte; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7532 nbyte = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7533 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7534 else if (nbyte > slen) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7535 nbyte = slen; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7536 if (len < 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7537 len = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7538 else if (nbyte + len > slen) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7539 len = slen - nbyte; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7540 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7541 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7542 rettv->vval.v_string = vim_strnsave(p + nbyte, len); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7543 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7544 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7545 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7546 * "strpart()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7547 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7548 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7549 f_strpart(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7550 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7551 char_u *p; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7552 int n; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7553 int len; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7554 int slen; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7555 int error = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7556 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7557 p = tv_get_string(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7558 slen = (int)STRLEN(p); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7559 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7560 n = (int)tv_get_number_chk(&argvars[1], &error); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7561 if (error) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7562 len = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7563 else if (argvars[2].v_type != VAR_UNKNOWN) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7564 len = (int)tv_get_number(&argvars[2]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7565 else |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7566 len = slen - n; // default len: all bytes that are available. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7567 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7568 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7569 * Only return the overlap between the specified part and the actual |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7570 * string. |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7571 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7572 if (n < 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7573 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7574 len += n; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7575 n = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7576 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7577 else if (n > slen) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7578 n = slen; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7579 if (len < 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7580 len = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7581 else if (n + len > slen) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7582 len = slen - n; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7583 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7584 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7585 rettv->vval.v_string = vim_strnsave(p + n, len); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7586 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7587 |
18669
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7588 #ifdef HAVE_STRPTIME |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7589 /* |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7590 * "strptime({format}, {timestring})" function |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7591 */ |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7592 static void |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7593 f_strptime(typval_T *argvars, typval_T *rettv) |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7594 { |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7595 struct tm tmval; |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7596 char_u *fmt; |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7597 char_u *str; |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7598 vimconv_T conv; |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7599 char_u *enc; |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7600 |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7601 vim_memset(&tmval, NUL, sizeof(tmval)); |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7602 fmt = tv_get_string(&argvars[0]); |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7603 str = tv_get_string(&argvars[1]); |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7604 |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7605 conv.vc_type = CONV_NONE; |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7606 enc = enc_locale(); |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7607 convert_setup(&conv, p_enc, enc); |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7608 if (conv.vc_type != CONV_NONE) |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7609 fmt = string_convert(&conv, fmt, NULL); |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7610 if (fmt == NULL |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7611 || strptime((char *)str, (char *)fmt, &tmval) == NULL |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7612 || (rettv->vval.v_number = mktime(&tmval)) == -1) |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7613 rettv->vval.v_number = 0; |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7614 |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7615 if (conv.vc_type != CONV_NONE) |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7616 vim_free(fmt); |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7617 convert_setup(&conv, NULL, NULL); |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7618 vim_free(enc); |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7619 } |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7620 #endif |
9007e9896303
patch 8.1.2326: cannot parse a date/time string
Bram Moolenaar <Bram@vim.org>
parents:
18623
diff
changeset
|
7621 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7622 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7623 * "strridx()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7624 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7625 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7626 f_strridx(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7627 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7628 char_u buf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7629 char_u *needle; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7630 char_u *haystack; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7631 char_u *rest; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7632 char_u *lastmatch = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7633 int haystack_len, end_idx; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7634 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7635 needle = tv_get_string_chk(&argvars[1]); |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7636 haystack = tv_get_string_buf_chk(&argvars[0], buf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7637 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7638 rettv->vval.v_number = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7639 if (needle == NULL || haystack == NULL) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7640 return; // type error; errmsg already given |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7641 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7642 haystack_len = (int)STRLEN(haystack); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7643 if (argvars[2].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7644 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7645 // Third argument: upper limit for index |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7646 end_idx = (int)tv_get_number_chk(&argvars[2], NULL); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7647 if (end_idx < 0) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7648 return; // can never find a match |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7649 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7650 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7651 end_idx = haystack_len; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7652 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7653 if (*needle == NUL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7654 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7655 // Empty string matches past the end. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7656 lastmatch = haystack + end_idx; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7657 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7658 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7659 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7660 for (rest = haystack; *rest != '\0'; ++rest) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7661 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7662 rest = (char_u *)strstr((char *)rest, (char *)needle); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7663 if (rest == NULL || rest > haystack + end_idx) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7664 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7665 lastmatch = rest; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7666 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7667 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7668 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7669 if (lastmatch == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7670 rettv->vval.v_number = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7671 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7672 rettv->vval.v_number = (varnumber_T)(lastmatch - haystack); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7673 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7674 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7675 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7676 * "strtrans()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7677 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7678 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7679 f_strtrans(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7680 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7681 rettv->v_type = VAR_STRING; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7682 rettv->vval.v_string = transstr(tv_get_string(&argvars[0])); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7683 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7684 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7685 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7686 * "submatch()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7687 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7688 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7689 f_submatch(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7690 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7691 int error = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7692 int no; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7693 int retList = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7694 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7695 no = (int)tv_get_number_chk(&argvars[0], &error); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7696 if (error) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7697 return; |
9923
935e13935848
commit https://github.com/vim/vim/commit/989f592f7ffcbafdc4ec35cee4dc65bd053e2077
Christian Brabandt <cb@256bit.org>
parents:
9919
diff
changeset
|
7698 if (no < 0 || no >= NSUBEXP) |
935e13935848
commit https://github.com/vim/vim/commit/989f592f7ffcbafdc4ec35cee4dc65bd053e2077
Christian Brabandt <cb@256bit.org>
parents:
9919
diff
changeset
|
7699 { |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
7700 semsg(_("E935: invalid submatch number: %d"), no); |
10889
5780bd3a5a7e
patch 8.0.0334: can't access b:changedtick from a dict reference
Christian Brabandt <cb@256bit.org>
parents:
10787
diff
changeset
|
7701 return; |
9923
935e13935848
commit https://github.com/vim/vim/commit/989f592f7ffcbafdc4ec35cee4dc65bd053e2077
Christian Brabandt <cb@256bit.org>
parents:
9919
diff
changeset
|
7702 } |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7703 if (argvars[1].v_type != VAR_UNKNOWN) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7704 retList = (int)tv_get_number_chk(&argvars[1], &error); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7705 if (error) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7706 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7707 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7708 if (retList == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7709 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7710 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7711 rettv->vval.v_string = reg_submatch(no); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7712 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7713 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7714 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7715 rettv->v_type = VAR_LIST; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7716 rettv->vval.v_list = reg_submatch_list(no); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7717 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7718 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7719 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7720 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7721 * "substitute()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7722 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7723 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7724 f_substitute(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7725 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7726 char_u patbuf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7727 char_u subbuf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7728 char_u flagsbuf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7729 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7730 char_u *str = tv_get_string_chk(&argvars[0]); |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7731 char_u *pat = tv_get_string_buf_chk(&argvars[1], patbuf); |
9589
bf204ab1ce7d
commit https://github.com/vim/vim/commit/72ab729c3dcdea0fba44d8e676602c847e841bcd
Christian Brabandt <cb@256bit.org>
parents:
9587
diff
changeset
|
7732 char_u *sub = NULL; |
bf204ab1ce7d
commit https://github.com/vim/vim/commit/72ab729c3dcdea0fba44d8e676602c847e841bcd
Christian Brabandt <cb@256bit.org>
parents:
9587
diff
changeset
|
7733 typval_T *expr = NULL; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7734 char_u *flg = tv_get_string_buf_chk(&argvars[3], flagsbuf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7735 |
9589
bf204ab1ce7d
commit https://github.com/vim/vim/commit/72ab729c3dcdea0fba44d8e676602c847e841bcd
Christian Brabandt <cb@256bit.org>
parents:
9587
diff
changeset
|
7736 if (argvars[2].v_type == VAR_FUNC || argvars[2].v_type == VAR_PARTIAL) |
bf204ab1ce7d
commit https://github.com/vim/vim/commit/72ab729c3dcdea0fba44d8e676602c847e841bcd
Christian Brabandt <cb@256bit.org>
parents:
9587
diff
changeset
|
7737 expr = &argvars[2]; |
bf204ab1ce7d
commit https://github.com/vim/vim/commit/72ab729c3dcdea0fba44d8e676602c847e841bcd
Christian Brabandt <cb@256bit.org>
parents:
9587
diff
changeset
|
7738 else |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7739 sub = tv_get_string_buf_chk(&argvars[2], subbuf); |
9589
bf204ab1ce7d
commit https://github.com/vim/vim/commit/72ab729c3dcdea0fba44d8e676602c847e841bcd
Christian Brabandt <cb@256bit.org>
parents:
9587
diff
changeset
|
7740 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7741 rettv->v_type = VAR_STRING; |
9589
bf204ab1ce7d
commit https://github.com/vim/vim/commit/72ab729c3dcdea0fba44d8e676602c847e841bcd
Christian Brabandt <cb@256bit.org>
parents:
9587
diff
changeset
|
7742 if (str == NULL || pat == NULL || (sub == NULL && expr == NULL) |
bf204ab1ce7d
commit https://github.com/vim/vim/commit/72ab729c3dcdea0fba44d8e676602c847e841bcd
Christian Brabandt <cb@256bit.org>
parents:
9587
diff
changeset
|
7743 || flg == NULL) |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7744 rettv->vval.v_string = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7745 else |
9589
bf204ab1ce7d
commit https://github.com/vim/vim/commit/72ab729c3dcdea0fba44d8e676602c847e841bcd
Christian Brabandt <cb@256bit.org>
parents:
9587
diff
changeset
|
7746 rettv->vval.v_string = do_string_sub(str, pat, sub, expr, flg); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7747 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7748 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7749 /* |
14599
72d6f6f7ead7
patch 8.1.0313: information about a swap file is unavailable
Christian Brabandt <cb@256bit.org>
parents:
14587
diff
changeset
|
7750 * "swapinfo(swap_filename)" function |
72d6f6f7ead7
patch 8.1.0313: information about a swap file is unavailable
Christian Brabandt <cb@256bit.org>
parents:
14587
diff
changeset
|
7751 */ |
72d6f6f7ead7
patch 8.1.0313: information about a swap file is unavailable
Christian Brabandt <cb@256bit.org>
parents:
14587
diff
changeset
|
7752 static void |
72d6f6f7ead7
patch 8.1.0313: information about a swap file is unavailable
Christian Brabandt <cb@256bit.org>
parents:
14587
diff
changeset
|
7753 f_swapinfo(typval_T *argvars, typval_T *rettv) |
72d6f6f7ead7
patch 8.1.0313: information about a swap file is unavailable
Christian Brabandt <cb@256bit.org>
parents:
14587
diff
changeset
|
7754 { |
72d6f6f7ead7
patch 8.1.0313: information about a swap file is unavailable
Christian Brabandt <cb@256bit.org>
parents:
14587
diff
changeset
|
7755 if (rettv_dict_alloc(rettv) == OK) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7756 get_b0_dict(tv_get_string(argvars), rettv->vval.v_dict); |
14599
72d6f6f7ead7
patch 8.1.0313: information about a swap file is unavailable
Christian Brabandt <cb@256bit.org>
parents:
14587
diff
changeset
|
7757 } |
72d6f6f7ead7
patch 8.1.0313: information about a swap file is unavailable
Christian Brabandt <cb@256bit.org>
parents:
14587
diff
changeset
|
7758 |
72d6f6f7ead7
patch 8.1.0313: information about a swap file is unavailable
Christian Brabandt <cb@256bit.org>
parents:
14587
diff
changeset
|
7759 /* |
14778
20653d6f3d95
patch 8.1.0401: can't get swap name of another buffer
Christian Brabandt <cb@256bit.org>
parents:
14756
diff
changeset
|
7760 * "swapname(expr)" function |
20653d6f3d95
patch 8.1.0401: can't get swap name of another buffer
Christian Brabandt <cb@256bit.org>
parents:
14756
diff
changeset
|
7761 */ |
20653d6f3d95
patch 8.1.0401: can't get swap name of another buffer
Christian Brabandt <cb@256bit.org>
parents:
14756
diff
changeset
|
7762 static void |
20653d6f3d95
patch 8.1.0401: can't get swap name of another buffer
Christian Brabandt <cb@256bit.org>
parents:
14756
diff
changeset
|
7763 f_swapname(typval_T *argvars, typval_T *rettv) |
20653d6f3d95
patch 8.1.0401: can't get swap name of another buffer
Christian Brabandt <cb@256bit.org>
parents:
14756
diff
changeset
|
7764 { |
20653d6f3d95
patch 8.1.0401: can't get swap name of another buffer
Christian Brabandt <cb@256bit.org>
parents:
14756
diff
changeset
|
7765 buf_T *buf; |
20653d6f3d95
patch 8.1.0401: can't get swap name of another buffer
Christian Brabandt <cb@256bit.org>
parents:
14756
diff
changeset
|
7766 |
20653d6f3d95
patch 8.1.0401: can't get swap name of another buffer
Christian Brabandt <cb@256bit.org>
parents:
14756
diff
changeset
|
7767 rettv->v_type = VAR_STRING; |
15355
73b153ed5af8
patch 8.1.0685: get_buf_tv() is named inconsistently
Bram Moolenaar <Bram@vim.org>
parents:
15343
diff
changeset
|
7768 buf = tv_get_buf(&argvars[0], FALSE); |
14778
20653d6f3d95
patch 8.1.0401: can't get swap name of another buffer
Christian Brabandt <cb@256bit.org>
parents:
14756
diff
changeset
|
7769 if (buf == NULL || buf->b_ml.ml_mfp == NULL |
20653d6f3d95
patch 8.1.0401: can't get swap name of another buffer
Christian Brabandt <cb@256bit.org>
parents:
14756
diff
changeset
|
7770 || buf->b_ml.ml_mfp->mf_fname == NULL) |
20653d6f3d95
patch 8.1.0401: can't get swap name of another buffer
Christian Brabandt <cb@256bit.org>
parents:
14756
diff
changeset
|
7771 rettv->vval.v_string = NULL; |
20653d6f3d95
patch 8.1.0401: can't get swap name of another buffer
Christian Brabandt <cb@256bit.org>
parents:
14756
diff
changeset
|
7772 else |
20653d6f3d95
patch 8.1.0401: can't get swap name of another buffer
Christian Brabandt <cb@256bit.org>
parents:
14756
diff
changeset
|
7773 rettv->vval.v_string = vim_strsave(buf->b_ml.ml_mfp->mf_fname); |
20653d6f3d95
patch 8.1.0401: can't get swap name of another buffer
Christian Brabandt <cb@256bit.org>
parents:
14756
diff
changeset
|
7774 } |
20653d6f3d95
patch 8.1.0401: can't get swap name of another buffer
Christian Brabandt <cb@256bit.org>
parents:
14756
diff
changeset
|
7775 |
20653d6f3d95
patch 8.1.0401: can't get swap name of another buffer
Christian Brabandt <cb@256bit.org>
parents:
14756
diff
changeset
|
7776 /* |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7777 * "synID(lnum, col, trans)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7778 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7779 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7780 f_synID(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7781 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7782 int id = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7783 #ifdef FEAT_SYN_HL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7784 linenr_T lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7785 colnr_T col; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7786 int trans; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7787 int transerr = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7788 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7789 lnum = tv_get_lnum(argvars); // -1 on type error |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7790 col = (linenr_T)tv_get_number(&argvars[1]) - 1; // -1 on type error |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7791 trans = (int)tv_get_number_chk(&argvars[2], &transerr); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7792 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7793 if (!transerr && lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7794 && col >= 0 && col < (long)STRLEN(ml_get(lnum))) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7795 id = syn_get_id(curwin, lnum, (colnr_T)col, trans, NULL, FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7796 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7797 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7798 rettv->vval.v_number = id; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7799 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7800 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7801 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7802 * "synIDattr(id, what [, mode])" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7803 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7804 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7805 f_synIDattr(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7806 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7807 char_u *p = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7808 #ifdef FEAT_SYN_HL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7809 int id; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7810 char_u *what; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7811 char_u *mode; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7812 char_u modebuf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7813 int modec; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7814 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7815 id = (int)tv_get_number(&argvars[0]); |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7816 what = tv_get_string(&argvars[1]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7817 if (argvars[2].v_type != VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7818 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7819 mode = tv_get_string_buf(&argvars[2], modebuf); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7820 modec = TOLOWER_ASC(mode[0]); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7821 if (modec != 't' && modec != 'c' && modec != 'g') |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7822 modec = 0; // replace invalid with current |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7823 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7824 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7825 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7826 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7827 if (USE_24BIT) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7828 modec = 'g'; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7829 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7830 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7831 if (t_colors > 1) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7832 modec = 'c'; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7833 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7834 modec = 't'; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7835 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7836 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7837 switch (TOLOWER_ASC(what[0])) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7838 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7839 case 'b': |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7840 if (TOLOWER_ASC(what[1]) == 'g') // bg[#] |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7841 p = highlight_color(id, what, modec); |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7842 else // bold |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7843 p = highlight_has_attr(id, HL_BOLD, modec); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7844 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7845 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7846 case 'f': // fg[#] or font |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7847 p = highlight_color(id, what, modec); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7848 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7849 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7850 case 'i': |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7851 if (TOLOWER_ASC(what[1]) == 'n') // inverse |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7852 p = highlight_has_attr(id, HL_INVERSE, modec); |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7853 else // italic |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7854 p = highlight_has_attr(id, HL_ITALIC, modec); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7855 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7856 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7857 case 'n': // name |
11254
918942a3b0ef
patch 8.0.0513: getting name of cleared highlight group is wrong
Christian Brabandt <cb@256bit.org>
parents:
11225
diff
changeset
|
7858 p = get_highlight_name_ext(NULL, id - 1, FALSE); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7859 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7860 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7861 case 'r': // reverse |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7862 p = highlight_has_attr(id, HL_INVERSE, modec); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7863 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7864 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7865 case 's': |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7866 if (TOLOWER_ASC(what[1]) == 'p') // sp[#] |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7867 p = highlight_color(id, what, modec); |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7868 // strikeout |
12317
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
7869 else if (TOLOWER_ASC(what[1]) == 't' && |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
7870 TOLOWER_ASC(what[2]) == 'r') |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12252
diff
changeset
|
7871 p = highlight_has_attr(id, HL_STRIKETHROUGH, modec); |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7872 else // standout |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7873 p = highlight_has_attr(id, HL_STANDOUT, modec); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7874 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7875 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7876 case 'u': |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7877 if (STRLEN(what) <= 5 || TOLOWER_ASC(what[5]) != 'c') |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7878 // underline |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7879 p = highlight_has_attr(id, HL_UNDERLINE, modec); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7880 else |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7881 // undercurl |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7882 p = highlight_has_attr(id, HL_UNDERCURL, modec); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7883 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7884 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7885 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7886 if (p != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7887 p = vim_strsave(p); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7888 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7889 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7890 rettv->vval.v_string = p; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7891 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7892 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7893 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7894 * "synIDtrans(id)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7895 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7896 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7897 f_synIDtrans(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7898 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7899 int id; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7900 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7901 #ifdef FEAT_SYN_HL |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
7902 id = (int)tv_get_number(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7903 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7904 if (id > 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7905 id = syn_get_final_id(id); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7906 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7907 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7908 id = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7909 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7910 rettv->vval.v_number = id; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7911 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7912 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7913 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7914 * "synconcealed(lnum, col)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7915 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7916 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7917 f_synconcealed(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7918 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7919 #if defined(FEAT_SYN_HL) && defined(FEAT_CONCEAL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7920 linenr_T lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7921 colnr_T col; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7922 int syntax_flags = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7923 int cchar; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7924 int matchid = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7925 char_u str[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7926 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7927 |
11418
162bcd0debd7
patch 8.0.0593: duplication of code for adding a list or dict return value
Christian Brabandt <cb@256bit.org>
parents:
11341
diff
changeset
|
7928 rettv_list_set(rettv, NULL); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7929 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7930 #if defined(FEAT_SYN_HL) && defined(FEAT_CONCEAL) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7931 lnum = tv_get_lnum(argvars); // -1 on type error |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7932 col = (colnr_T)tv_get_number(&argvars[1]) - 1; // -1 on type error |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7933 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7934 vim_memset(str, NUL, sizeof(str)); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7935 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7936 if (rettv_list_alloc(rettv) != FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7937 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7938 if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7939 && col >= 0 && col <= (long)STRLEN(ml_get(lnum)) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7940 && curwin->w_p_cole > 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7941 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7942 (void)syn_get_id(curwin, lnum, col, FALSE, NULL, FALSE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7943 syntax_flags = get_syntax_info(&matchid); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7944 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7945 // get the conceal character |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7946 if ((syntax_flags & HL_CONCEAL) && curwin->w_p_cole < 3) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7947 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7948 cchar = syn_get_sub_char(); |
11553
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
7949 if (cchar == NUL && curwin->w_p_cole == 1) |
cbceef33af7a
patch 8.0.0659: no test for conceal mode
Christian Brabandt <cb@256bit.org>
parents:
11521
diff
changeset
|
7950 cchar = (lcs_conceal == NUL) ? ' ' : lcs_conceal; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7951 if (cchar != NUL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7952 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7953 if (has_mbyte) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7954 (*mb_char2bytes)(cchar, str); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7955 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7956 str[0] = cchar; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7957 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7958 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7959 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7960 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7961 list_append_number(rettv->vval.v_list, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7962 (syntax_flags & HL_CONCEAL) != 0); |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7963 // -1 to auto-determine strlen |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7964 list_append_string(rettv->vval.v_list, str, -1); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7965 list_append_number(rettv->vval.v_list, matchid); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7966 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7967 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7968 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7969 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7970 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7971 * "synstack(lnum, col)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7972 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7973 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7974 f_synstack(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7975 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7976 #ifdef FEAT_SYN_HL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7977 linenr_T lnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7978 colnr_T col; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7979 int i; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7980 int id; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7981 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7982 |
11418
162bcd0debd7
patch 8.0.0593: duplication of code for adding a list or dict return value
Christian Brabandt <cb@256bit.org>
parents:
11341
diff
changeset
|
7983 rettv_list_set(rettv, NULL); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7984 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7985 #ifdef FEAT_SYN_HL |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7986 lnum = tv_get_lnum(argvars); // -1 on type error |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
7987 col = (colnr_T)tv_get_number(&argvars[1]) - 1; // -1 on type error |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7988 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7989 if (lnum >= 1 && lnum <= curbuf->b_ml.ml_line_count |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7990 && col >= 0 && col <= (long)STRLEN(ml_get(lnum)) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7991 && rettv_list_alloc(rettv) != FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7992 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7993 (void)syn_get_id(curwin, lnum, (colnr_T)col, FALSE, NULL, TRUE); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7994 for (i = 0; ; ++i) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7995 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7996 id = syn_get_stack_item(i); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7997 if (id < 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7998 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7999 if (list_append_number(rettv->vval.v_list, id) == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8000 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8001 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8002 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8003 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8004 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8005 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8006 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8007 * "tabpagebuflist()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8008 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8009 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8010 f_tabpagebuflist(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8011 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8012 tabpage_T *tp; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8013 win_T *wp = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8014 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8015 if (argvars[0].v_type == VAR_UNKNOWN) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8016 wp = firstwin; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8017 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8018 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
8019 tp = find_tabpage((int)tv_get_number(&argvars[0])); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8020 if (tp != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8021 wp = (tp == curtab) ? firstwin : tp->tp_firstwin; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8022 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8023 if (wp != NULL && rettv_list_alloc(rettv) != FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8024 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8025 for (; wp != NULL; wp = wp->w_next) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8026 if (list_append_number(rettv->vval.v_list, |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8027 wp->w_buffer->b_fnum) == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8028 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8029 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8030 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8031 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8032 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8033 * "tagfiles()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8034 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8035 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8036 f_tagfiles(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8037 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8038 char_u *fname; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8039 tagname_T tn; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8040 int first; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8041 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8042 if (rettv_list_alloc(rettv) == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8043 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8044 fname = alloc(MAXPATHL); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8045 if (fname == NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8046 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8047 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8048 for (first = TRUE; ; first = FALSE) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8049 if (get_tagfname(&tn, first, fname) == FAIL |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8050 || list_append_string(rettv->vval.v_list, fname, -1) == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8051 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8052 tagname_free(&tn); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8053 vim_free(fname); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8054 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8055 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8056 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8057 * "taglist()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8058 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8059 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8060 f_taglist(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8061 { |
11225
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
11215
diff
changeset
|
8062 char_u *fname = NULL; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8063 char_u *tag_pattern; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8064 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
8065 tag_pattern = tv_get_string(&argvars[0]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8066 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8067 rettv->vval.v_number = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8068 if (*tag_pattern == NUL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8069 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8070 |
11225
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
11215
diff
changeset
|
8071 if (argvars[1].v_type != VAR_UNKNOWN) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
8072 fname = tv_get_string(&argvars[1]); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8073 if (rettv_list_alloc(rettv) == OK) |
11225
d3415ec1cdaf
patch 8.0.0499: taglist() does not prioritize tags for a buffer
Christian Brabandt <cb@256bit.org>
parents:
11215
diff
changeset
|
8074 (void)get_tags(rettv->vval.v_list, tag_pattern, fname); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8075 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8076 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8077 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8078 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8079 * "tan()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8080 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8081 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8082 f_tan(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8083 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8084 float_T f = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8085 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8086 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8087 if (get_float_arg(argvars, &f) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8088 rettv->vval.v_float = tan(f); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8089 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8090 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8091 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8092 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8093 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8094 * "tanh()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8095 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8096 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8097 f_tanh(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8098 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8099 float_T f = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8100 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8101 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8102 if (get_float_arg(argvars, &f) == OK) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8103 rettv->vval.v_float = tanh(f); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8104 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8105 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8106 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8107 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8108 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8109 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8110 * "tolower(string)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8111 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8112 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8113 f_tolower(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8114 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8115 rettv->v_type = VAR_STRING; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
8116 rettv->vval.v_string = strlow_save(tv_get_string(&argvars[0])); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8117 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8118 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8119 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8120 * "toupper(string)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8121 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8122 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8123 f_toupper(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8124 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8125 rettv->v_type = VAR_STRING; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
8126 rettv->vval.v_string = strup_save(tv_get_string(&argvars[0])); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8127 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8128 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8129 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8130 * "tr(string, fromstr, tostr)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8131 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8132 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8133 f_tr(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8134 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8135 char_u *in_str; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8136 char_u *fromstr; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8137 char_u *tostr; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8138 char_u *p; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8139 int inlen; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8140 int fromlen; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8141 int tolen; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8142 int idx; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8143 char_u *cpstr; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8144 int cplen; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8145 int first = TRUE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8146 char_u buf[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8147 char_u buf2[NUMBUFLEN]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8148 garray_T ga; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8149 |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
8150 in_str = tv_get_string(&argvars[0]); |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
8151 fromstr = tv_get_string_buf_chk(&argvars[1], buf); |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
8152 tostr = tv_get_string_buf_chk(&argvars[2], buf2); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8153 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8154 // Default return value: empty string. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8155 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8156 rettv->vval.v_string = NULL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8157 if (fromstr == NULL || tostr == NULL) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8158 return; // type error; errmsg already given |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8159 ga_init2(&ga, (int)sizeof(char), 80); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8160 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8161 if (!has_mbyte) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8162 // not multi-byte: fromstr and tostr must be the same length |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8163 if (STRLEN(fromstr) != STRLEN(tostr)) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8164 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8165 error: |
15470
55ccc2d353bd
patch 8.1.0743: giving error messages is not flexible
Bram Moolenaar <Bram@vim.org>
parents:
15468
diff
changeset
|
8166 semsg(_(e_invarg2), fromstr); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8167 ga_clear(&ga); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8168 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8169 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8170 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8171 // fromstr and tostr have to contain the same number of chars |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8172 while (*in_str != NUL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8173 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8174 if (has_mbyte) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8175 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8176 inlen = (*mb_ptr2len)(in_str); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8177 cpstr = in_str; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8178 cplen = inlen; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8179 idx = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8180 for (p = fromstr; *p != NUL; p += fromlen) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8181 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8182 fromlen = (*mb_ptr2len)(p); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8183 if (fromlen == inlen && STRNCMP(in_str, p, inlen) == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8184 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8185 for (p = tostr; *p != NUL; p += tolen) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8186 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8187 tolen = (*mb_ptr2len)(p); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8188 if (idx-- == 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8189 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8190 cplen = tolen; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8191 cpstr = p; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8192 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8193 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8194 } |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8195 if (*p == NUL) // tostr is shorter than fromstr |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8196 goto error; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8197 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8198 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8199 ++idx; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8200 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8201 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8202 if (first && cpstr == in_str) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8203 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8204 // Check that fromstr and tostr have the same number of |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8205 // (multi-byte) characters. Done only once when a character |
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8206 // of in_str doesn't appear in fromstr. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8207 first = FALSE; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8208 for (p = tostr; *p != NUL; p += tolen) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8209 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8210 tolen = (*mb_ptr2len)(p); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8211 --idx; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8212 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8213 if (idx != 0) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8214 goto error; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8215 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8216 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8217 (void)ga_grow(&ga, cplen); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8218 mch_memmove((char *)ga.ga_data + ga.ga_len, cpstr, (size_t)cplen); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8219 ga.ga_len += cplen; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8220 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8221 in_str += inlen; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8222 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8223 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8224 { |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8225 // When not using multi-byte chars we can do it faster. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8226 p = vim_strchr(fromstr, *in_str); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8227 if (p != NULL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8228 ga_append(&ga, tostr[p - fromstr]); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8229 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8230 ga_append(&ga, *in_str); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8231 ++in_str; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8232 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8233 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8234 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8235 // add a terminating NUL |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8236 (void)ga_grow(&ga, 1); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8237 ga_append(&ga, NUL); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8238 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8239 rettv->vval.v_string = ga.ga_data; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8240 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8241 |
13513
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8242 /* |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8243 * "trim({expr})" function |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8244 */ |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8245 static void |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8246 f_trim(typval_T *argvars, typval_T *rettv) |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8247 { |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8248 char_u buf1[NUMBUFLEN]; |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8249 char_u buf2[NUMBUFLEN]; |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
8250 char_u *head = tv_get_string_buf_chk(&argvars[0], buf1); |
13513
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8251 char_u *mask = NULL; |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8252 char_u *tail; |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8253 char_u *prev; |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8254 char_u *p; |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8255 int c1; |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8256 |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8257 rettv->v_type = VAR_STRING; |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8258 if (head == NULL) |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8259 { |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8260 rettv->vval.v_string = NULL; |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8261 return; |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8262 } |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8263 |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8264 if (argvars[1].v_type == VAR_STRING) |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
8265 mask = tv_get_string_buf_chk(&argvars[1], buf2); |
13513
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8266 |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8267 while (*head != NUL) |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8268 { |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8269 c1 = PTR2CHAR(head); |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8270 if (mask == NULL) |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8271 { |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8272 if (c1 > ' ' && c1 != 0xa0) |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8273 break; |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8274 } |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8275 else |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8276 { |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8277 for (p = mask; *p != NUL; MB_PTR_ADV(p)) |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8278 if (c1 == PTR2CHAR(p)) |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8279 break; |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8280 if (*p == NUL) |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8281 break; |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8282 } |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8283 MB_PTR_ADV(head); |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8284 } |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8285 |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8286 for (tail = head + STRLEN(head); tail > head; tail = prev) |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8287 { |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8288 prev = tail; |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8289 MB_PTR_BACK(head, prev); |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8290 c1 = PTR2CHAR(prev); |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8291 if (mask == NULL) |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8292 { |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8293 if (c1 > ' ' && c1 != 0xa0) |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8294 break; |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8295 } |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8296 else |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8297 { |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8298 for (p = mask; *p != NUL; MB_PTR_ADV(p)) |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8299 if (c1 == PTR2CHAR(p)) |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8300 break; |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8301 if (*p == NUL) |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8302 break; |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8303 } |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8304 } |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8305 rettv->vval.v_string = vim_strnsave(head, (int)(tail - head)); |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8306 } |
4064f342bea4
patch 8.0.1630: trimming white space is not that easy
Christian Brabandt <cb@256bit.org>
parents:
13470
diff
changeset
|
8307 |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8308 #ifdef FEAT_FLOAT |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8309 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8310 * "trunc({float})" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8311 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8312 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8313 f_trunc(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8314 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8315 float_T f = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8316 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8317 rettv->v_type = VAR_FLOAT; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8318 if (get_float_arg(argvars, &f) == OK) |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8319 // trunc() is not in C90, use floor() or ceil() instead. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8320 rettv->vval.v_float = f > 0 ? floor(f) : ceil(f); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8321 else |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8322 rettv->vval.v_float = 0.0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8323 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8324 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8325 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8326 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8327 * "type(expr)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8328 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8329 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8330 f_type(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8331 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8332 int n = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8333 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8334 switch (argvars[0].v_type) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8335 { |
9587
05a56bbe34a1
commit https://github.com/vim/vim/commit/f562e72df726c6191fa305e1c0a113f1cfb87f76
Christian Brabandt <cb@256bit.org>
parents:
9575
diff
changeset
|
8336 case VAR_NUMBER: n = VAR_TYPE_NUMBER; break; |
05a56bbe34a1
commit https://github.com/vim/vim/commit/f562e72df726c6191fa305e1c0a113f1cfb87f76
Christian Brabandt <cb@256bit.org>
parents:
9575
diff
changeset
|
8337 case VAR_STRING: n = VAR_TYPE_STRING; break; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8338 case VAR_PARTIAL: |
9587
05a56bbe34a1
commit https://github.com/vim/vim/commit/f562e72df726c6191fa305e1c0a113f1cfb87f76
Christian Brabandt <cb@256bit.org>
parents:
9575
diff
changeset
|
8339 case VAR_FUNC: n = VAR_TYPE_FUNC; break; |
05a56bbe34a1
commit https://github.com/vim/vim/commit/f562e72df726c6191fa305e1c0a113f1cfb87f76
Christian Brabandt <cb@256bit.org>
parents:
9575
diff
changeset
|
8340 case VAR_LIST: n = VAR_TYPE_LIST; break; |
05a56bbe34a1
commit https://github.com/vim/vim/commit/f562e72df726c6191fa305e1c0a113f1cfb87f76
Christian Brabandt <cb@256bit.org>
parents:
9575
diff
changeset
|
8341 case VAR_DICT: n = VAR_TYPE_DICT; break; |
05a56bbe34a1
commit https://github.com/vim/vim/commit/f562e72df726c6191fa305e1c0a113f1cfb87f76
Christian Brabandt <cb@256bit.org>
parents:
9575
diff
changeset
|
8342 case VAR_FLOAT: n = VAR_TYPE_FLOAT; break; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8343 case VAR_SPECIAL: |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8344 if (argvars[0].vval.v_number == VVAL_FALSE |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8345 || argvars[0].vval.v_number == VVAL_TRUE) |
9587
05a56bbe34a1
commit https://github.com/vim/vim/commit/f562e72df726c6191fa305e1c0a113f1cfb87f76
Christian Brabandt <cb@256bit.org>
parents:
9575
diff
changeset
|
8346 n = VAR_TYPE_BOOL; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8347 else |
9587
05a56bbe34a1
commit https://github.com/vim/vim/commit/f562e72df726c6191fa305e1c0a113f1cfb87f76
Christian Brabandt <cb@256bit.org>
parents:
9575
diff
changeset
|
8348 n = VAR_TYPE_NONE; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8349 break; |
9587
05a56bbe34a1
commit https://github.com/vim/vim/commit/f562e72df726c6191fa305e1c0a113f1cfb87f76
Christian Brabandt <cb@256bit.org>
parents:
9575
diff
changeset
|
8350 case VAR_JOB: n = VAR_TYPE_JOB; break; |
05a56bbe34a1
commit https://github.com/vim/vim/commit/f562e72df726c6191fa305e1c0a113f1cfb87f76
Christian Brabandt <cb@256bit.org>
parents:
9575
diff
changeset
|
8351 case VAR_CHANNEL: n = VAR_TYPE_CHANNEL; break; |
15454
1d2b5c016f17
patch 8.1.0735: cannot handle binary data
Bram Moolenaar <Bram@vim.org>
parents:
15444
diff
changeset
|
8352 case VAR_BLOB: n = VAR_TYPE_BLOB; break; |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8353 case VAR_UNKNOWN: |
10359
66f1b5bf3fa6
commit https://github.com/vim/vim/commit/95f096030ed1a8afea028f2ea295d6f6a70f466f
Christian Brabandt <cb@256bit.org>
parents:
10277
diff
changeset
|
8354 internal_error("f_type(UNKNOWN)"); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8355 n = -1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8356 break; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8357 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8358 rettv->vval.v_number = n; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8359 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8360 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8361 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8362 * "virtcol(string)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8363 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8364 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8365 f_virtcol(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8366 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8367 colnr_T vcol = 0; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8368 pos_T *fp; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8369 int fnum = curbuf->b_fnum; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8370 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8371 fp = var2fpos(&argvars[0], FALSE, &fnum); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8372 if (fp != NULL && fp->lnum <= curbuf->b_ml.ml_line_count |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8373 && fnum == curbuf->b_fnum) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8374 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8375 getvvcol(curwin, fp, NULL, NULL, &vcol); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8376 ++vcol; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8377 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8378 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8379 rettv->vval.v_number = vcol; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8380 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8381 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8382 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8383 * "visualmode()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8384 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8385 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8386 f_visualmode(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8387 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8388 char_u str[2]; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8389 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8390 rettv->v_type = VAR_STRING; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8391 str[0] = curbuf->b_visual_mode_eval; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8392 str[1] = NUL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8393 rettv->vval.v_string = vim_strsave(str); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8394 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8395 // A non-zero number or non-empty string argument: reset mode. |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8396 if (non_zero_arg(&argvars[0])) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8397 curbuf->b_visual_mode_eval = NUL; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8398 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8399 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8400 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8401 * "wildmenumode()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8402 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8403 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8404 f_wildmenumode(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8405 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8406 #ifdef FEAT_WILDMENU |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8407 if (wild_menu_showing) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8408 rettv->vval.v_number = 1; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8409 #endif |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8410 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8411 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8412 /* |
18973
bf8eb950df61
patch 8.2.0047: cannot skip tests for specific MS-Windows platform
Bram Moolenaar <Bram@vim.org>
parents:
18777
diff
changeset
|
8413 * "windowsversion()" function |
bf8eb950df61
patch 8.2.0047: cannot skip tests for specific MS-Windows platform
Bram Moolenaar <Bram@vim.org>
parents:
18777
diff
changeset
|
8414 */ |
bf8eb950df61
patch 8.2.0047: cannot skip tests for specific MS-Windows platform
Bram Moolenaar <Bram@vim.org>
parents:
18777
diff
changeset
|
8415 static void |
bf8eb950df61
patch 8.2.0047: cannot skip tests for specific MS-Windows platform
Bram Moolenaar <Bram@vim.org>
parents:
18777
diff
changeset
|
8416 f_windowsversion(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
bf8eb950df61
patch 8.2.0047: cannot skip tests for specific MS-Windows platform
Bram Moolenaar <Bram@vim.org>
parents:
18777
diff
changeset
|
8417 { |
bf8eb950df61
patch 8.2.0047: cannot skip tests for specific MS-Windows platform
Bram Moolenaar <Bram@vim.org>
parents:
18777
diff
changeset
|
8418 rettv->v_type = VAR_STRING; |
bf8eb950df61
patch 8.2.0047: cannot skip tests for specific MS-Windows platform
Bram Moolenaar <Bram@vim.org>
parents:
18777
diff
changeset
|
8419 rettv->vval.v_string = vim_strsave((char_u *)windowsVersion); |
bf8eb950df61
patch 8.2.0047: cannot skip tests for specific MS-Windows platform
Bram Moolenaar <Bram@vim.org>
parents:
18777
diff
changeset
|
8420 } |
bf8eb950df61
patch 8.2.0047: cannot skip tests for specific MS-Windows platform
Bram Moolenaar <Bram@vim.org>
parents:
18777
diff
changeset
|
8421 |
bf8eb950df61
patch 8.2.0047: cannot skip tests for specific MS-Windows platform
Bram Moolenaar <Bram@vim.org>
parents:
18777
diff
changeset
|
8422 /* |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8423 * "wordcount()" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8424 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8425 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8426 f_wordcount(typval_T *argvars UNUSED, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8427 { |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8428 if (rettv_dict_alloc(rettv) == FAIL) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8429 return; |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8430 cursor_pos_info(rettv->vval.v_dict); |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8431 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8432 |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8433 /* |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8434 * "xor(expr, expr)" function |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8435 */ |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8436 static void |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8437 f_xor(typval_T *argvars, typval_T *rettv) |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8438 { |
15211
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
8439 rettv->vval.v_number = tv_get_number_chk(&argvars[0], NULL) |
de63593896b3
patch 8.1.0615: get_tv function names are not consistent
Bram Moolenaar <Bram@vim.org>
parents:
15209
diff
changeset
|
8440 ^ tv_get_number_chk(&argvars[1], NULL); |
9571
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8441 } |
5eaa708ab50d
commit https://github.com/vim/vim/commit/73dad1e64cb42842d8259cb1a255a6fa59822f76
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8442 |
18777
3a68dc2a1bc1
patch 8.1.2378: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
8443 #endif // FEAT_EVAL |