Mercurial > vim
comparison src/userfunc.c @ 15470:55ccc2d353bd v8.1.0743
patch 8.1.0743: giving error messages is not flexible
commit https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 13 23:38:42 2019 +0100
patch 8.1.0743: giving error messages is not flexible
Problem: Giving error messages is not flexible.
Solution: Add semsg(). Change argument from "char_u *" to "char *", also
for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes
#3302) Also make emsg() accept a "char *" argument. Get rid of
an enormous number of type casts.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 13 Jan 2019 23:45:08 +0100 |
parents | 9df130fd5e0d |
children | dd725a8ab112 |
comparison
equal
deleted
inserted
replaced
15469:bc9b5261ed01 | 15470:55ccc2d353bd |
---|---|
117 if (arg == p || isdigit(*arg) | 117 if (arg == p || isdigit(*arg) |
118 || (p - arg == 9 && STRNCMP(arg, "firstline", 9) == 0) | 118 || (p - arg == 9 && STRNCMP(arg, "firstline", 9) == 0) |
119 || (p - arg == 8 && STRNCMP(arg, "lastline", 8) == 0)) | 119 || (p - arg == 8 && STRNCMP(arg, "lastline", 8) == 0)) |
120 { | 120 { |
121 if (!skip) | 121 if (!skip) |
122 EMSG2(_("E125: Illegal argument: %s"), arg); | 122 semsg(_("E125: Illegal argument: %s"), arg); |
123 break; | 123 break; |
124 } | 124 } |
125 if (newargs != NULL && ga_grow(newargs, 1) == FAIL) | 125 if (newargs != NULL && ga_grow(newargs, 1) == FAIL) |
126 goto err_ret; | 126 goto err_ret; |
127 if (newargs != NULL) | 127 if (newargs != NULL) |
137 | 137 |
138 /* Check for duplicate argument name. */ | 138 /* Check for duplicate argument name. */ |
139 for (i = 0; i < newargs->ga_len; ++i) | 139 for (i = 0; i < newargs->ga_len; ++i) |
140 if (STRCMP(((char_u **)(newargs->ga_data))[i], arg) == 0) | 140 if (STRCMP(((char_u **)(newargs->ga_data))[i], arg) == 0) |
141 { | 141 { |
142 EMSG2(_("E853: Duplicate argument name: %s"), arg); | 142 semsg(_("E853: Duplicate argument name: %s"), arg); |
143 vim_free(arg); | 143 vim_free(arg); |
144 goto err_ret; | 144 goto err_ret; |
145 } | 145 } |
146 ((char_u **)(newargs->ga_data))[newargs->ga_len] = arg; | 146 ((char_u **)(newargs->ga_data))[newargs->ga_len] = arg; |
147 newargs->ga_len++; | 147 newargs->ga_len++; |
155 } | 155 } |
156 p = skipwhite(p); | 156 p = skipwhite(p); |
157 if (mustend && *p != endchar) | 157 if (mustend && *p != endchar) |
158 { | 158 { |
159 if (!skip) | 159 if (!skip) |
160 EMSG2(_(e_invarg2), *argp); | 160 semsg(_(e_invarg2), *argp); |
161 break; | 161 break; |
162 } | 162 } |
163 } | 163 } |
164 if (*p != endchar) | 164 if (*p != endchar) |
165 goto err_ret; | 165 goto err_ret; |
384 | 384 |
385 if (*name == K_SPECIAL) | 385 if (*name == K_SPECIAL) |
386 p = concat_str((char_u *)"<SNR>", name + 3); | 386 p = concat_str((char_u *)"<SNR>", name + 3); |
387 else | 387 else |
388 p = name; | 388 p = name; |
389 EMSG2(_(ermsg), p); | 389 semsg(_(ermsg), p); |
390 if (p != name) | 390 if (p != name) |
391 vim_free(p); | 391 vim_free(p); |
392 } | 392 } |
393 | 393 |
394 /* | 394 /* |
711 #endif | 711 #endif |
712 | 712 |
713 /* If depth of calling is getting too high, don't execute the function */ | 713 /* If depth of calling is getting too high, don't execute the function */ |
714 if (depth >= p_mfd) | 714 if (depth >= p_mfd) |
715 { | 715 { |
716 EMSG(_("E132: Function call depth is higher than 'maxfuncdepth'")); | 716 emsg(_("E132: Function call depth is higher than 'maxfuncdepth'")); |
717 rettv->v_type = VAR_NUMBER; | 717 rettv->v_type = VAR_NUMBER; |
718 rettv->vval.v_number = -1; | 718 rettv->vval.v_number = -1; |
719 return; | 719 return; |
720 } | 720 } |
721 ++depth; | 721 ++depth; |
883 if (p_verbose >= 12) | 883 if (p_verbose >= 12) |
884 { | 884 { |
885 ++no_wait_return; | 885 ++no_wait_return; |
886 verbose_enter_scroll(); | 886 verbose_enter_scroll(); |
887 | 887 |
888 smsg((char_u *)_("calling %s"), sourcing_name); | 888 smsg(_("calling %s"), sourcing_name); |
889 if (p_verbose >= 14) | 889 if (p_verbose >= 14) |
890 { | 890 { |
891 char_u buf[MSG_BUF_LEN]; | 891 char_u buf[MSG_BUF_LEN]; |
892 char_u numbuf2[NUMBUFLEN]; | 892 char_u numbuf2[NUMBUFLEN]; |
893 char_u *tofree; | 893 char_u *tofree; |
988 { | 988 { |
989 ++no_wait_return; | 989 ++no_wait_return; |
990 verbose_enter_scroll(); | 990 verbose_enter_scroll(); |
991 | 991 |
992 if (aborting()) | 992 if (aborting()) |
993 smsg((char_u *)_("%s aborted"), sourcing_name); | 993 smsg(_("%s aborted"), sourcing_name); |
994 else if (fc->rettv->v_type == VAR_NUMBER) | 994 else if (fc->rettv->v_type == VAR_NUMBER) |
995 smsg((char_u *)_("%s returning #%ld"), sourcing_name, | 995 smsg(_("%s returning #%ld"), sourcing_name, |
996 (long)fc->rettv->vval.v_number); | 996 (long)fc->rettv->vval.v_number); |
997 else | 997 else |
998 { | 998 { |
999 char_u buf[MSG_BUF_LEN]; | 999 char_u buf[MSG_BUF_LEN]; |
1000 char_u numbuf2[NUMBUFLEN]; | 1000 char_u numbuf2[NUMBUFLEN]; |
1012 if (vim_strsize(s) > MSG_BUF_CLEN) | 1012 if (vim_strsize(s) > MSG_BUF_CLEN) |
1013 { | 1013 { |
1014 trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN); | 1014 trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN); |
1015 s = buf; | 1015 s = buf; |
1016 } | 1016 } |
1017 smsg((char_u *)_("%s returning %s"), sourcing_name, s); | 1017 smsg(_("%s returning %s"), sourcing_name, s); |
1018 vim_free(tofree); | 1018 vim_free(tofree); |
1019 } | 1019 } |
1020 } | 1020 } |
1021 msg_puts((char_u *)"\n"); /* don't overwrite this either */ | 1021 msg_puts((char_u *)"\n"); /* don't overwrite this either */ |
1022 | 1022 |
1038 if (p_verbose >= 12 && sourcing_name != NULL) | 1038 if (p_verbose >= 12 && sourcing_name != NULL) |
1039 { | 1039 { |
1040 ++no_wait_return; | 1040 ++no_wait_return; |
1041 verbose_enter_scroll(); | 1041 verbose_enter_scroll(); |
1042 | 1042 |
1043 smsg((char_u *)_("continuing in %s"), sourcing_name); | 1043 smsg(_("continuing in %s"), sourcing_name); |
1044 msg_puts((char_u *)"\n"); /* don't overwrite this either */ | 1044 msg_puts((char_u *)"\n"); /* don't overwrite this either */ |
1045 | 1045 |
1046 verbose_leave_scroll(); | 1046 verbose_leave_scroll(); |
1047 --no_wait_return; | 1047 --no_wait_return; |
1048 } | 1048 } |
1192 | 1192 |
1193 void | 1193 void |
1194 restore_funccal(void) | 1194 restore_funccal(void) |
1195 { | 1195 { |
1196 if (funccal_stack == NULL) | 1196 if (funccal_stack == NULL) |
1197 IEMSG("INTERNAL: restore_funccal()"); | 1197 iemsg("INTERNAL: restore_funccal()"); |
1198 else | 1198 else |
1199 { | 1199 { |
1200 current_funccal = funccal_stack->top_funccal; | 1200 current_funccal = funccal_stack->top_funccal; |
1201 funccal_stack = funccal_stack->next; | 1201 funccal_stack = funccal_stack->next; |
1202 } | 1202 } |
1310 for (item = args->vval.v_list->lv_first; item != NULL; | 1310 for (item = args->vval.v_list->lv_first; item != NULL; |
1311 item = item->li_next) | 1311 item = item->li_next) |
1312 { | 1312 { |
1313 if (argc == MAX_FUNC_ARGS - (partial == NULL ? 0 : partial->pt_argc)) | 1313 if (argc == MAX_FUNC_ARGS - (partial == NULL ? 0 : partial->pt_argc)) |
1314 { | 1314 { |
1315 EMSG(_("E699: Too many arguments")); | 1315 emsg(_("E699: Too many arguments")); |
1316 break; | 1316 break; |
1317 } | 1317 } |
1318 /* Make a copy of each argument. This is needed to be able to set | 1318 /* Make a copy of each argument. This is needed to be able to set |
1319 * v_lock to VAR_FIXED in the copy without changing the original list. | 1319 * v_lock to VAR_FIXED in the copy without changing the original list. |
1320 */ | 1320 */ |
1658 end = get_lval(start, NULL, &lv, FALSE, skip, flags | GLV_READ_ONLY, | 1658 end = get_lval(start, NULL, &lv, FALSE, skip, flags | GLV_READ_ONLY, |
1659 lead > 2 ? 0 : FNE_CHECK_START); | 1659 lead > 2 ? 0 : FNE_CHECK_START); |
1660 if (end == start) | 1660 if (end == start) |
1661 { | 1661 { |
1662 if (!skip) | 1662 if (!skip) |
1663 EMSG(_("E129: Function name required")); | 1663 emsg(_("E129: Function name required")); |
1664 goto theend; | 1664 goto theend; |
1665 } | 1665 } |
1666 if (end == NULL || (lv.ll_tv != NULL && (lead > 2 || lv.ll_range))) | 1666 if (end == NULL || (lv.ll_tv != NULL && (lead > 2 || lv.ll_range))) |
1667 { | 1667 { |
1668 /* | 1668 /* |
1671 * interrupt, or an exception. | 1671 * interrupt, or an exception. |
1672 */ | 1672 */ |
1673 if (!aborting()) | 1673 if (!aborting()) |
1674 { | 1674 { |
1675 if (end != NULL) | 1675 if (end != NULL) |
1676 EMSG2(_(e_invarg2), start); | 1676 semsg(_(e_invarg2), start); |
1677 } | 1677 } |
1678 else | 1678 else |
1679 *pp = find_name_end(start, NULL, NULL, FNE_INCL_BR); | 1679 *pp = find_name_end(start, NULL, NULL, FNE_INCL_BR); |
1680 goto theend; | 1680 goto theend; |
1681 } | 1681 } |
1704 } | 1704 } |
1705 else | 1705 else |
1706 { | 1706 { |
1707 if (!skip && !(flags & TFN_QUIET) && (fdp == NULL | 1707 if (!skip && !(flags & TFN_QUIET) && (fdp == NULL |
1708 || lv.ll_dict == NULL || fdp->fd_newkey == NULL)) | 1708 || lv.ll_dict == NULL || fdp->fd_newkey == NULL)) |
1709 EMSG(_(e_funcref)); | 1709 emsg(_(e_funcref)); |
1710 else | 1710 else |
1711 *pp = end; | 1711 *pp = end; |
1712 name = NULL; | 1712 name = NULL; |
1713 } | 1713 } |
1714 goto theend; | 1714 goto theend; |
1787 || eval_fname_sid(*pp)) | 1787 || eval_fname_sid(*pp)) |
1788 { | 1788 { |
1789 /* It's "s:" or "<SID>" */ | 1789 /* It's "s:" or "<SID>" */ |
1790 if (current_sctx.sc_sid <= 0) | 1790 if (current_sctx.sc_sid <= 0) |
1791 { | 1791 { |
1792 EMSG(_(e_usingsid)); | 1792 emsg(_(e_usingsid)); |
1793 goto theend; | 1793 goto theend; |
1794 } | 1794 } |
1795 sprintf((char *)sid_buf, "%ld_", (long)current_sctx.sc_sid); | 1795 sprintf((char *)sid_buf, "%ld_", (long)current_sctx.sc_sid); |
1796 lead += (int)STRLEN(sid_buf); | 1796 lead += (int)STRLEN(sid_buf); |
1797 } | 1797 } |
1798 } | 1798 } |
1799 else if (!(flags & TFN_INT) && builtin_function(lv.ll_name, len)) | 1799 else if (!(flags & TFN_INT) && builtin_function(lv.ll_name, len)) |
1800 { | 1800 { |
1801 EMSG2(_("E128: Function name must start with a capital or \"s:\": %s"), | 1801 semsg(_("E128: Function name must start with a capital or \"s:\": %s"), |
1802 start); | 1802 start); |
1803 goto theend; | 1803 goto theend; |
1804 } | 1804 } |
1805 if (!skip && !(flags & TFN_QUIET) && !(flags & TFN_NO_DEREF)) | 1805 if (!skip && !(flags & TFN_QUIET) && !(flags & TFN_NO_DEREF)) |
1806 { | 1806 { |
1807 char_u *cp = vim_strchr(lv.ll_name, ':'); | 1807 char_u *cp = vim_strchr(lv.ll_name, ':'); |
1808 | 1808 |
1809 if (cp != NULL && cp < end) | 1809 if (cp != NULL && cp < end) |
1810 { | 1810 { |
1811 EMSG2(_("E884: Function name cannot contain a colon: %s"), start); | 1811 semsg(_("E884: Function name cannot contain a colon: %s"), start); |
1812 goto theend; | 1812 goto theend; |
1813 } | 1813 } |
1814 } | 1814 } |
1815 | 1815 |
1816 name = alloc((unsigned)(len + lead + 1)); | 1816 name = alloc((unsigned)(len + lead + 1)); |
1959 * interrupt, or an exception. | 1959 * interrupt, or an exception. |
1960 */ | 1960 */ |
1961 if (!aborting()) | 1961 if (!aborting()) |
1962 { | 1962 { |
1963 if (!eap->skip && fudi.fd_newkey != NULL) | 1963 if (!eap->skip && fudi.fd_newkey != NULL) |
1964 EMSG2(_(e_dictkey), fudi.fd_newkey); | 1964 semsg(_(e_dictkey), fudi.fd_newkey); |
1965 vim_free(fudi.fd_newkey); | 1965 vim_free(fudi.fd_newkey); |
1966 return; | 1966 return; |
1967 } | 1967 } |
1968 else | 1968 else |
1969 eap->skip = TRUE; | 1969 eap->skip = TRUE; |
1979 */ | 1979 */ |
1980 if (!paren) | 1980 if (!paren) |
1981 { | 1981 { |
1982 if (!ends_excmd(*skipwhite(p))) | 1982 if (!ends_excmd(*skipwhite(p))) |
1983 { | 1983 { |
1984 EMSG(_(e_trailing)); | 1984 emsg(_(e_trailing)); |
1985 goto ret_free; | 1985 goto ret_free; |
1986 } | 1986 } |
1987 eap->nextcmd = check_nextcmd(p); | 1987 eap->nextcmd = check_nextcmd(p); |
1988 if (eap->nextcmd != NULL) | 1988 if (eap->nextcmd != NULL) |
1989 *p = NUL; | 1989 *p = NUL; |
2025 p = skipwhite(p); | 2025 p = skipwhite(p); |
2026 if (*p != '(') | 2026 if (*p != '(') |
2027 { | 2027 { |
2028 if (!eap->skip) | 2028 if (!eap->skip) |
2029 { | 2029 { |
2030 EMSG2(_("E124: Missing '(': %s"), eap->arg); | 2030 semsg(_("E124: Missing '(': %s"), eap->arg); |
2031 goto ret_free; | 2031 goto ret_free; |
2032 } | 2032 } |
2033 /* attempt to continue by skipping some text */ | 2033 /* attempt to continue by skipping some text */ |
2034 if (vim_strchr(p, '(') != NULL) | 2034 if (vim_strchr(p, '(') != NULL) |
2035 p = vim_strchr(p, '('); | 2035 p = vim_strchr(p, '('); |
2060 if (arg[j] != NUL) | 2060 if (arg[j] != NUL) |
2061 emsg_funcname((char *)e_invarg2, arg); | 2061 emsg_funcname((char *)e_invarg2, arg); |
2062 } | 2062 } |
2063 /* Disallow using the g: dict. */ | 2063 /* Disallow using the g: dict. */ |
2064 if (fudi.fd_dict != NULL && fudi.fd_dict->dv_scope == VAR_DEF_SCOPE) | 2064 if (fudi.fd_dict != NULL && fudi.fd_dict->dv_scope == VAR_DEF_SCOPE) |
2065 EMSG(_("E862: Cannot use g: here")); | 2065 emsg(_("E862: Cannot use g: here")); |
2066 } | 2066 } |
2067 | 2067 |
2068 if (get_function_args(&p, ')', &newargs, &varargs, eap->skip) == FAIL) | 2068 if (get_function_args(&p, ')', &newargs, &varargs, eap->skip) == FAIL) |
2069 goto errret_2; | 2069 goto errret_2; |
2070 | 2070 |
2105 /* When there is a line break use what follows for the function body. | 2105 /* When there is a line break use what follows for the function body. |
2106 * Makes 'exe "func Test()\n...\nendfunc"' work. */ | 2106 * Makes 'exe "func Test()\n...\nendfunc"' work. */ |
2107 if (*p == '\n') | 2107 if (*p == '\n') |
2108 line_arg = p + 1; | 2108 line_arg = p + 1; |
2109 else if (*p != NUL && *p != '"' && !eap->skip && !did_emsg) | 2109 else if (*p != NUL && *p != '"' && !eap->skip && !did_emsg) |
2110 EMSG(_(e_trailing)); | 2110 emsg(_(e_trailing)); |
2111 | 2111 |
2112 /* | 2112 /* |
2113 * Read the body of the function, until ":endfunction" is found. | 2113 * Read the body of the function, until ":endfunction" is found. |
2114 */ | 2114 */ |
2115 if (KeyTyped) | 2115 if (KeyTyped) |
2118 * whole function before telling him it doesn't work! For a script we | 2118 * whole function before telling him it doesn't work! For a script we |
2119 * need to skip the body to be able to find what follows. */ | 2119 * need to skip the body to be able to find what follows. */ |
2120 if (!eap->skip && !eap->forceit) | 2120 if (!eap->skip && !eap->forceit) |
2121 { | 2121 { |
2122 if (fudi.fd_dict != NULL && fudi.fd_newkey == NULL) | 2122 if (fudi.fd_dict != NULL && fudi.fd_newkey == NULL) |
2123 EMSG(_(e_funcdict)); | 2123 emsg(_(e_funcdict)); |
2124 else if (name != NULL && find_func(name) != NULL) | 2124 else if (name != NULL && find_func(name) != NULL) |
2125 emsg_funcname(e_funcexts, name); | 2125 emsg_funcname(e_funcexts, name); |
2126 } | 2126 } |
2127 | 2127 |
2128 if (!eap->skip && did_emsg) | 2128 if (!eap->skip && did_emsg) |
2168 } | 2168 } |
2169 if (KeyTyped) | 2169 if (KeyTyped) |
2170 lines_left = Rows - 1; | 2170 lines_left = Rows - 1; |
2171 if (theline == NULL) | 2171 if (theline == NULL) |
2172 { | 2172 { |
2173 EMSG(_("E126: Missing :endfunction")); | 2173 emsg(_("E126: Missing :endfunction")); |
2174 goto erret; | 2174 goto erret; |
2175 } | 2175 } |
2176 | 2176 |
2177 /* Detect line continuation: sourcing_lnum increased more than one. */ | 2177 /* Detect line continuation: sourcing_lnum increased more than one. */ |
2178 if (sourcing_lnum > sourcing_lnum_off + 1) | 2178 if (sourcing_lnum > sourcing_lnum_off + 1) |
2372 char numbuf[20]; | 2372 char numbuf[20]; |
2373 | 2373 |
2374 fp = NULL; | 2374 fp = NULL; |
2375 if (fudi.fd_newkey == NULL && !eap->forceit) | 2375 if (fudi.fd_newkey == NULL && !eap->forceit) |
2376 { | 2376 { |
2377 EMSG(_(e_funcdict)); | 2377 emsg(_(e_funcdict)); |
2378 goto erret; | 2378 goto erret; |
2379 } | 2379 } |
2380 if (fudi.fd_di == NULL) | 2380 if (fudi.fd_di == NULL) |
2381 { | 2381 { |
2382 /* Can't add a function to a locked dictionary */ | 2382 /* Can't add a function to a locked dictionary */ |
2419 vim_free(scriptname); | 2419 vim_free(scriptname); |
2420 } | 2420 } |
2421 } | 2421 } |
2422 if (j == FAIL) | 2422 if (j == FAIL) |
2423 { | 2423 { |
2424 EMSG2(_("E746: Function name does not match script file name: %s"), name); | 2424 semsg(_("E746: Function name does not match script file name: %s"), name); |
2425 goto erret; | 2425 goto erret; |
2426 } | 2426 } |
2427 } | 2427 } |
2428 | 2428 |
2429 fp = (ufunc_T *)alloc_clear((unsigned)(sizeof(ufunc_T) + STRLEN(name))); | 2429 fp = (ufunc_T *)alloc_clear((unsigned)(sizeof(ufunc_T) + STRLEN(name))); |
2874 name = trans_function_name(&p, eap->skip, 0, &fudi, NULL); | 2874 name = trans_function_name(&p, eap->skip, 0, &fudi, NULL); |
2875 vim_free(fudi.fd_newkey); | 2875 vim_free(fudi.fd_newkey); |
2876 if (name == NULL) | 2876 if (name == NULL) |
2877 { | 2877 { |
2878 if (fudi.fd_dict != NULL && !eap->skip) | 2878 if (fudi.fd_dict != NULL && !eap->skip) |
2879 EMSG(_(e_funcref)); | 2879 emsg(_(e_funcref)); |
2880 return; | 2880 return; |
2881 } | 2881 } |
2882 if (!ends_excmd(*skipwhite(p))) | 2882 if (!ends_excmd(*skipwhite(p))) |
2883 { | 2883 { |
2884 vim_free(name); | 2884 vim_free(name); |
2885 EMSG(_(e_trailing)); | 2885 emsg(_(e_trailing)); |
2886 return; | 2886 return; |
2887 } | 2887 } |
2888 eap->nextcmd = check_nextcmd(p); | 2888 eap->nextcmd = check_nextcmd(p); |
2889 if (eap->nextcmd != NULL) | 2889 if (eap->nextcmd != NULL) |
2890 *p = NUL; | 2890 *p = NUL; |
2896 if (!eap->skip) | 2896 if (!eap->skip) |
2897 { | 2897 { |
2898 if (fp == NULL) | 2898 if (fp == NULL) |
2899 { | 2899 { |
2900 if (!eap->forceit) | 2900 if (!eap->forceit) |
2901 EMSG2(_(e_nofunc), eap->arg); | 2901 semsg(_(e_nofunc), eap->arg); |
2902 return; | 2902 return; |
2903 } | 2903 } |
2904 if (fp->uf_calls > 0) | 2904 if (fp->uf_calls > 0) |
2905 { | 2905 { |
2906 EMSG2(_("E131: Cannot delete function %s: It is in use"), eap->arg); | 2906 semsg(_("E131: Cannot delete function %s: It is in use"), eap->arg); |
2907 return; | 2907 return; |
2908 } | 2908 } |
2909 | 2909 |
2910 if (fudi.fd_dict != NULL) | 2910 if (fudi.fd_dict != NULL) |
2911 { | 2911 { |
3030 typval_T rettv; | 3030 typval_T rettv; |
3031 int returning = FALSE; | 3031 int returning = FALSE; |
3032 | 3032 |
3033 if (current_funccal == NULL) | 3033 if (current_funccal == NULL) |
3034 { | 3034 { |
3035 EMSG(_("E133: :return not inside a function")); | 3035 emsg(_("E133: :return not inside a function")); |
3036 return; | 3036 return; |
3037 } | 3037 } |
3038 | 3038 |
3039 if (eap->skip) | 3039 if (eap->skip) |
3040 ++emsg_skip; | 3040 ++emsg_skip; |
3106 | 3106 |
3107 tofree = trans_function_name(&arg, eap->skip, TFN_INT, &fudi, &partial); | 3107 tofree = trans_function_name(&arg, eap->skip, TFN_INT, &fudi, &partial); |
3108 if (fudi.fd_newkey != NULL) | 3108 if (fudi.fd_newkey != NULL) |
3109 { | 3109 { |
3110 /* Still need to give an error message for missing key. */ | 3110 /* Still need to give an error message for missing key. */ |
3111 EMSG2(_(e_dictkey), fudi.fd_newkey); | 3111 semsg(_(e_dictkey), fudi.fd_newkey); |
3112 vim_free(fudi.fd_newkey); | 3112 vim_free(fudi.fd_newkey); |
3113 } | 3113 } |
3114 if (tofree == NULL) | 3114 if (tofree == NULL) |
3115 return; | 3115 return; |
3116 | 3116 |
3131 startarg = skipwhite(arg); | 3131 startarg = skipwhite(arg); |
3132 rettv.v_type = VAR_UNKNOWN; /* clear_tv() uses this */ | 3132 rettv.v_type = VAR_UNKNOWN; /* clear_tv() uses this */ |
3133 | 3133 |
3134 if (*startarg != '(') | 3134 if (*startarg != '(') |
3135 { | 3135 { |
3136 EMSG2(_("E107: Missing parentheses: %s"), eap->arg); | 3136 semsg(_("E107: Missing parentheses: %s"), eap->arg); |
3137 goto end; | 3137 goto end; |
3138 } | 3138 } |
3139 | 3139 |
3140 /* | 3140 /* |
3141 * When skipping, evaluate the function once, to find the end of the | 3141 * When skipping, evaluate the function once, to find the end of the |
3156 { | 3156 { |
3157 if (lnum > curbuf->b_ml.ml_line_count) | 3157 if (lnum > curbuf->b_ml.ml_line_count) |
3158 { | 3158 { |
3159 // If the function deleted lines or switched to another buffer | 3159 // If the function deleted lines or switched to another buffer |
3160 // the line number may become invalid. | 3160 // the line number may become invalid. |
3161 EMSG(_(e_invrange)); | 3161 emsg(_(e_invrange)); |
3162 break; | 3162 break; |
3163 } | 3163 } |
3164 curwin->w_cursor.lnum = lnum; | 3164 curwin->w_cursor.lnum = lnum; |
3165 curwin->w_cursor.col = 0; | 3165 curwin->w_cursor.col = 0; |
3166 #ifdef FEAT_VIRTUALEDIT | 3166 #ifdef FEAT_VIRTUALEDIT |
3203 { | 3203 { |
3204 /* Check for trailing illegal characters and a following command. */ | 3204 /* Check for trailing illegal characters and a following command. */ |
3205 if (!ends_excmd(*arg)) | 3205 if (!ends_excmd(*arg)) |
3206 { | 3206 { |
3207 emsg_severe = TRUE; | 3207 emsg_severe = TRUE; |
3208 EMSG(_(e_trailing)); | 3208 emsg(_(e_trailing)); |
3209 } | 3209 } |
3210 else | 3210 else |
3211 eap->nextcmd = check_nextcmd(arg); | 3211 eap->nextcmd = check_nextcmd(arg); |
3212 } | 3212 } |
3213 | 3213 |
3265 { | 3265 { |
3266 /* Store the value of the pending return. */ | 3266 /* Store the value of the pending return. */ |
3267 if ((cstack->cs_rettv[idx] = alloc_tv()) != NULL) | 3267 if ((cstack->cs_rettv[idx] = alloc_tv()) != NULL) |
3268 *(typval_T *)cstack->cs_rettv[idx] = *(typval_T *)rettv; | 3268 *(typval_T *)cstack->cs_rettv[idx] = *(typval_T *)rettv; |
3269 else | 3269 else |
3270 EMSG(_(e_outofmem)); | 3270 emsg(_(e_outofmem)); |
3271 } | 3271 } |
3272 else | 3272 else |
3273 cstack->cs_rettv[idx] = NULL; | 3273 cstack->cs_rettv[idx] = NULL; |
3274 | 3274 |
3275 if (reanimate) | 3275 if (reanimate) |