diff options
-rw-r--r-- | src/channel.c | 80 | ||||
-rw-r--r-- | src/dict.c | 8 | ||||
-rw-r--r-- | src/edit.c | 2 | ||||
-rw-r--r-- | src/eval.c | 214 | ||||
-rw-r--r-- | src/evalfunc.c | 822 | ||||
-rw-r--r-- | src/ex_cmds.c | 2 | ||||
-rw-r--r-- | src/json.c | 2 | ||||
-rw-r--r-- | src/list.c | 6 | ||||
-rw-r--r-- | src/message.c | 6 | ||||
-rw-r--r-- | src/misc2.c | 2 | ||||
-rw-r--r-- | src/os_unix.c | 12 | ||||
-rw-r--r-- | src/os_win32.c | 2 | ||||
-rw-r--r-- | src/popupmnu.c | 2 | ||||
-rw-r--r-- | src/proto/eval.pro | 14 | ||||
-rw-r--r-- | src/regexp.c | 2 | ||||
-rw-r--r-- | src/tag.c | 2 | ||||
-rw-r--r-- | src/terminal.c | 44 | ||||
-rw-r--r-- | src/textprop.c | 26 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/window.c | 20 |
20 files changed, 637 insertions, 633 deletions
diff --git a/src/channel.c b/src/channel.c index 11ecc16859..cb435c8bc8 100644 --- a/src/channel.c +++ b/src/channel.c @@ -938,7 +938,7 @@ channel_open_func(typval_T *argvars) jobopt_T opt; channel_T *channel = NULL; - address = get_tv_string(&argvars[0]); + address = tv_get_string(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN && (argvars[1].v_type != VAR_DICT || argvars[1].vval.v_dict == NULL)) { @@ -4003,7 +4003,7 @@ ch_raw_common(typval_T *argvars, typval_T *rettv, int eval) rettv->v_type = VAR_STRING; rettv->vval.v_string = NULL; - text = get_tv_string_buf(&argvars[1], buf); + text = tv_get_string_buf(&argvars[1], buf); channel = send_common(argvars, text, 0, eval, &opt, eval ? "ch_evalraw" : "ch_sendraw", &part_read); if (channel != NULL && eval) @@ -4402,7 +4402,7 @@ channel_get_timeout(channel_T *channel, ch_part_T part) static int handle_mode(typval_T *item, jobopt_T *opt, ch_mode_T *modep, int jo) { - char_u *val = get_tv_string(item); + char_u *val = tv_get_string(item); opt->jo_set |= jo; if (STRCMP(val, "nl") == 0) @@ -4424,7 +4424,7 @@ handle_mode(typval_T *item, jobopt_T *opt, ch_mode_T *modep, int jo) static int handle_io(typval_T *item, ch_part_T part, jobopt_T *opt) { - char_u *val = get_tv_string(item); + char_u *val = tv_get_string(item); opt->jo_set |= JO_OUT_IO << (part - PART_OUT); if (STRCMP(val, "null") == 0) @@ -4561,7 +4561,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) { if (!(supported & JO_MODE)) break; - opt->jo_noblock = get_tv_number(item); + opt->jo_noblock = tv_get_number(item); } else if (STRCMP(hi->hi_key, "in_io") == 0 || STRCMP(hi->hi_key, "out_io") == 0 @@ -4582,13 +4582,13 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) break; opt->jo_set |= JO_OUT_NAME << (part - PART_OUT); opt->jo_io_name[part] = - get_tv_string_buf_chk(item, opt->jo_io_name_buf[part]); + tv_get_string_buf_chk(item, opt->jo_io_name_buf[part]); } else if (STRCMP(hi->hi_key, "pty") == 0) { if (!(supported & JO_MODE)) break; - opt->jo_pty = get_tv_number(item); + opt->jo_pty = tv_get_number(item); } else if (STRCMP(hi->hi_key, "in_buf") == 0 || STRCMP(hi->hi_key, "out_buf") == 0 @@ -4599,10 +4599,10 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported & JO_OUT_IO)) break; opt->jo_set |= JO_OUT_BUF << (part - PART_OUT); - opt->jo_io_buf[part] = get_tv_number(item); + opt->jo_io_buf[part] = tv_get_number(item); if (opt->jo_io_buf[part] <= 0) { - EMSG3(_(e_invargNval), hi->hi_key, get_tv_string(item)); + EMSG3(_(e_invargNval), hi->hi_key, tv_get_string(item)); return FAIL; } if (buflist_findnr(opt->jo_io_buf[part]) == NULL) @@ -4619,7 +4619,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported & JO_OUT_IO)) break; opt->jo_set |= JO_OUT_MODIFIABLE << (part - PART_OUT); - opt->jo_modifiable[part] = get_tv_number(item); + opt->jo_modifiable[part] = tv_get_number(item); } else if (STRCMP(hi->hi_key, "out_msg") == 0 || STRCMP(hi->hi_key, "err_msg") == 0) @@ -4629,7 +4629,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported & JO_OUT_IO)) break; opt->jo_set2 |= JO2_OUT_MSG << (part - PART_OUT); - opt->jo_message[part] = get_tv_number(item); + opt->jo_message[part] = tv_get_number(item); } else if (STRCMP(hi->hi_key, "in_top") == 0 || STRCMP(hi->hi_key, "in_bot") == 0) @@ -4648,10 +4648,10 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) lp = &opt->jo_in_bot; opt->jo_set |= JO_IN_BOT; } - *lp = get_tv_number(item); + *lp = tv_get_number(item); if (*lp < 0) { - EMSG3(_(e_invargNval), hi->hi_key, get_tv_string(item)); + EMSG3(_(e_invargNval), hi->hi_key, tv_get_string(item)); return FAIL; } } @@ -4718,7 +4718,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) else if (STRCMP(hi->hi_key, "drop") == 0) { int never = FALSE; - val = get_tv_string(item); + val = tv_get_string(item); if (STRCMP(val, "never") == 0) never = TRUE; @@ -4747,7 +4747,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported2 & JO2_TERM_NAME)) break; opt->jo_set2 |= JO2_TERM_NAME; - opt->jo_term_name = get_tv_string_chk(item); + opt->jo_term_name = tv_get_string_chk(item); if (opt->jo_term_name == NULL) { EMSG2(_(e_invargval), "term_name"); @@ -4758,7 +4758,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) { if (!(supported2 & JO2_TERM_FINISH)) break; - val = get_tv_string(item); + val = tv_get_string(item); if (STRCMP(val, "open") != 0 && STRCMP(val, "close") != 0) { EMSG3(_(e_invargNval), "term_finish", val); @@ -4774,7 +4774,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported2 & JO2_TERM_OPENCMD)) break; opt->jo_set2 |= JO2_TERM_OPENCMD; - p = opt->jo_term_opencmd = get_tv_string_chk(item); + p = opt->jo_term_opencmd = tv_get_string_chk(item); if (p != NULL) { /* Must have %d and no other %. */ @@ -4796,7 +4796,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported2 & JO2_EOF_CHARS)) break; opt->jo_set2 |= JO2_EOF_CHARS; - p = opt->jo_eof_chars = get_tv_string_chk(item); + p = opt->jo_eof_chars = tv_get_string_chk(item); if (p == NULL) { EMSG2(_(e_invargval), "eof_chars"); @@ -4808,54 +4808,54 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported2 & JO2_TERM_ROWS)) break; opt->jo_set2 |= JO2_TERM_ROWS; - opt->jo_term_rows = get_tv_number(item); + opt->jo_term_rows = tv_get_number(item); } else if (STRCMP(hi->hi_key, "term_cols") == 0) { if (!(supported2 & JO2_TERM_COLS)) break; opt->jo_set2 |= JO2_TERM_COLS; - opt->jo_term_cols = get_tv_number(item); + opt->jo_term_cols = tv_get_number(item); } else if (STRCMP(hi->hi_key, "vertical") == 0) { if (!(supported2 & JO2_VERTICAL)) break; opt->jo_set2 |= JO2_VERTICAL; - opt->jo_vertical = get_tv_number(item); + opt->jo_vertical = tv_get_number(item); } else if (STRCMP(hi->hi_key, "curwin") == 0) { if (!(supported2 & JO2_CURWIN)) break; opt->jo_set2 |= JO2_CURWIN; - opt->jo_curwin = get_tv_number(item); + opt->jo_curwin = tv_get_number(item); } else if (STRCMP(hi->hi_key, "hidden") == 0) { if (!(supported2 & JO2_HIDDEN)) break; opt->jo_set2 |= JO2_HIDDEN; - opt->jo_hidden = get_tv_number(item); + opt->jo_hidden = tv_get_number(item); } else if (STRCMP(hi->hi_key, "norestore") == 0) { if (!(supported2 & JO2_NORESTORE)) break; opt->jo_set2 |= JO2_NORESTORE; - opt->jo_term_norestore = get_tv_number(item); + opt->jo_term_norestore = tv_get_number(item); } else if (STRCMP(hi->hi_key, "term_kill") == 0) { if (!(supported2 & JO2_TERM_KILL)) break; opt->jo_set2 |= JO2_TERM_KILL; - opt->jo_term_kill = get_tv_string_chk(item); + opt->jo_term_kill = tv_get_string_chk(item); } # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) else if (STRCMP(hi->hi_key, "ansi_colors") == 0) { - int n = 0; + int n = 0; listitem_T *li; long_u rgb[16]; @@ -4873,9 +4873,9 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) for (; li != NULL && n < 16; li = li->li_next, n++) { char_u *color_name; - guicolor_T guicolor; + guicolor_T guicolor; - color_name = get_tv_string_chk(&li->li_tv); + color_name = tv_get_string_chk(&li->li_tv); if (color_name == NULL) return FAIL; @@ -4915,7 +4915,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) { if (!(supported2 & JO2_CWD)) break; - opt->jo_cwd = get_tv_string_buf_chk(item, opt->jo_cwd_buf); + opt->jo_cwd = tv_get_string_buf_chk(item, opt->jo_cwd_buf); if (opt->jo_cwd == NULL || !mch_isdir(opt->jo_cwd) #ifndef WIN32 // Win32 directories don't have the concept of "executable" || mch_access((char *)opt->jo_cwd, X_OK) != 0 @@ -4932,35 +4932,35 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported & JO_WAITTIME)) break; opt->jo_set |= JO_WAITTIME; - opt->jo_waittime = get_tv_number(item); + opt->jo_waittime = tv_get_number(item); } else if (STRCMP(hi->hi_key, "timeout") == 0) { if (!(supported & JO_TIMEOUT)) break; opt->jo_set |= JO_TIMEOUT; - opt->jo_timeout = get_tv_number(item); + opt->jo_timeout = tv_get_number(item); } else if (STRCMP(hi->hi_key, "out_timeout") == 0) { if (!(supported & JO_OUT_TIMEOUT)) break; opt->jo_set |= JO_OUT_TIMEOUT; - opt->jo_out_timeout = get_tv_number(item); + opt->jo_out_timeout = tv_get_number(item); } else if (STRCMP(hi->hi_key, "err_timeout") == 0) { if (!(supported & JO_ERR_TIMEOUT)) break; opt->jo_set |= JO_ERR_TIMEOUT; - opt->jo_err_timeout = get_tv_number(item); + opt->jo_err_timeout = tv_get_number(item); } else if (STRCMP(hi->hi_key, "part") == 0) { if (!(supported & JO_PART)) break; opt->jo_set |= JO_PART; - val = get_tv_string(item); + val = tv_get_string(item); if (STRCMP(val, "err") == 0) opt->jo_part = PART_ERR; else if (STRCMP(val, "out") == 0) @@ -4976,14 +4976,14 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported & JO_ID)) break; opt->jo_set |= JO_ID; - opt->jo_id = get_tv_number(item); + opt->jo_id = tv_get_number(item); } else if (STRCMP(hi->hi_key, "stoponexit") == 0) { if (!(supported & JO_STOPONEXIT)) break; opt->jo_set |= JO_STOPONEXIT; - opt->jo_stoponexit = get_tv_string_buf_chk(item, + opt->jo_stoponexit = tv_get_string_buf_chk(item, opt->jo_soe_buf); if (opt->jo_stoponexit == NULL) { @@ -4996,7 +4996,7 @@ get_job_options(typval_T *tv, jobopt_T *opt, int supported, int supported2) if (!(supported & JO_BLOCK_WRITE)) break; opt->jo_set |= JO_BLOCK_WRITE; - opt->jo_block_write = get_tv_number(item); + opt->jo_block_write = tv_get_number(item); } else break; @@ -5035,7 +5035,7 @@ get_channel_arg(typval_T *tv, int check_open, int reading, ch_part_T part) } else { - EMSG2(_(e_invarg2), get_tv_string(tv)); + EMSG2(_(e_invarg2), tv_get_string(tv)); return NULL; } if (channel != NULL && reading) @@ -5262,7 +5262,7 @@ win32_build_cmd(list_T *l, garray_T *gap) for (li = l->lv_first; li != NULL; li = li->li_next) { - s = get_tv_string_chk(&li->li_tv); + s = tv_get_string_chk(&li->li_tv); if (s == NULL) return FAIL; s = win32_escape_arg(s); @@ -5832,7 +5832,7 @@ job_stop(job_T *job, typval_T *argvars, char *type) arg = (char_u *)""; else { - arg = get_tv_string_chk(&argvars[1]); + arg = tv_get_string_chk(&argvars[1]); if (arg == NULL) { EMSG(_(e_invarg)); diff --git a/src/dict.c b/src/dict.c index 9ba0231f2b..34ba3e0e41 100644 --- a/src/dict.c +++ b/src/dict.c @@ -495,7 +495,7 @@ dict_get_string(dict_T *d, char_u *key, int save) di = dict_find(d, key, -1); if (di == NULL) return NULL; - s = get_tv_string(&di->di_tv); + s = tv_get_string(&di->di_tv); if (save && s != NULL) s = vim_strsave(s); return s; @@ -513,7 +513,7 @@ dict_get_number(dict_T *d, char_u *key) di = dict_find(d, key, -1); if (di == NULL) return 0; - return get_tv_number(&di->di_tv); + return tv_get_number(&di->di_tv); } /* @@ -630,10 +630,10 @@ dict_get_tv(char_u **arg, typval_T *rettv, int evaluate) } if (evaluate) { - key = get_tv_string_buf_chk(&tvkey, buf); + key = tv_get_string_buf_chk(&tvkey, buf); if (key == NULL) { - /* "key" is NULL when get_tv_string_buf_chk() gave an errmsg */ + /* "key" is NULL when tv_get_string_buf_chk() gave an errmsg */ clear_tv(&tvkey); goto failret; } diff --git a/src/edit.c b/src/edit.c index c23597691b..c6b0619681 100644 --- a/src/edit.c +++ b/src/edit.c @@ -4363,7 +4363,7 @@ ins_compl_add_tv(typval_T *tv, int dir) } else { - word = get_tv_string_chk(tv); + word = tv_get_string_chk(tv); vim_memset(cptext, 0, sizeof(cptext)); } if (word == NULL || (!aempty && *word == NUL)) diff --git a/src/eval.c b/src/eval.c index 18aa5e562f..1d14e1b0e5 100644 --- a/src/eval.c +++ b/src/eval.c @@ -681,7 +681,7 @@ eval_to_bool( *error = FALSE; if (!skip) { - retval = (get_tv_number_chk(&tv, error) != 0); + retval = (tv_get_number_chk(&tv, error) != 0); clear_tv(&tv); } } @@ -720,7 +720,7 @@ eval_expr_typval(typval_T *expr, typval_T *argv, int argc, typval_T *rettv) } else { - s = get_tv_string_buf_chk(expr, buf); + s = tv_get_string_buf_chk(expr, buf); if (s == NULL) return FAIL; s = skipwhite(s); @@ -751,7 +751,7 @@ eval_expr_to_bool(typval_T *expr, int *error) *error = TRUE; return FALSE; } - res = (get_tv_number_chk(&rettv, error) != 0); + res = (tv_get_number_chk(&rettv, error) != 0); clear_tv(&rettv); return res; } @@ -776,7 +776,7 @@ eval_to_string_skip( retval = NULL; else { - retval = vim_strsave(get_tv_string(&tv)); + retval = vim_strsave(tv_get_string(&tv)); clear_tv(&tv); } if (skip) @@ -841,7 +841,7 @@ eval_to_string( } #endif else - retval = vim_strsave(get_tv_string(&tv)); + retval = vim_strsave(tv_get_string(&tv)); clear_tv(&tv); } @@ -891,7 +891,7 @@ eval_to_number(char_u *expr) retval = -1; else { - retval = get_tv_number_chk(&rettv, NULL); + retval = tv_get_number_chk(&rettv, NULL); clear_tv(&rettv); } --emsg_off; @@ -982,12 +982,12 @@ get_spellword(list_T *list, char_u **pp) li = list->lv_first; if (li == NULL) return -1; - *pp = get_tv_string(&li->li_tv); + *pp = tv_get_string(&li->li_tv); li = li->li_next; if (li == NULL) return -1; - return (int)get_tv_number(&li->li_tv); + return (int)tv_get_number(&li->li_tv); } #endif @@ -1053,7 +1053,7 @@ call_func_retnr( if (call_vim_function(func, argc, argv, &rettv) == FAIL) return -1; - retval = get_tv_number_chk(&rettv, NULL); + retval = tv_get_number_chk(&rettv, NULL); clear_tv(&rettv); return retval; } @@ -1080,7 +1080,7 @@ call_func_retstr( if (call_vim_function(func, argc, argv, &rettv) == FAIL) return NULL; - retval = vim_strsave(get_tv_string(&rettv)); + retval = vim_strsave(tv_get_string(&rettv)); clear_tv(&rettv); return retval; } @@ -1654,7 +1654,7 @@ ex_let_one( { c1 = name[len]; name[len] = NUL; - p = get_tv_string_chk(tv); + p = tv_get_string_chk(tv); if (p != NULL && op != NULL && *op == '.') { int mustfree = FALSE; @@ -1708,8 +1708,8 @@ ex_let_one( c1 = *p; *p = NUL; - n = (long)get_tv_number(tv); - s = get_tv_string_chk(tv); /* != NULL if number or string */ + n = (long)tv_get_number(tv); + s = tv_get_string_chk(tv); /* != NULL if number or string */ if (s != NULL && op != NULL && *op != '=') { opt_type = get_option_value(arg, &numval, @@ -1763,7 +1763,7 @@ ex_let_one( char_u *ptofree = NULL; char_u *s; - p = get_tv_string_chk(tv); + p = tv_get_string_chk(tv); if (p != NULL && op != NULL && *op == '.') { s = get_reg_contents(*arg == '@' ? '"' : *arg, GREG_EXPR_SRC); @@ -1956,7 +1956,7 @@ get_lval( empty1 = FALSE; if (eval1(&p, &var1, TRUE) == FAIL) /* recursive! */ return NULL; - if (get_tv_string_chk(&var1) == NULL) + if (tv_get_string_chk(&var1) == NULL) { /* not a number or string */ clear_tv(&var1); @@ -1993,7 +1993,7 @@ get_lval( clear_tv(&var1); return NULL; } - if (get_tv_string_chk(&var2) == NULL) + if (tv_get_string_chk(&var2) == NULL) { /* not a number or string */ clear_tv(&var1); @@ -2024,7 +2024,7 @@ get_lval( if (len == -1) { /* "[key]": get key from "var1" */ - key = get_tv_string_chk(&var1); /* is number or string */ + key = tv_get_string_chk(&var1); /* is number or string */ if (key == NULL) { clear_tv(&var1); @@ -2106,7 +2106,7 @@ get_lval( lp->ll_n1 = 0; else /* is number or string */ - lp->ll_n1 = (long)get_tv_number(&var1); + lp->ll_n1 = (long)tv_get_number(&var1); clear_tv(&var1); lp->ll_dict = NULL; @@ -2136,7 +2136,7 @@ get_lval( */ if (lp->ll_range && !lp->ll_empty2) { - lp->ll_n2 = (long)get_tv_number(&var2); + lp->ll_n2 = (long)tv_get_number(&var2); /* is number or string */ clear_tv(&var2); if (lp->ll_n2 < 0) @@ -2367,7 +2367,7 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op) if (*op == '+' || *op == '-') { /* nr += nr or nr -= nr*/ - n = get_tv_number(tv1); + n = tv_get_number(tv1); #ifdef FEAT_FLOAT if (tv2->v_type == VAR_FLOAT) { @@ -2385,9 +2385,9 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op) #endif { if (*op == '+') - n += get_tv_number(tv2); + n += tv_get_number(tv2); else - n -= get_tv_number(tv2); + n -= tv_get_number(tv2); clear_tv(tv1); tv1->v_type = VAR_NUMBER; tv1->vval.v_number = n; @@ -2399,8 +2399,8 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op) break; /* str .= str */ - s = get_tv_string(tv1); - s = concat_str(s, get_tv_string_buf(tv2, numbuf)); + s = tv_get_string(tv1); + s = concat_str(s, tv_get_string_buf(tv2, numbuf)); clear_tv(tv1); tv1->v_type = VAR_STRING; tv1->vval.v_string = s; @@ -2419,7 +2419,7 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op) if (tv2->v_type == VAR_FLOAT) f = tv2->vval.v_float; else - f = get_tv_number(tv2); + f = tv_get_number(tv2); if (*op == '+') tv1->vval.v_float += f; else @@ -3271,7 +3271,7 @@ eval1(char_u **arg, typval_T *rettv, int evaluate) { int error = FALSE; - if (get_tv_number_chk(rettv, &error) != 0) + if (tv_get_number_chk(rettv, &error) != 0) result = TRUE; clear_tv(rettv); if (error) @@ -3345,7 +3345,7 @@ eval2(char_u **arg, typval_T *rettv, int evaluate) { if (evaluate && first) { - if (get_tv_number_chk(rettv, &error) != 0) + if (tv_get_number_chk(rettv, &error) != 0) result = TRUE; clear_tv(rettv); if (error) @@ -3365,7 +3365,7 @@ eval2(char_u **arg, typval_T *rettv, int evaluate) */ if (evaluate && !result) { - if (get_tv_number_chk(&var2, &error) != 0) + if (tv_get_number_chk(&var2, &error) != 0) result = TRUE; clear_tv(&var2); if (error) @@ -3413,7 +3413,7 @@ eval3(char_u **arg, typval_T *rettv, int evaluate) { if (evaluate && first) { - if (get_tv_number_chk(rettv, &error) == 0) + if (tv_get_number_chk(rettv, &error) == 0) result = FALSE; clear_tv(rettv); if (error) @@ -3433,7 +3433,7 @@ eval3(char_u **arg, typval_T *rettv, int evaluate) */ if (evaluate && result) { - if (get_tv_number_chk(&var2, &error) == 0) + if (tv_get_number_chk(&var2, &error) == 0) result = FALSE; clear_tv(&var2); if (error) @@ -3622,7 +3622,7 @@ eval5(char_u **arg, typval_T *rettv, int evaluate) * we know that the first operand needs to be a string or number * without evaluating the 2nd operand. So check before to avoid * side effects after an error. */ - if (evaluate && get_tv_string_chk(rettv) == NULL) + if (evaluate && tv_get_string_chk(rettv) == NULL) { clear_tv(rettv); return FAIL; @@ -3646,8 +3646,8 @@ eval5(char_u **arg, typval_T *rettv, int evaluate) */ if (op == '.') { - s1 = get_tv_string_buf(rettv, buf1); /* already checked */ - s2 = get_tv_string_buf_chk(&var2, buf2); + s1 = tv_get_string_buf(rettv, buf1); /* already checked */ + s2 = tv_get_string_buf_chk(&var2, buf2); if (s2 == NULL) /* type error ? */ { clear_tv(rettv); @@ -3686,7 +3686,7 @@ eval5(char_u **arg, typval_T *rettv, int evaluate) else #endif { - n1 = get_tv_number_chk(rettv, &error); + n1 = tv_get_number_chk(rettv, &error); if (error) { /* This can only happen for "list + non-list". For @@ -3709,7 +3709,7 @@ eval5(char_u **arg, typval_T *rettv, int evaluate) else #endif { - n2 = get_tv_number_chk(&var2, &error); + n2 = tv_get_number_chk(&var2, &error); if (error) { clear_tv(rettv); @@ -3804,7 +3804,7 @@ eval6( } else #endif - n1 = get_tv_number_chk(rettv, &error); + n1 = tv_get_number_chk(rettv, &error); clear_tv(rettv); if (error) return FAIL; @@ -3835,7 +3835,7 @@ eval6( else #endif { - n2 = get_tv_number_chk(&var2, &error); + n2 = tv_get_number_chk(&var2, &error); clear_tv(&var2); if (error) return FAIL; @@ -4200,7 +4200,7 @@ eval7( f = rettv->vval.v_float; else #endif - val = get_tv_number_chk(rettv, &error); + val = tv_get_number_chk(rettv, &error); if (error) { clear_tv(rettv); @@ -4326,7 +4326,7 @@ eval_index( empty1 = TRUE; else if (eval1(arg, &var1, evaluate) == FAIL) /* recursive! */ return FAIL; - else if (evaluate && get_tv_string_chk(&var1) == NULL) + else if (evaluate && tv_get_string_chk(&var1) == NULL) { /* not a number or string */ clear_tv(&var1); @@ -4348,7 +4348,7 @@ eval_index( clear_tv(&var1); return FAIL; } - else if (evaluate && get_tv_string_chk(&var2) == NULL) + else if (evaluate && tv_get_string_chk(&var2) == NULL) { /* not a number or string */ if (!empty1) @@ -4376,7 +4376,7 @@ eval_index( n1 = 0; if (!empty1 && rettv->v_type != VAR_DICT) { - n1 = get_tv_number(&var1); + n1 = tv_get_number(&var1); clear_tv(&var1); } if (range) @@ -4385,7 +4385,7 @@ eval_index( n2 = -1; else { - n2 = get_tv_number(&var2); + n2 = tv_get_number(&var2); clear_tv(&var2); } } @@ -4403,7 +4403,7 @@ eval_index( case VAR_NUMBER: case VAR_STRING: - s = get_tv_string(rettv); + s = tv_get_string(rettv); len = (long)STRLEN(s); if (range) { @@ -4504,7 +4504,7 @@ eval_index( if (len == -1) { - key = get_tv_string_chk(&var1); + key = tv_get_string_chk(&var1); if (key == NULL) { clear_tv(&var1); @@ -4974,8 +4974,8 @@ tv_equal( return tv1->vval.v_number == tv2->vval.v_number; case VAR_STRING: - s1 = get_tv_string_buf(tv1, buf1); - s2 = get_tv_string_buf(tv2, buf2); + s1 = tv_get_string_buf(tv1, buf1); + s2 = tv_get_string_buf(tv2, buf2); return ((ic ? MB_STRICMP(s1, s2) : STRCMP(s1, s2)) == 0); case VAR_SPECIAL: @@ -5652,13 +5652,13 @@ echo_string_core( case VAR_NUMBER: case VAR_UNKNOWN: *tofree = NULL; - r = get_tv_string_buf(tv, numbuf); + r = tv_get_string_buf(tv, numbuf); break; case VAR_JOB: case VAR_CHANNEL: *tofree = NULL; - r = get_tv_string_buf(tv, numbuf); + r = tv_get_string_buf(tv, numbuf); if (composite_val) { *tofree = string_quote(r, FALSE); @@ -5913,7 +5913,7 @@ var2fpos( return &pos; } - name = get_tv_string_chk(varp); + name = tv_get_string_chk(varp); if (name == NULL) return NULL; if (name[0] == '.') /* cursor */ @@ -6363,7 +6363,7 @@ get_vim_var_nr(int idx) char_u * get_vim_var_str(int idx) { - return get_tv_string(&vimvars[idx].vv_tv); + return tv_get_string(&vimvars[idx].vv_tv); } /* @@ -6936,20 +6936,20 @@ init_tv(typval_T *varp) * Get the number value of a variable. * If it is a String variable, uses vim_str2nr(). * For incompatible types, return 0. - * get_tv_number_chk() is similar to get_tv_number(), but informs the + * tv_get_number_chk() is similar to tv_get_number(), but informs the * caller of incompatible types: it sets *denote to TRUE if "denote" * is not NULL or returns -1 otherwise. */ varnumber_T -get_tv_number(typval_T *varp) +tv_get_number(typval_T *varp) { int error = FALSE; - return get_tv_number_chk(varp, &error); /* return 0L on error */ + return tv_get_number_chk(varp, &error); /* return 0L on error */ } varnumber_T -get_tv_number_chk(typval_T *varp, int *denote) +tv_get_number_chk(typval_T *varp, int *denote) { varnumber_T n = 0L; @@ -6991,7 +6991,7 @@ get_tv_number_chk(typval_T *varp, int *denote) break; #endif case VAR_UNKNOWN: - internal_error("get_tv_number(UNKNOWN)"); + internal_error("tv_get_number(UNKNOWN)"); break; } if (denote == NULL) /* useful for values that must be unsigned */ @@ -7003,7 +7003,7 @@ get_tv_number_chk(typval_T *varp, int *denote) #ifdef FEAT_FLOAT float_T -get_tv_float(typval_T *varp) +tv_get_float(typval_T *varp) { switch (varp->v_type) { @@ -7038,7 +7038,7 @@ get_tv_float(typval_T *varp) break; # endif case VAR_UNKNOWN: - internal_error("get_tv_float(UNKNOWN)"); + internal_error("tv_get_float(UNKNOWN)"); break; } return 0; @@ -7048,25 +7048,25 @@ get_tv_float(typval_T *varp) /* * Get the string value of a variable. * If it is a Number variable, the number is converted into a string. - * get_tv_string() uses a single, static buffer. YOU CAN ONLY USE IT ONCE! - * get_tv_string_buf() uses a given buffer. + * tv_get_string() uses a single, static buffer. YOU CAN ONLY USE IT ONCE! + * tv_get_string_buf() uses a given buffer. * If the String variable has never been set, return an empty string. * Never returns NULL; - * get_tv_string_chk() and get_tv_string_buf_chk() are similar, but return + * tv_get_string_chk() and tv_get_string_buf_chk() are similar, but return * NULL on error. */ char_u * -get_tv_string(typval_T *varp) +tv_get_string(typval_T *varp) { static char_u mybuf[NUMBUFLEN]; - return get_tv_string_buf(varp, mybuf); + return tv_get_string_buf(varp, mybuf); } char_u * -get_tv_string_buf(typval_T *varp, char_u *buf) +tv_get_string_buf(typval_T *varp, char_u *buf) { - char_u *res = get_tv_string_buf_chk(varp, buf); + char_u *res = tv_get_string_buf_chk(varp, buf); return res != NULL ? res : (char_u *)""; } @@ -7075,15 +7075,15 @@ get_tv_string_buf(typval_T *varp, char_u *buf) * Careful: This uses a single, static buffer. YOU CAN ONLY USE IT ONCE! */ char_u * -get_tv_string_chk(typval_T *varp) +tv_get_string_chk(typval_T *varp) { static char_u mybuf[NUMBUFLEN]; - return get_tv_string_buf_chk(varp, mybuf); + return tv_get_string_buf_chk(varp, mybuf); } char_u * -get_tv_string_buf_chk(typval_T *varp, char_u *buf) +tv_get_string_buf_chk(typval_T *varp, char_u *buf) { switch (varp->v_type) { @@ -7298,7 +7298,7 @@ find_var_ht(char_u *name, char_u **varname) /* * Get the string value of a (global/local) variable. - * Note: see get_tv_string() for how long the pointer remains valid. + * Note: see tv_get_string() for how long the pointer remains valid. * Returns NULL when it doesn't exist. */ char_u * @@ -7309,7 +7309,7 @@ get_var_value(char_u *name) v = find_var(name, NULL, FALSE); if (v == NULL) return NULL; - return get_tv_string(&v->di_tv); + return tv_get_string(&v->di_tv); } /* @@ -7544,7 +7544,7 @@ set_var( { vim_free(v->di_tv.vval.v_string); if (copy || tv->v_type != VAR_STRING) - v->di_tv.vval.v_string = vim_strsave(get_tv_string(tv)); + v->di_tv.vval.v_string = vim_strsave(tv_get_string(tv)); else { /* Take over the string to avoid an extra alloc/free. */ @@ -7555,7 +7555,7 @@ set_var( } else if (v->di_tv.v_type == VAR_NUMBER) { - v->di_tv.vval.v_number = get_tv_number(tv); + v->di_tv.vval.v_number = tv_get_number(tv); if (STRCMP(varname, "searchforward") == 0) set_search_direction(v->di_tv.vval.v_number ? '/' : '?'); #ifdef FEAT_SEARCH_EXTRA @@ -7894,7 +7894,7 @@ get_user_input( int inputdialog, int secret) { - char_u *prompt = get_tv_string_chk(&argvars[0]); + char_u *prompt = tv_get_string_chk(&argvars[0]); char_u *p = NULL; int c; char_u buf[NUMBUFLEN]; @@ -7937,7 +7937,7 @@ get_user_input( if (argvars[1].v_type != VAR_UNKNOWN) { - defstr = get_tv_string_buf_chk(&argvars[1], buf); + defstr = tv_get_string_buf_chk(&argvars[1], buf); if (defstr != NULL) stuffReadbuffSpec(defstr); @@ -7950,7 +7950,7 @@ get_user_input( /* input() with a third argument: completion */ rettv->vval.v_string = NULL; - xp_name = get_tv_string_buf_chk(&argvars[2], buf); + xp_name = tv_get_string_buf_chk(&argvars[2], buf); if (xp_name == NULL) return; @@ -7975,7 +7975,7 @@ get_user_input( if (inputdialog && rettv->vval.v_string == NULL && argvars[1].v_type != VAR_UNKNOWN && argvars[2].v_type != VAR_UNKNOWN) - rettv->vval.v_string = vim_strsave(get_tv_string_buf( + rettv->vval.v_string = vim_strsave(tv_get_string_buf( &argvars[2], buf)); vim_free(xp_arg); @@ -8142,7 +8142,7 @@ ex_execute(exarg_T *eap) if (!eap->skip) { - p = get_tv_string(&rettv); + p = tv_get_string(&rettv); len = (int)STRLEN(p); if (ga_grow(&ga, len + 2) == FAIL) { @@ -8205,7 +8205,7 @@ find_win_by_nr( tabpage_T *tp) /* NULL for current tab page */ { win_T *wp; |