# HG changeset patch # User Bram Moolenaar # Date 1547419508 -3600 # Node ID 55ccc2d353bdafdd2293c1fb2f1bcc4ff820c55f # Parent bc9b5261ed012b25d5cf5f0ea4de8336db6e9845 patch 8.1.0743: giving error messages is not flexible commit https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d Author: Bram Moolenaar 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. diff --git a/src/blob.c b/src/blob.c --- a/src/blob.c +++ b/src/blob.c @@ -161,7 +161,7 @@ write_blob(FILE *fd, blob_T *blob) if (fwrite(blob->bv_ga.ga_data, 1, blob->bv_ga.ga_len, fd) < (size_t)blob->bv_ga.ga_len) { - EMSG(_(e_write)); + emsg(_(e_write)); return FAIL; } return OK; diff --git a/src/blowfish.c b/src/blowfish.c --- a/src/blowfish.c +++ b/src/blowfish.c @@ -419,7 +419,7 @@ bf_key_init( keylen = (int)STRLEN(key) / 2; if (keylen == 0) { - IEMSG(_("E831: bf_key_init() called with empty password")); + iemsg(_("E831: bf_key_init() called with empty password")); return; } for (i = 0; i < keylen; i++) @@ -522,7 +522,7 @@ bf_self_test(void) * warning. */ if (ui != 0xffffffffUL || ui + 1 != 0) { err++; - EMSG(_("E820: sizeof(uint32_t) != 4")); + emsg(_("E820: sizeof(uint32_t) != 4")); } if (!bf_check_tables(pax_init, sbx_init, 0x6ffa520a)) @@ -543,7 +543,7 @@ bf_self_test(void) if (memcmp(bk.uc, bf_test_data[i].cryptxt, 8) != 0) { if (err == 0 && memcmp(bk.uc, bf_test_data[i].badcryptxt, 8) == 0) - EMSG(_("E817: Blowfish big/little endian use wrong")); + emsg(_("E817: Blowfish big/little endian use wrong")); err++; } } @@ -669,12 +669,12 @@ blowfish_self_test(void) { if (sha256_self_test() == FAIL) { - EMSG(_("E818: sha256 test failed")); + emsg(_("E818: sha256 test failed")); return FAIL; } if (bf_self_test() == FAIL) { - EMSG(_("E819: Blowfish test failed")); + emsg(_("E819: Blowfish test failed")); return FAIL; } return OK; diff --git a/src/buffer.c b/src/buffer.c --- a/src/buffer.c +++ b/src/buffer.c @@ -162,10 +162,10 @@ open_buffer( */ if (curbuf == NULL) { - EMSG(_("E82: Cannot allocate any buffer, exiting...")); + emsg(_("E82: Cannot allocate any buffer, exiting...")); getout(2); } - EMSG(_("E83: Cannot allocate buffer, using other one...")); + emsg(_("E83: Cannot allocate buffer, using other one...")); enter_buffer(curbuf); #ifdef FEAT_SYN_HL if (old_tw != curbuf->b_p_tw) @@ -396,7 +396,7 @@ buf_hashtab_add(buf_T *buf) { sprintf((char *)buf->b_key, "%x", buf->b_fnum); if (hash_add(&buf_hashtab, buf->b_key) == FAIL) - EMSG(_("E931: Buffer cannot be registered")); + emsg(_("E931: Buffer cannot be registered")); } static void @@ -430,7 +430,7 @@ can_unload_buffer(buf_T *buf) } } if (!can_unload) - EMSG(_("E937: Attempt to delete a buffer that is in use")); + emsg(_("E937: Attempt to delete a buffer that is in use")); return can_unload; } @@ -548,7 +548,7 @@ close_buffer( { /* Autocommands deleted the buffer. */ aucmd_abort: - EMSG(_(e_auabort)); + emsg(_(e_auabort)); return; } --buf->b_locked; @@ -1115,7 +1115,7 @@ handle_swap_exists(bufref_T *old_curbuf) * * Returns error message or NULL */ - char_u * + char * do_bufdel( int command, char_u *arg, /* pointer to extra arguments */ @@ -1126,7 +1126,7 @@ do_bufdel( { int do_current = 0; /* delete current buffer? */ int deleted = 0; /* number of buffers deleted */ - char_u *errormsg = NULL; /* return value */ + char *errormsg = NULL; /* return value */ int bnr; /* buffer number */ char_u *p; @@ -1139,7 +1139,7 @@ do_bufdel( if (addr_count == 2) { if (*arg) /* both range and argument is not allowed */ - return (char_u *)_(e_trailing); + return _(e_trailing); bnr = start_bnr; } else /* addr_count == 1 */ @@ -1197,18 +1197,18 @@ do_bufdel( STRCPY(IObuff, _("E516: No buffers were deleted")); else STRCPY(IObuff, _("E517: No buffers were wiped out")); - errormsg = IObuff; + errormsg = (char *)IObuff; } else if (deleted >= p_report) { if (command == DOBUF_UNLOAD) - smsg((char_u *)NGETTEXT("%d buffer unloaded", + smsg(NGETTEXT("%d buffer unloaded", "%d buffers unloaded", deleted), deleted); else if (command == DOBUF_DEL) - smsg((char_u *)NGETTEXT("%d buffer deleted", + smsg(NGETTEXT("%d buffer deleted", "%d buffers deleted", deleted), deleted); else - smsg((char_u *)NGETTEXT("%d buffer wiped out", + smsg(NGETTEXT("%d buffer wiped out", "%d buffers wiped out", deleted), deleted); } } @@ -1233,7 +1233,7 @@ empty_curbuf( if (action == DOBUF_UNLOAD) { - EMSG(_("E90: Cannot unload last buffer")); + emsg(_("E90: Cannot unload last buffer")); return FAIL; } @@ -1307,7 +1307,7 @@ do_buffer( } if (!bufIsChanged(buf)) { - EMSG(_("E84: No modified buffer found")); + emsg(_("E84: No modified buffer found")); return FAIL; } } @@ -1346,7 +1346,7 @@ do_buffer( if (bp == buf) { /* back where we started, didn't find anything. */ - EMSG(_("E85: There is no listed buffer")); + emsg(_("E85: There is no listed buffer")); return FAIL; } } @@ -1358,12 +1358,12 @@ do_buffer( { /* don't warn when deleting */ if (!unload) - EMSGN(_(e_nobufnr), count); + semsg(_(e_nobufnr), count); } else if (dir == FORWARD) - EMSG(_("E87: Cannot go beyond last buffer")); + emsg(_("E87: Cannot go beyond last buffer")); else - EMSG(_("E88: Cannot go before first buffer")); + emsg(_("E88: Cannot go before first buffer")); return FAIL; } @@ -1407,7 +1407,7 @@ do_buffer( else #endif { - EMSGN(_("E89: No write since last change for buffer %ld (add ! to override)"), + semsg(_("E89: No write since last change for buffer %ld (add ! to override)"), buf->b_fnum); return FAIL; } @@ -1832,10 +1832,10 @@ no_write_message(void) { #ifdef FEAT_TERMINAL if (term_job_running(curbuf->b_term)) - EMSG(_("E948: Job still running (add ! to end the job)")); + emsg(_("E948: Job still running (add ! to end the job)")); else #endif - EMSG(_("E37: No write since last change (add ! to override)")); + emsg(_("E37: No write since last change (add ! to override)")); } void @@ -1843,10 +1843,10 @@ no_write_message_nobang(buf_T *buf UNUSE { #ifdef FEAT_TERMINAL if (term_job_running(buf->b_term)) - EMSG(_("E948: Job still running")); + emsg(_("E948: Job still running")); else #endif - EMSG(_("E37: No write since last change")); + emsg(_("E37: No write since last change")); } /* @@ -2057,7 +2057,7 @@ buflist_new( buf->b_fnum = top_file_num++; if (top_file_num < 0) /* wrap around (may cause duplicates) */ { - EMSG(_("W14: Warning: List of file names overflow")); + emsg(_("W14: Warning: List of file names overflow")); if (emsg_silent == 0) { out_flush(); @@ -2281,9 +2281,9 @@ buflist_getfile( if (buf == NULL) { if ((options & GETF_ALT) && n == 0) - EMSG(_(e_noalt)); + emsg(_(e_noalt)); else - EMSGN(_("E92: Buffer %ld not found"), n); + semsg(_("E92: Buffer %ld not found"), n); return FAIL; } @@ -2568,9 +2568,9 @@ buflist_findpat( } if (match == -2) - EMSG2(_("E93: More than one match for %s"), pattern); + semsg(_("E93: More than one match for %s"), pattern); else if (match < 0) - EMSG2(_("E94: No matching buffer for %s"), pattern); + semsg(_("E94: No matching buffer for %s"), pattern); return match; } @@ -3172,7 +3172,7 @@ setfname( if (obuf->b_ml.ml_mfp != NULL) /* it's loaded, fail */ { if (message) - EMSG(_("E95: Buffer with this name already exists")); + emsg(_("E95: Buffer with this name already exists")); vim_free(ffname); return FAIL; } @@ -3298,7 +3298,7 @@ getaltfname( if (buflist_name_nr(0, &fname, &dummy) == FAIL) { if (errmsg) - EMSG(_(e_noalt)); + emsg(_(e_noalt)); return NULL; } return fname; @@ -5730,7 +5730,7 @@ bt_dontwrite_msg(buf_T *buf) { if (bt_dontwrite(buf)) { - EMSG(_("E382: Cannot write, 'buftype' option is set")); + emsg(_("E382: Cannot write, 'buftype' option is set")); return TRUE; } return FALSE; diff --git a/src/channel.c b/src/channel.c --- a/src/channel.c +++ b/src/channel.c @@ -116,7 +116,7 @@ ch_logfile(char_u *fname, char_u *opt) file = fopen((char *)fname, *opt == 'w' ? "w" : "a"); if (file == NULL) { - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); return; } } @@ -209,8 +209,7 @@ ch_error(channel_T *ch, const char *fmt, #ifdef _WIN32 # undef PERROR -# define PERROR(msg) (void)emsg3((char_u *)"%s: %s", \ - (char_u *)msg, (char_u *)strerror_win32(errno)) +# define PERROR(msg) (void)semsg("%s: %s", msg, strerror_win32(errno)) static char * strerror_win32(int eno) @@ -942,7 +941,7 @@ channel_open_func(typval_T *argvars) if (argvars[1].v_type != VAR_UNKNOWN && (argvars[1].v_type != VAR_DICT || argvars[1].vval.v_dict == NULL)) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return NULL; } @@ -950,7 +949,7 @@ channel_open_func(typval_T *argvars) p = vim_strchr(address, ':'); if (p == NULL) { - EMSG2(_(e_invarg2), address); + semsg(_(e_invarg2), address); return NULL; } *p++ = NUL; @@ -958,7 +957,7 @@ channel_open_func(typval_T *argvars) if (*address == NUL || port <= 0 || *rest != NUL) { p[-1] = ':'; - EMSG2(_(e_invarg2), address); + semsg(_(e_invarg2), address); return NULL; } @@ -971,7 +970,7 @@ channel_open_func(typval_T *argvars) goto theend; if (opt.jo_timeout < 0) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); goto theend; } @@ -1233,7 +1232,7 @@ channel_set_options(channel_T *channel, { buf = buflist_findnr(opt->jo_io_buf[PART_OUT]); if (buf == NULL) - EMSGN(_(e_nobufnr), (long)opt->jo_io_buf[PART_OUT]); + semsg(_(e_nobufnr), (long)opt->jo_io_buf[PART_OUT]); } else { @@ -1251,7 +1250,7 @@ channel_set_options(channel_T *channel, if (!buf->b_p_ma && !channel->ch_part[PART_OUT].ch_nomodifiable) { - EMSG(_(e_modifiable)); + emsg(_(e_modifiable)); } else { @@ -1280,7 +1279,7 @@ channel_set_options(channel_T *channel, { buf = buflist_findnr(opt->jo_io_buf[PART_ERR]); if (buf == NULL) - EMSGN(_(e_nobufnr), (long)opt->jo_io_buf[PART_ERR]); + semsg(_(e_nobufnr), (long)opt->jo_io_buf[PART_ERR]); } else { @@ -1297,7 +1296,7 @@ channel_set_options(channel_T *channel, !opt->jo_modifiable[PART_ERR]; if (!buf->b_p_ma && !channel->ch_part[PART_ERR].ch_nomodifiable) { - EMSG(_(e_modifiable)); + emsg(_(e_modifiable)); } else { @@ -1619,7 +1618,7 @@ invoke_callback(channel_T *channel, char int dummy; if (safe_to_invoke_callback == 0) - IEMSG("INTERNAL: Invoking callback when it is not safe"); + iemsg("INTERNAL: Invoking callback when it is not safe"); argv[0].v_type = VAR_CHANNEL; argv[0].vval.v_channel = channel; @@ -2237,7 +2236,7 @@ channel_exe_cmd(channel_T *channel, ch_p { ch_error(channel, "received command with non-string argument"); if (p_verbose > 2) - EMSG(_("E903: received command with non-string argument")); + emsg(_("E903: received command with non-string argument")); return; } arg = argv[1].vval.v_string; @@ -2289,13 +2288,13 @@ channel_exe_cmd(channel_T *channel, ch_p { ch_error(channel, "last argument for expr/call must be a number"); if (p_verbose > 2) - EMSG(_("E904: last argument for expr/call must be a number")); + emsg(_("E904: last argument for expr/call must be a number")); } else if (is_call && argv[2].v_type != VAR_LIST) { ch_error(channel, "third argument for call must be a list"); if (p_verbose > 2) - EMSG(_("E904: third argument for call must be a list")); + emsg(_("E904: third argument for call must be a list")); } else { @@ -2351,7 +2350,7 @@ channel_exe_cmd(channel_T *channel, ch_p else if (p_verbose > 2) { ch_error(channel, "Received unknown command: %s", (char *)cmd); - EMSG2(_("E905: received unknown command: %s"), cmd); + semsg(_("E905: received unknown command: %s"), cmd); } } @@ -3769,7 +3768,7 @@ channel_send( if (!channel->ch_error && fun != NULL) { ch_error(channel, "%s(): write while not connected", fun); - EMSG2(_("E630: %s(): write while not connected"), fun); + semsg(_("E630: %s(): write while not connected"), fun); } channel->ch_error = TRUE; return FAIL; @@ -3916,7 +3915,7 @@ channel_send( if (!channel->ch_error && fun != NULL) { ch_error(channel, "%s(): write failed", fun); - EMSG2(_("E631: %s(): write failed"), fun); + semsg(_("E631: %s(): write failed"), fun); } channel->ch_error = TRUE; return FAIL; @@ -3964,7 +3963,7 @@ send_common( { if (eval) { - EMSG2(_("E917: Cannot use a callback with %s()"), fun); + semsg(_("E917: Cannot use a callback with %s()"), fun); return NULL; } channel_set_req_callback(channel, *part_read, @@ -4005,7 +4004,7 @@ ch_expr_common(typval_T *argvars, typval ch_mode = channel_get_mode(channel, part_send); if (ch_mode == MODE_RAW || ch_mode == MODE_NL) { - EMSG(_("E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel")); + emsg(_("E912: cannot use ch_evalexpr()/ch_sendexpr() with a raw or nl channel")); return; } @@ -4478,7 +4477,7 @@ handle_mode(typval_T *item, jobopt_T *op *modep = MODE_JSON; else { - EMSG2(_(e_invarg2), val); + semsg(_(e_invarg2), val); return FAIL; } return OK; @@ -4502,7 +4501,7 @@ handle_io(typval_T *item, ch_part_T part opt->jo_io[part] = JIO_OUT; else { - EMSG2(_(e_invarg2), val); + semsg(_(e_invarg2), val); return FAIL; } return OK; @@ -4576,7 +4575,7 @@ get_job_options(typval_T *tv, jobopt_T * return OK; if (tv->v_type != VAR_DICT) { - EMSG(_(e_dictreq)); + emsg(_(e_dictreq)); return FAIL; } dict = tv->vval.v_dict; @@ -4665,12 +4664,12 @@ get_job_options(typval_T *tv, jobopt_T * opt->jo_io_buf[part] = tv_get_number(item); if (opt->jo_io_buf[part] <= 0) { - EMSG3(_(e_invargNval), hi->hi_key, tv_get_string(item)); + semsg(_(e_invargNval), hi->hi_key, tv_get_string(item)); return FAIL; } if (buflist_findnr(opt->jo_io_buf[part]) == NULL) { - EMSGN(_(e_nobufnr), (long)opt->jo_io_buf[part]); + semsg(_(e_nobufnr), (long)opt->jo_io_buf[part]); return FAIL; } } @@ -4714,7 +4713,7 @@ get_job_options(typval_T *tv, jobopt_T * *lp = tv_get_number(item); if (*lp < 0) { - EMSG3(_(e_invargNval), hi->hi_key, tv_get_string(item)); + semsg(_(e_invargNval), hi->hi_key, tv_get_string(item)); return FAIL; } } @@ -4725,7 +4724,7 @@ get_job_options(typval_T *tv, jobopt_T * opt->jo_set |= JO_CHANNEL; if (item->v_type != VAR_CHANNEL) { - EMSG2(_(e_invargval), "channel"); + semsg(_(e_invargval), "channel"); return FAIL; } opt->jo_channel = item->vval.v_channel; @@ -4738,7 +4737,7 @@ get_job_options(typval_T *tv, jobopt_T * opt->jo_callback = get_callback(item, &opt->jo_partial); if (opt->jo_callback == NULL) { - EMSG2(_(e_invargval), "callback"); + semsg(_(e_invargval), "callback"); return FAIL; } } @@ -4750,7 +4749,7 @@ get_job_options(typval_T *tv, jobopt_T * opt->jo_out_cb = get_callback(item, &opt->jo_out_partial); if (opt->jo_out_cb == NULL) { - EMSG2(_(e_invargval), "out_cb"); + semsg(_(e_invargval), "out_cb"); return FAIL; } } @@ -4762,7 +4761,7 @@ get_job_options(typval_T *tv, jobopt_T * opt->jo_err_cb = get_callback(item, &opt->jo_err_partial); if (opt->jo_err_cb == NULL) { - EMSG2(_(e_invargval), "err_cb"); + semsg(_(e_invargval), "err_cb"); return FAIL; } } @@ -4774,7 +4773,7 @@ get_job_options(typval_T *tv, jobopt_T * opt->jo_close_cb = get_callback(item, &opt->jo_close_partial); if (opt->jo_close_cb == NULL) { - EMSG2(_(e_invargval), "close_cb"); + semsg(_(e_invargval), "close_cb"); return FAIL; } } @@ -4787,7 +4786,7 @@ get_job_options(typval_T *tv, jobopt_T * never = TRUE; else if (STRCMP(val, "auto") != 0) { - EMSG3(_(e_invargNval), "drop", val); + semsg(_(e_invargNval), "drop", val); return FAIL; } opt->jo_drop_never = never; @@ -4800,7 +4799,7 @@ get_job_options(typval_T *tv, jobopt_T * opt->jo_exit_cb = get_callback(item, &opt->jo_exit_partial); if (opt->jo_exit_cb == NULL) { - EMSG2(_(e_invargval), "exit_cb"); + semsg(_(e_invargval), "exit_cb"); return FAIL; } } @@ -4813,7 +4812,7 @@ get_job_options(typval_T *tv, jobopt_T * opt->jo_term_name = tv_get_string_chk(item); if (opt->jo_term_name == NULL) { - EMSG2(_(e_invargval), "term_name"); + semsg(_(e_invargval), "term_name"); return FAIL; } } @@ -4824,7 +4823,7 @@ get_job_options(typval_T *tv, jobopt_T * val = tv_get_string(item); if (STRCMP(val, "open") != 0 && STRCMP(val, "close") != 0) { - EMSG3(_(e_invargNval), "term_finish", val); + semsg(_(e_invargNval), "term_finish", val); return FAIL; } opt->jo_set2 |= JO2_TERM_FINISH; @@ -4848,7 +4847,7 @@ get_job_options(typval_T *tv, jobopt_T * } if (p == NULL) { - EMSG2(_(e_invargval), "term_opencmd"); + semsg(_(e_invargval), "term_opencmd"); return FAIL; } } @@ -4862,7 +4861,7 @@ get_job_options(typval_T *tv, jobopt_T * p = opt->jo_eof_chars = tv_get_string_chk(item); if (p == NULL) { - EMSG2(_(e_invargval), "eof_chars"); + semsg(_(e_invargval), "eof_chars"); return FAIL; } } @@ -4928,7 +4927,7 @@ get_job_options(typval_T *tv, jobopt_T * if (item == NULL || item->v_type != VAR_LIST || item->vval.v_list == NULL) { - EMSG2(_(e_invargval), "ansi_colors"); + semsg(_(e_invargval), "ansi_colors"); return FAIL; } @@ -4951,7 +4950,7 @@ get_job_options(typval_T *tv, jobopt_T * if (n != 16 || li != NULL) { - EMSG2(_(e_invargval), "ansi_colors"); + semsg(_(e_invargval), "ansi_colors"); return FAIL; } @@ -4966,7 +4965,7 @@ get_job_options(typval_T *tv, jobopt_T * break; if (item->v_type != VAR_DICT) { - EMSG2(_(e_invargval), "env"); + semsg(_(e_invargval), "env"); return FAIL; } opt->jo_set2 |= JO2_ENV; @@ -4985,7 +4984,7 @@ get_job_options(typval_T *tv, jobopt_T * #endif ) { - EMSG2(_(e_invargval), "cwd"); + semsg(_(e_invargval), "cwd"); return FAIL; } opt->jo_set2 |= JO2_CWD; @@ -5030,7 +5029,7 @@ get_job_options(typval_T *tv, jobopt_T * opt->jo_part = PART_OUT; else { - EMSG3(_(e_invargNval), "part", val); + semsg(_(e_invargNval), "part", val); return FAIL; } } @@ -5050,7 +5049,7 @@ get_job_options(typval_T *tv, jobopt_T * opt->jo_soe_buf); if (opt->jo_stoponexit == NULL) { - EMSG2(_(e_invargval), "stoponexit"); + semsg(_(e_invargval), "stoponexit"); return FAIL; } } @@ -5067,7 +5066,7 @@ get_job_options(typval_T *tv, jobopt_T * } if (todo > 0) { - EMSG2(_(e_invarg2), hi->hi_key); + semsg(_(e_invarg2), hi->hi_key); return FAIL; } @@ -5098,7 +5097,7 @@ get_channel_arg(typval_T *tv, int check_ } else { - EMSG2(_(e_invarg2), tv_get_string(tv)); + semsg(_(e_invarg2), tv_get_string(tv)); return NULL; } if (channel != NULL && reading) @@ -5108,7 +5107,7 @@ get_channel_arg(typval_T *tv, int check_ if (check_open && (channel == NULL || (!channel_is_open(channel) && !(reading && has_readahead)))) { - EMSG(_("E906: not an open channel")); + emsg(_("E906: not an open channel")); return NULL; } return channel; @@ -5662,7 +5661,7 @@ job_start( && (!(opt.jo_set & (JO_OUT_NAME << (part - PART_OUT))) || *opt.jo_io_name[part] == NUL)) { - EMSG(_("E920: _io file requires _name to be set")); + emsg(_("E920: _io file requires _name to be set")); goto theend; } @@ -5675,11 +5674,11 @@ job_start( { buf = buflist_findnr(opt.jo_io_buf[PART_IN]); if (buf == NULL) - EMSGN(_(e_nobufnr), (long)opt.jo_io_buf[PART_IN]); + semsg(_(e_nobufnr), (long)opt.jo_io_buf[PART_IN]); } else if (!(opt.jo_set & JO_IN_NAME)) { - EMSG(_("E915: in_io buffer requires in_buf or in_name to be set")); + emsg(_("E915: in_io buffer requires in_buf or in_name to be set")); } else buf = buflist_find_by_name(opt.jo_io_name[PART_IN], FALSE); @@ -5697,7 +5696,7 @@ job_start( } else s = opt.jo_io_name[PART_IN]; - EMSG2(_("E918: buffer must be loaded: %s"), s); + semsg(_("E918: buffer must be loaded: %s"), s); goto theend; } job->jv_in_buf = buf; @@ -5726,7 +5725,7 @@ job_start( cmd = argvars[0].vval.v_string; if (cmd == NULL || *cmd == NUL) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); goto theend; } @@ -5737,7 +5736,7 @@ job_start( || argvars[0].vval.v_list == NULL || argvars[0].vval.v_list->lv_len < 1) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); goto theend; } else @@ -5898,7 +5897,7 @@ job_stop(job_T *job, typval_T *argvars, arg = tv_get_string_chk(&argvars[1]); if (arg == NULL) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return 0; } } diff --git a/src/crypt.c b/src/crypt.c --- a/src/crypt.c +++ b/src/crypt.c @@ -162,7 +162,7 @@ crypt_method_nr_from_magic(char *ptr, in i = (int)STRLEN(crypt_magic_head); if (len >= i && memcmp(ptr, crypt_magic_head, i) == 0) - EMSG(_("E821: File is encrypted with unknown method")); + emsg(_("E821: File is encrypted with unknown method")); return -1; } diff --git a/src/dict.c b/src/dict.c --- a/src/dict.c +++ b/src/dict.c @@ -644,7 +644,7 @@ dict_get_tv(char_u **arg, typval_T *rett goto failret; if (**arg != ':') { - EMSG2(_("E720: Missing colon in Dictionary: %s"), *arg); + semsg(_("E720: Missing colon in Dictionary: %s"), *arg); clear_tv(&tvkey); goto failret; } @@ -671,7 +671,7 @@ dict_get_tv(char_u **arg, typval_T *rett item = dict_find(d, key, -1); if (item != NULL) { - EMSG2(_("E721: Duplicate key in Dictionary: \"%s\""), key); + semsg(_("E721: Duplicate key in Dictionary: \"%s\""), key); clear_tv(&tvkey); clear_tv(&tv); goto failret; @@ -691,7 +691,7 @@ dict_get_tv(char_u **arg, typval_T *rett break; if (**arg != ',') { - EMSG2(_("E722: Missing comma in Dictionary: %s"), *arg); + semsg(_("E722: Missing comma in Dictionary: %s"), *arg); goto failret; } *arg = skipwhite(*arg + 1); @@ -699,7 +699,7 @@ dict_get_tv(char_u **arg, typval_T *rett if (**arg != '}') { - EMSG2(_("E723: Missing end of Dictionary '}': %s"), *arg); + semsg(_("E723: Missing end of Dictionary '}': %s"), *arg); failret: if (evaluate) dict_free(d); @@ -753,7 +753,7 @@ dict_extend(dict_T *d1, dict_T *d2, char } else if (*action == 'e') { - EMSG2(_("E737: Key already exists: %s"), hi2->hi_key); + semsg(_("E737: Key already exists: %s"), hi2->hi_key); break; } else if (*action == 'f' && HI2DI(hi2) != di1) @@ -835,7 +835,7 @@ dict_list(typval_T *argvars, typval_T *r if (argvars[0].v_type != VAR_DICT) { - EMSG(_(e_dictreq)); + emsg(_(e_dictreq)); return; } if ((d = argvars[0].vval.v_dict) == NULL) diff --git a/src/diff.c b/src/diff.c --- a/src/diff.c +++ b/src/diff.c @@ -173,7 +173,7 @@ diff_buf_add(buf_T *buf) return; } - EMSGN(_("E96: Cannot diff more than %ld buffers"), DB_COUNT); + semsg(_("E96: Cannot diff more than %ld buffers"), DB_COUNT); } /* @@ -724,8 +724,7 @@ diff_write_buffer(buf_T *buf, diffin_T * if (p_verbose > 0) { verbose_enter(); - smsg((char_u *) - _("Not enough memory to use internal diff for buffer \"%s\""), + smsg(_("Not enough memory to use internal diff for buffer \"%s\""), buf->b_fname); verbose_leave(); } @@ -1050,8 +1049,8 @@ check_external_diff(diffio_T *diffio) if (!ok) { if (io_error) - EMSG(_("E810: Cannot read or write temp files")); - EMSG(_("E97: Cannot create diffs")); + emsg(_("E810: Cannot read or write temp files")); + emsg(_("E97: Cannot create diffs")); diff_a_works = MAYBE; #if defined(MSWIN) diff_bin_works = MAYBE; @@ -1093,7 +1092,7 @@ diff_file_internal(diffio_T *diffio) &diffio->dio_new.din_mmfile, ¶m, &emit_cfg, &emit_cb) < 0) { - EMSG(_("E960: Problem creating the internal diff")); + emsg(_("E960: Problem creating the internal diff")); return FAIL; } return OK; @@ -1273,7 +1272,7 @@ ex_diffpatch(exarg_T *eap) if (dirbuf[0] != NUL) { if (mch_chdir((char *)dirbuf) != 0) - EMSG(_(e_prev_dir)); + emsg(_(e_prev_dir)); shorten_fnames(TRUE); } #endif @@ -1291,7 +1290,7 @@ ex_diffpatch(exarg_T *eap) /* Only continue if the output file was created. */ if (mch_stat((char *)tmp_new, &st) < 0 || st.st_size == 0) - EMSG(_("E816: Cannot read patch output")); + emsg(_("E816: Cannot read patch output")); else { if (curbuf->b_fname != NULL) @@ -1596,7 +1595,7 @@ diff_read( fd = mch_fopen((char *)dout->dout_fname, "r"); if (fd == NULL) { - EMSG(_("E98: Cannot read diff output")); + emsg(_("E98: Cannot read diff output")); return; } } @@ -1662,7 +1661,7 @@ diff_read( } else { - EMSG(_("E959: Invalid diff format.")); + emsg(_("E959: Invalid diff format.")); break; } @@ -2572,7 +2571,7 @@ ex_diffgetput(exarg_T *eap) idx_cur = diff_buf_idx(curbuf); if (idx_cur == DB_COUNT) { - EMSG(_("E99: Current buffer is not in diff mode")); + emsg(_("E99: Current buffer is not in diff mode")); return; } @@ -2591,9 +2590,9 @@ ex_diffgetput(exarg_T *eap) if (idx_other == DB_COUNT) { if (found_not_ma) - EMSG(_("E793: No other buffer in diff mode is modifiable")); + emsg(_("E793: No other buffer in diff mode is modifiable")); else - EMSG(_("E100: No other buffer in diff mode")); + emsg(_("E100: No other buffer in diff mode")); return; } @@ -2603,7 +2602,7 @@ ex_diffgetput(exarg_T *eap) && curtab->tp_diffbuf[i] != NULL && (eap->cmdidx != CMD_diffput || curtab->tp_diffbuf[i]->b_p_ma)) { - EMSG(_("E101: More than two buffers in diff mode, don't know which one to use")); + emsg(_("E101: More than two buffers in diff mode, don't know which one to use")); return; } } @@ -2626,7 +2625,7 @@ ex_diffgetput(exarg_T *eap) buf = buflist_findnr(i); if (buf == NULL) { - EMSG2(_("E102: Can't find buffer \"%s\""), eap->arg); + semsg(_("E102: Can't find buffer \"%s\""), eap->arg); return; } if (buf == curbuf) @@ -2634,7 +2633,7 @@ ex_diffgetput(exarg_T *eap) idx_other = diff_buf_idx(buf); if (idx_other == DB_COUNT) { - EMSG2(_("E103: Buffer \"%s\" is not in diff mode"), eap->arg); + semsg(_("E103: Buffer \"%s\" is not in diff mode"), eap->arg); return; } } @@ -2678,7 +2677,7 @@ ex_diffgetput(exarg_T *eap) change_warning(0); if (diff_buf_idx(curbuf) != idx_to) { - EMSG(_("E787: Buffer changed unexpectedly")); + emsg(_("E787: Buffer changed unexpectedly")); goto theend; } } diff --git a/src/digraph.c b/src/digraph.c --- a/src/digraph.c +++ b/src/digraph.c @@ -2218,18 +2218,18 @@ putdigraph(char_u *str) char2 = *str++; if (char2 == 0) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } if (char1 == ESC || char2 == ESC) { - EMSG(_("E104: Escape not allowed in digraph")); + emsg(_("E104: Escape not allowed in digraph")); return; } str = skipwhite(str); if (!VIM_ISDIGIT(*str)) { - EMSG(_(e_number_exp)); + emsg(_(e_number_exp)); return; } n = getdigits(&str); @@ -2446,7 +2446,7 @@ static void keymap_unload(void); * used when setting the option, not later when the value has already been * checked. */ - char_u * + char * keymap_init(void) { curbuf->b_kmap_state &= ~KEYMAP_INIT; @@ -2487,7 +2487,7 @@ keymap_init(void) if (source_runtime(buf, 0) == FAIL) { vim_free(buf); - return (char_u *)N_("E544: Keymap file not found"); + return N_("E544: Keymap file not found"); } } vim_free(buf); @@ -2513,7 +2513,7 @@ ex_loadkeymap(exarg_T *eap) if (!getline_equal(eap->getline, eap->cookie, getsourceline)) { - EMSG(_("E105: Using :loadkeymap not in a sourced file")); + emsg(_("E105: Using :loadkeymap not in a sourced file")); return; } @@ -2552,7 +2552,7 @@ ex_loadkeymap(exarg_T *eap) || *kp->from == NUL || *kp->to == NUL) { if (kp->to != NULL && *kp->to == NUL) - EMSG(_("E791: Empty keymap entry")); + emsg(_("E791: Empty keymap entry")); vim_free(kp->from); vim_free(kp->to); } diff --git a/src/edit.c b/src/edit.c --- a/src/edit.c +++ b/src/edit.c @@ -360,7 +360,7 @@ edit( /* Don't allow inserting in the sandbox. */ if (sandbox != 0) { - EMSG(_(e_sandbox)); + emsg(_(e_sandbox)); return FALSE; } #endif @@ -368,7 +368,7 @@ edit( * caller of getcmdline() may get confused. */ if (textlock != 0) { - EMSG(_(e_secure)); + emsg(_(e_secure)); return FALSE; } @@ -376,7 +376,7 @@ edit( /* Don't allow recursive insert mode when busy with completion. */ if (compl_started || compl_busy || pum_visible()) { - EMSG(_(e_secure)); + emsg(_(e_secure)); return FALSE; } ins_compl_clear(); /* clear stuff for CTRL-X mode */ @@ -476,7 +476,7 @@ edit( if (p_fkmap && p_ri) { beep_flush(); - EMSG(farsi_text_3); /* encoded in Farsi */ + emsg(farsi_text_3); /* encoded in Farsi */ State = INSERT; } else @@ -4262,14 +4262,14 @@ expand_by_function( if (curwin_save != curwin || curbuf_save != curbuf) { - EMSG(_(e_complwin)); + emsg(_(e_complwin)); goto theend; } curwin->w_cursor = pos; /* restore the cursor position */ validate_cursor(); if (!EQUAL_POS(curwin->w_cursor, pos)) { - EMSG(_(e_compldel)); + emsg(_(e_compldel)); goto theend; } @@ -5567,7 +5567,7 @@ ins_complete(int c, int enable_pum) ? curbuf->b_p_cfu : curbuf->b_p_ofu; if (*funcname == NUL) { - EMSG2(_(e_notset), ctrl_x_mode == CTRL_X_FUNCTION + semsg(_(e_notset), ctrl_x_mode == CTRL_X_FUNCTION ? "completefunc" : "omnifunc"); /* restore did_ai, so that adding comment leader works */ did_ai = save_did_ai; @@ -5587,14 +5587,14 @@ ins_complete(int c, int enable_pum) State = save_State; if (curwin_save != curwin || curbuf_save != curbuf) { - EMSG(_(e_complwin)); + emsg(_(e_complwin)); return FAIL; } curwin->w_cursor = pos; /* restore the cursor position */ validate_cursor(); if (!EQUAL_POS(curwin->w_cursor, pos)) { - EMSG(_(e_compldel)); + emsg(_(e_compldel)); return FAIL; } @@ -7678,7 +7678,7 @@ stuff_inserted( ptr = get_last_insert(); if (ptr == NULL) { - EMSG(_(e_noinstext)); + emsg(_(e_noinstext)); return FAIL; } @@ -8969,7 +8969,7 @@ ins_insert(int replaceState) if (p_fkmap && p_ri) { beep_flush(); - EMSG(farsi_text_3); /* encoded in Farsi */ + emsg(farsi_text_3); /* encoded in Farsi */ return; } #endif diff --git a/src/eval.c b/src/eval.c --- a/src/eval.c +++ b/src/eval.c @@ -301,7 +301,7 @@ eval_init(void) p = &vimvars[i]; if (STRLEN(p->vv_name) > 16) { - IEMSG("INTERNAL: name too long, increase size of dictitem16_T"); + iemsg("INTERNAL: name too long, increase size of dictitem16_T"); getout(1); } STRCPY(p->vv_di.di_key, p->vv_name); @@ -448,7 +448,7 @@ var_redir_start(char_u *name, int append /* Catch a bad name early. */ if (!eval_isnamec1(*name)) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return FAIL; } @@ -475,9 +475,9 @@ var_redir_start(char_u *name, int append clear_lval(redir_lval); if (redir_endp != NULL && *redir_endp != NUL) /* Trailing characters are present after the variable name */ - EMSG(_(e_trailing)); + emsg(_(e_trailing)); else - EMSG(_(e_invarg)); + emsg(_(e_invarg)); redir_endp = NULL; /* don't store a value, only cleanup */ var_redir_stop(); return FAIL; @@ -734,7 +734,7 @@ eval_expr_typval(typval_T *expr, typval_ if (*s != NUL) /* check for trailing chars after expr */ { clear_tv(rettv); - EMSG2(_(e_invexpr2), s); + semsg(_(e_invexpr2), s); return FAIL; } } @@ -1202,7 +1202,7 @@ ex_let(exarg_T *eap) * ":let" without "=": list variables */ if (*arg == '[') - EMSG(_(e_invarg)); + emsg(_(e_invarg)); else if (!ends_excmd(*arg)) /* ":let var1 var2" */ arg = list_arg_vars(eap, arg, &first); @@ -1288,19 +1288,19 @@ ex_let_vars( */ if (tv->v_type != VAR_LIST || (l = tv->vval.v_list) == NULL) { - EMSG(_(e_listreq)); + emsg(_(e_listreq)); return FAIL; } i = list_len(l); if (semicolon == 0 && var_count < i) { - EMSG(_("E687: Less targets than List items")); + emsg(_("E687: Less targets than List items")); return FAIL; } if (var_count - semicolon > i) { - EMSG(_("E688: More targets than List items")); + emsg(_("E688: More targets than List items")); return FAIL; } @@ -1374,7 +1374,7 @@ skip_var_list( s = skip_var_one(p); if (s == p) { - EMSG2(_(e_invarg2), p); + semsg(_(e_invarg2), p); return NULL; } ++*var_count; @@ -1386,14 +1386,14 @@ skip_var_list( { if (*semicolon == 1) { - EMSG(_("Double ; in list of variables")); + emsg(_("Double ; in list of variables")); return NULL; } *semicolon = 1; } else if (*p != ',') { - EMSG2(_(e_invarg2), p); + semsg(_(e_invarg2), p); return NULL; } } @@ -1534,7 +1534,7 @@ list_arg_vars(exarg_T *eap, char_u *arg, if (!VIM_ISWHITE(*arg) && !ends_excmd(*arg)) { emsg_severe = TRUE; - EMSG(_(e_trailing)); + emsg(_(e_trailing)); break; } } @@ -1550,7 +1550,7 @@ list_arg_vars(exarg_T *eap, char_u *arg, if (len < 0 && !aborting()) { emsg_severe = TRUE; - EMSG2(_(e_invarg2), arg); + semsg(_(e_invarg2), arg); break; } error = TRUE; @@ -1581,7 +1581,7 @@ list_arg_vars(exarg_T *eap, char_u *arg, case 's': list_script_vars(first); break; case 'l': list_func_vars(first); break; default: - EMSG2(_("E738: Can't list variables for %s"), name); + semsg(_("E738: Can't list variables for %s"), name); } } else @@ -1647,14 +1647,14 @@ ex_let_one( name = arg; len = get_env_len(&arg); if (len == 0) - EMSG2(_(e_invarg2), name - 1); + semsg(_(e_invarg2), name - 1); else { if (op != NULL && (*op == '+' || *op == '-')) - EMSG2(_(e_letwrong), op); + semsg(_(e_letwrong), op); else if (endchars != NULL && vim_strchr(endchars, *skipwhite(arg)) == NULL) - EMSG(_(e_letunexp)); + emsg(_(e_letunexp)); else if (!check_secure()) { c1 = name[len]; @@ -1701,7 +1701,7 @@ ex_let_one( p = find_option_end(&arg, &opt_flags); if (p == NULL || (endchars != NULL && vim_strchr(endchars, *skipwhite(p)) == NULL)) - EMSG(_(e_letunexp)); + emsg(_(e_letunexp)); else { long n; @@ -1722,7 +1722,7 @@ ex_let_one( if ((opt_type == 1 && *op == '.') || (opt_type == 0 && *op != '.')) { - EMSG2(_(e_letwrong), op); + semsg(_(e_letwrong), op); s = NULL; /* don't set the value */ } else @@ -1759,10 +1759,10 @@ ex_let_one( { ++arg; if (op != NULL && (*op == '+' || *op == '-')) - EMSG2(_(e_letwrong), op); + semsg(_(e_letwrong), op); else if (endchars != NULL && vim_strchr(endchars, *skipwhite(arg + 1)) == NULL) - EMSG(_(e_letunexp)); + emsg(_(e_letunexp)); else { char_u *ptofree = NULL; @@ -1799,7 +1799,7 @@ ex_let_one( if (p != NULL && lv.ll_name != NULL) { if (endchars != NULL && vim_strchr(endchars, *skipwhite(p)) == NULL) - EMSG(_(e_letunexp)); + emsg(_(e_letunexp)); else { set_var_lval(&lv, p, tv, copy, op); @@ -1810,7 +1810,7 @@ ex_let_one( } else - EMSG2(_(e_invarg2), arg); + semsg(_(e_invarg2), arg); return arg_end; } @@ -1875,7 +1875,7 @@ get_lval( if (unlet && !VIM_ISWHITE(*p) && !ends_excmd(*p) && *p != '[' && *p != '.') { - EMSG(_(e_trailing)); + emsg(_(e_trailing)); return NULL; } @@ -1888,7 +1888,7 @@ get_lval( if (!aborting() && !quiet) { emsg_severe = TRUE; - EMSG2(_(e_invarg2), name); + semsg(_(e_invarg2), name); return NULL; } } @@ -1908,7 +1908,7 @@ get_lval( v = find_var(lp->ll_name, (flags & GLV_READ_ONLY) ? NULL : &ht, flags & GLV_NO_AUTOLOAD); if (v == NULL && !quiet) - EMSG2(_(e_undefvar), lp->ll_name); + semsg(_(e_undefvar), lp->ll_name); *p = cc; if (v == NULL) return NULL; @@ -1928,13 +1928,13 @@ get_lval( && lp->ll_tv->vval.v_blob != NULL)) { if (!quiet) - EMSG(_("E689: Can only index a List, Dictionary or Blob")); + emsg(_("E689: Can only index a List, Dictionary or Blob")); return NULL; } if (lp->ll_range) { if (!quiet) - EMSG(_("E708: [:] must come last")); + emsg(_("E708: [:] must come last")); return NULL; } @@ -1947,7 +1947,7 @@ get_lval( if (len == 0) { if (!quiet) - EMSG(_(e_emptykey)); + emsg(_(e_emptykey)); return NULL; } p = key + len; @@ -1977,7 +1977,7 @@ get_lval( if (lp->ll_tv->v_type == VAR_DICT) { if (!quiet) - EMSG(_(e_dictrange)); + emsg(_(e_dictrange)); clear_tv(&var1); return NULL; } @@ -1988,7 +1988,7 @@ get_lval( && rettv->vval.v_blob != NULL)) { if (!quiet) - EMSG(_("E709: [:] requires a List or Blob value")); + emsg(_("E709: [:] requires a List or Blob value")); clear_tv(&var1); return NULL; } @@ -2019,7 +2019,7 @@ get_lval( if (*p != ']') { if (!quiet) - EMSG(_(e_missbrac)); + emsg(_(e_missbrac)); clear_tv(&var1); clear_tv(&var2); return NULL; @@ -2075,7 +2075,7 @@ get_lval( /* Can't add "v:" variable. */ if (lp->ll_dict == &vimvardict) { - EMSG2(_(e_illvar), name); + semsg(_(e_illvar), name); return NULL; } @@ -2083,7 +2083,7 @@ get_lval( if (*p == '[' || *p == '.' || unlet) { if (!quiet) - EMSG2(_(e_dictkey), key); + semsg(_(e_dictkey), key); clear_tv(&var1); return NULL; } @@ -2126,7 +2126,7 @@ get_lval( || (lp->ll_range && lp->ll_n1 == bloblen)) { if (!quiet) - EMSGN(_(e_blobidx), lp->ll_n1); + semsg(_(e_blobidx), lp->ll_n1); clear_tv(&var2); return NULL; } @@ -2139,7 +2139,7 @@ get_lval( || lp->ll_n2 < lp->ll_n1) { if (!quiet) - EMSGN(_(e_blobidx), lp->ll_n2); + semsg(_(e_blobidx), lp->ll_n2); return NULL; } } @@ -2173,7 +2173,7 @@ get_lval( { clear_tv(&var2); if (!quiet) - EMSGN(_(e_listidx), lp->ll_n1); + semsg(_(e_listidx), lp->ll_n1); return NULL; } @@ -2194,7 +2194,7 @@ get_lval( if (ni == NULL) { if (!quiet) - EMSGN(_(e_listidx), lp->ll_n2); + semsg(_(e_listidx), lp->ll_n2); return NULL; } lp->ll_n2 = list_idx_of_item(lp->ll_list, ni); @@ -2206,7 +2206,7 @@ get_lval( if (lp->ll_n2 < lp->ll_n1) { if (!quiet) - EMSGN(_(e_listidx), lp->ll_n2); + semsg(_(e_listidx), lp->ll_n2); return NULL; } } @@ -2256,7 +2256,7 @@ set_var_lval( if (op != NULL && *op != '=') { - EMSG2(_(e_letwrong), op); + semsg(_(e_letwrong), op); return; } @@ -2269,7 +2269,7 @@ set_var_lval( if (lp->ll_n2 - lp->ll_n1 + 1 != blob_len(rettv->vval.v_blob)) { - EMSG(_("E972: Blob value does not have the right number of bytes")); + emsg(_("E972: Blob value does not have the right number of bytes")); return; } if (lp->ll_empty2) @@ -2374,11 +2374,11 @@ set_var_lval( ++lp->ll_n1; } if (ri != NULL) - EMSG(_("E710: List value has more items than target")); + emsg(_("E710: List value has more items than target")); else if (lp->ll_empty2 ? (lp->ll_li != NULL && lp->ll_li->li_next != NULL) : lp->ll_n1 != lp->ll_n2) - EMSG(_("E711: List value has not enough items")); + emsg(_("E711: List value has not enough items")); } else { @@ -2389,7 +2389,7 @@ set_var_lval( { if (op != NULL && *op != '=') { - EMSG2(_(e_letwrong), op); + semsg(_(e_letwrong), op); return; } @@ -2544,7 +2544,7 @@ tv_op(typval_T *tv1, typval_T *tv2, char } } - EMSG2(_(e_letwrong), op); + semsg(_(e_letwrong), op); return FAIL; } @@ -2580,7 +2580,7 @@ eval_for_line( expr = skipwhite(expr); if (expr[0] != 'i' || expr[1] != 'n' || !VIM_ISWHITE(expr[2])) { - EMSG(_("E690: Missing \"in\" after :for")); + emsg(_("E690: Missing \"in\" after :for")); return fi; } @@ -2623,7 +2623,7 @@ eval_for_line( } else { - EMSG(_(e_listreq)); + emsg(_(e_listreq)); clear_tv(&tv); } } @@ -2860,7 +2860,7 @@ ex_unletlock( if (get_env_len(&arg) == 0) { - EMSG2(_(e_invarg2), name - 1); + semsg(_(e_invarg2), name - 1); return; } vim_unsetenv(name); @@ -2879,7 +2879,7 @@ ex_unletlock( if (name_end != NULL) { emsg_severe = TRUE; - EMSG(_(e_trailing)); + emsg(_(e_trailing)); } if (!(eap->skip || error)) clear_lval(&lv); @@ -3022,7 +3022,7 @@ do_unlet(char_u *name, int forceit) } if (forceit) return OK; - EMSG2(_("E108: No such variable: \"%s\""), name); + semsg(_("E108: No such variable: \"%s\""), name); return FAIL; } @@ -3059,7 +3059,7 @@ do_lock_var( && di->di_tv.v_type != VAR_LIST) /* For historic reasons this error is not given for a list or dict. * E.g., the b: dict could be locked/unlocked. */ - EMSG2(_("E940: Cannot lock or unlock variable %s"), lp->ll_name); + semsg(_("E940: Cannot lock or unlock variable %s"), lp->ll_name); else { if (lock) @@ -3108,7 +3108,7 @@ item_lock(typval_T *tv, int deep, int lo if (recurse >= DICT_MAXNEST) { - EMSG(_("E743: variable nested too deep for (un)lock")); + emsg(_("E743: variable nested too deep for (un)lock")); return; } if (deep == 0) @@ -3393,7 +3393,7 @@ eval0( */ if (!aborting() && did_emsg == did_emsg_before && called_emsg == called_emsg_before) - EMSG2(_(e_invexpr2), arg); + semsg(_(e_invexpr2), arg); ret = FAIL; } if (nextcmd != NULL) @@ -3451,7 +3451,7 @@ eval1(char_u **arg, typval_T *rettv, int */ if ((*arg)[0] != ':') { - EMSG(_("E109: Missing ':' after '?'")); + emsg(_("E109: Missing ':' after '?'")); if (evaluate && result) clear_tv(rettv); return FAIL; @@ -4058,7 +4058,7 @@ eval6( } else { - EMSG(_("E804: Cannot use '%' with Float")); + emsg(_("E804: Cannot use '%' with Float")); return FAIL; } rettv->v_type = VAR_FLOAT; @@ -4223,7 +4223,7 @@ eval7( { if (blob != NULL) { - EMSG(_("E973: Blob literal should have an even number of hex characters")); + emsg(_("E973: Blob literal should have an even number of hex characters")); ga_clear(&blob->bv_ga); VIM_CLEAR(blob); } @@ -4314,7 +4314,7 @@ eval7( ++*arg; else if (ret == OK) { - EMSG(_("E110: Missing ')'")); + emsg(_("E110: Missing ')'")); clear_tv(rettv); ret = FAIL; } @@ -4488,19 +4488,19 @@ eval_index( case VAR_FUNC: case VAR_PARTIAL: if (verbose) - EMSG(_("E695: Cannot index a Funcref")); + emsg(_("E695: Cannot index a Funcref")); return FAIL; case VAR_FLOAT: #ifdef FEAT_FLOAT if (verbose) - EMSG(_(e_float_as_string)); + emsg(_(e_float_as_string)); return FAIL; #endif case VAR_SPECIAL: case VAR_JOB: case VAR_CHANNEL: if (verbose) - EMSG(_("E909: Cannot index a special variable")); + emsg(_("E909: Cannot index a special variable")); return FAIL; case VAR_UNKNOWN: if (evaluate) @@ -4577,7 +4577,7 @@ eval_index( if (**arg != ']') { if (verbose) - EMSG(_(e_missbrac)); + emsg(_(e_missbrac)); clear_tv(&var1); if (range) clear_tv(&var2); @@ -4711,7 +4711,7 @@ eval_index( rettv->vval.v_number = v; } else - EMSGN(_(e_blobidx), n1); + semsg(_(e_blobidx), n1); } break; @@ -4726,7 +4726,7 @@ eval_index( if (!range) { if (verbose) - EMSGN(_(e_listidx), n1); + semsg(_(e_listidx), n1); return FAIL; } n1 = len; @@ -4770,7 +4770,7 @@ eval_index( if (range) { if (verbose) - EMSG(_(e_dictrange)); + emsg(_(e_dictrange)); if (len == -1) clear_tv(&var1); return FAIL; @@ -4791,7 +4791,7 @@ eval_index( item = dict_find(rettv->vval.v_dict, key, (int)len); if (item == NULL && verbose) - EMSG2(_(e_dictkey), key); + semsg(_(e_dictkey), key); if (len == -1) clear_tv(&var1); if (item == NULL) @@ -4836,7 +4836,7 @@ get_option_tv( if (option_end == NULL) { if (rettv != NULL) - EMSG2(_("E112: Option name missing: %s"), *arg); + semsg(_("E112: Option name missing: %s"), *arg); return FAIL; } @@ -4854,7 +4854,7 @@ get_option_tv( if (opt_type == -3) /* invalid name */ { if (rettv != NULL) - EMSG2(_("E113: Unknown option: %s"), *arg); + semsg(_("E113: Unknown option: %s"), *arg); ret = FAIL; } else if (rettv != NULL) @@ -4917,7 +4917,7 @@ get_string_tv(char_u **arg, typval_T *re if (*p != '"') { - EMSG2(_("E114: Missing quote: %s"), *arg); + semsg(_("E114: Missing quote: %s"), *arg); return FAIL; } @@ -5054,7 +5054,7 @@ get_lit_string_tv(char_u **arg, typval_T if (*p != '\'') { - EMSG2(_("E115: Missing quote: %s"), *arg); + semsg(_("E115: Missing quote: %s"), *arg); return FAIL; } @@ -5798,7 +5798,7 @@ echo_string_core( * flooding the user with errors. And stop iterating over lists * and dicts. */ did_echo_string_emsg = TRUE; - EMSG(_("E724: variable nested too deep for displaying")); + emsg(_("E724: variable nested too deep for displaying")); } *tofree = NULL; return (char_u *)"{E724}"; @@ -6439,7 +6439,7 @@ get_name_len( // Only give an error when there is something, otherwise it will be // reported at a higher level. if (len == 0 && verbose && **arg != NUL) - EMSG2(_(e_invexpr2), *arg); + semsg(_(e_invexpr2), *arg); return len; } @@ -6937,7 +6937,7 @@ get_var_tv( if (tv == NULL) { if (rettv != NULL && verbose) - EMSG2(_(e_undefvar), name); + semsg(_(e_undefvar), name); ret = FAIL; } else if (rettv != NULL) @@ -7251,12 +7251,12 @@ tv_get_number_chk(typval_T *varp, int *d return varp->vval.v_number; case VAR_FLOAT: #ifdef FEAT_FLOAT - EMSG(_("E805: Using a Float as a Number")); + emsg(_("E805: Using a Float as a Number")); break; #endif case VAR_FUNC: case VAR_PARTIAL: - EMSG(_("E703: Using a Funcref as a Number")); + emsg(_("E703: Using a Funcref as a Number")); break; case VAR_STRING: if (varp->vval.v_string != NULL) @@ -7264,26 +7264,26 @@ tv_get_number_chk(typval_T *varp, int *d STR2NR_ALL, &n, NULL, 0); return n; case VAR_LIST: - EMSG(_("E745: Using a List as a Number")); + emsg(_("E745: Using a List as a Number")); break; case VAR_DICT: - EMSG(_("E728: Using a Dictionary as a Number")); + emsg(_("E728: Using a Dictionary as a Number")); break; case VAR_SPECIAL: return varp->vval.v_number == VVAL_TRUE ? 1 : 0; break; case VAR_JOB: #ifdef FEAT_JOB_CHANNEL - EMSG(_("E910: Using a Job as a Number")); + emsg(_("E910: Using a Job as a Number")); break; #endif case VAR_CHANNEL: #ifdef FEAT_JOB_CHANNEL - EMSG(_("E913: Using a Channel as a Number")); + emsg(_("E913: Using a Channel as a Number")); break; #endif case VAR_BLOB: - EMSG(_("E974: Using a Blob as a Number")); + emsg(_("E974: Using a Blob as a Number")); break; case VAR_UNKNOWN: internal_error("tv_get_number(UNKNOWN)"); @@ -7308,32 +7308,32 @@ tv_get_float(typval_T *varp) return varp->vval.v_float; case VAR_FUNC: case VAR_PARTIAL: - EMSG(_("E891: Using a Funcref as a Float")); + emsg(_("E891: Using a Funcref as a Float")); break; case VAR_STRING: - EMSG(_("E892: Using a String as a Float")); + emsg(_("E892: Using a String as a Float")); break; case VAR_LIST: - EMSG(_("E893: Using a List as a Float")); + emsg(_("E893: Using a List as a Float")); break; case VAR_DICT: - EMSG(_("E894: Using a Dictionary as a Float")); + emsg(_("E894: Using a Dictionary as a Float")); break; case VAR_SPECIAL: - EMSG(_("E907: Using a special value as a Float")); + emsg(_("E907: Using a special value as a Float")); break; case VAR_JOB: # ifdef FEAT_JOB_CHANNEL - EMSG(_("E911: Using a Job as a Float")); + emsg(_("E911: Using a Job as a Float")); break; # endif case VAR_CHANNEL: # ifdef FEAT_JOB_CHANNEL - EMSG(_("E914: Using a Channel as a Float")); + emsg(_("E914: Using a Channel as a Float")); break; # endif case VAR_BLOB: - EMSG(_("E975: Using a Blob as a Float")); + emsg(_("E975: Using a Blob as a Float")); break; case VAR_UNKNOWN: internal_error("tv_get_float(UNKNOWN)"); @@ -7391,17 +7391,17 @@ tv_get_string_buf_chk(typval_T *varp, ch return buf; case VAR_FUNC: case VAR_PARTIAL: - EMSG(_("E729: using Funcref as a String")); + emsg(_("E729: using Funcref as a String")); break; case VAR_LIST: - EMSG(_("E730: using List as a String")); + emsg(_("E730: using List as a String")); break; case VAR_DICT: - EMSG(_("E731: using Dictionary as a String")); + emsg(_("E731: using Dictionary as a String")); break; case VAR_FLOAT: #ifdef FEAT_FLOAT - EMSG(_(e_float_as_string)); + emsg(_(e_float_as_string)); break; #endif case VAR_STRING: @@ -7412,7 +7412,7 @@ tv_get_string_buf_chk(typval_T *varp, ch STRCPY(buf, get_var_special_name(varp->vval.v_number)); return buf; case VAR_BLOB: - EMSG(_("E976: using Blob as a String")); + emsg(_("E976: using Blob as a String")); break; case VAR_JOB: #ifdef FEAT_JOB_CHANNEL @@ -7457,7 +7457,7 @@ tv_get_string_buf_chk(typval_T *varp, ch #endif break; case VAR_UNKNOWN: - EMSG(_("E908: using an invalid value as a String")); + emsg(_("E908: using an invalid value as a String")); break; } return NULL; @@ -7839,7 +7839,7 @@ set_var( ht = find_var_ht(name, &varname); if (ht == NULL || *varname == NUL) { - EMSG2(_(e_illvar), name); + semsg(_(e_illvar), name); return; } v = find_var_in_ht(ht, 0, varname, TRUE); @@ -7894,7 +7894,7 @@ set_var( } else if (v->di_tv.v_type != tv->v_type) { - EMSG2(_("E963: setting %s to value with wrong type"), name); + semsg(_("E963: setting %s to value with wrong type"), name); return; } } @@ -7906,7 +7906,7 @@ set_var( /* Can't add "v:" variable. */ if (ht == &vimvarht) { - EMSG2(_(e_illvar), name); + semsg(_(e_illvar), name); return; } @@ -7946,12 +7946,12 @@ var_check_ro(int flags, char_u *name, in { if (flags & DI_FLAGS_RO) { - EMSG2(_(e_readonlyvar), use_gettext ? (char_u *)_(name) : name); + semsg(_(e_readonlyvar), use_gettext ? (char_u *)_(name) : name); return TRUE; } if ((flags & DI_FLAGS_RO_SBX) && sandbox) { - EMSG2(_(e_readonlysbx), use_gettext ? (char_u *)_(name) : name); + semsg(_(e_readonlysbx), use_gettext ? (char_u *)_(name) : name); return TRUE; } return FALSE; @@ -7966,7 +7966,7 @@ var_check_fixed(int flags, char_u *name, { if (flags & DI_FLAGS_FIX) { - EMSG2(_("E795: Cannot delete variable %s"), + semsg(_("E795: Cannot delete variable %s"), use_gettext ? (char_u *)_(name) : name); return TRUE; } @@ -7987,7 +7987,7 @@ var_check_func_name( && !ASCII_ISUPPER((name[0] != NUL && name[1] == ':') ? name[2] : name[0])) { - EMSG2(_("E704: Funcref variable name must start with a capital: %s"), + semsg(_("E704: Funcref variable name must start with a capital: %s"), name); return TRUE; } @@ -7996,7 +7996,7 @@ var_check_func_name( * below. */ if (new_var && function_exists(name, FALSE)) { - EMSG2(_("E705: Variable name conflicts with existing function: %s"), + semsg(_("E705: Variable name conflicts with existing function: %s"), name); return TRUE; } @@ -8016,7 +8016,7 @@ valid_varname(char_u *varname) if (!eval_isnamec1(*p) && (p == varname || !VIM_ISDIGIT(*p)) && *p != AUTOLOAD_CHAR) { - EMSG2(_(e_illvar), varname); + semsg(_(e_illvar), varname); return FALSE; } return TRUE; @@ -8032,7 +8032,7 @@ tv_check_lock(int lock, char_u *name, in { if (lock & VAR_LOCKED) { - EMSG2(_("E741: Value is locked: %s"), + semsg(_("E741: Value is locked: %s"), name == NULL ? (char_u *)_("Unknown") : use_gettext ? (char_u *)_(name) : name); @@ -8040,7 +8040,7 @@ tv_check_lock(int lock, char_u *name, in } if (lock & VAR_FIXED) { - EMSG2(_("E742: Cannot change value of %s"), + semsg(_("E742: Cannot change value of %s"), name == NULL ? (char_u *)_("Unknown") : use_gettext ? (char_u *)_(name) : name); @@ -8158,7 +8158,7 @@ item_copy( if (recurse >= DICT_MAXNEST) { - EMSG(_("E698: variable nested too deep for making a copy")); + emsg(_("E698: variable nested too deep for making a copy")); return FAIL; } ++recurse; @@ -8358,7 +8358,7 @@ ex_echo(exarg_T *eap) */ if (!aborting() && did_emsg == did_emsg_before && called_emsg == called_emsg_before) - EMSG2(_(e_invexpr2), p); + semsg(_(e_invexpr2), p); need_clr_eos = FALSE; break; } @@ -8472,7 +8472,7 @@ ex_execute(exarg_T *eap) * exception. */ if (!aborting() && did_emsg == save_did_emsg) - EMSG2(_(e_invexpr2), p); + semsg(_(e_invexpr2), p); ret = FAIL; break; } @@ -8521,7 +8521,7 @@ ex_execute(exarg_T *eap) { /* We don't want to abort following commands, restore did_emsg. */ save_did_emsg = did_emsg; - EMSG((char_u *)ga.ga_data); + emsg(ga.ga_data); if (!force_abort) did_emsg = save_did_emsg; } @@ -9286,7 +9286,7 @@ assert_match_common(typval_T *argvars, a char_u *text = tv_get_string_buf_chk(&argvars[1], buf2); if (pat == NULL || text == NULL) - EMSG(_(e_invarg)); + emsg(_(e_invarg)); else if (pattern_match(pat, text, FALSE) != (atype == ASSERT_MATCH)) { prepare_assert_error(&ga); @@ -9602,9 +9602,9 @@ typval_compare( || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) { if (typ1->v_type != typ2->v_type) - EMSG(_("E977: Can only compare Blob with Blob")); + emsg(_("E977: Can only compare Blob with Blob")); else - EMSG(_(e_invalblob)); + emsg(_(e_invalblob)); clear_tv(typ1); return FAIL; } @@ -9629,9 +9629,9 @@ typval_compare( || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) { if (typ1->v_type != typ2->v_type) - EMSG(_("E691: Can only compare List with List")); + emsg(_("E691: Can only compare List with List")); else - EMSG(_("E692: Invalid operation for List")); + emsg(_("E692: Invalid operation for List")); clear_tv(typ1); return FAIL; } @@ -9658,9 +9658,9 @@ typval_compare( || (type != TYPE_EQUAL && type != TYPE_NEQUAL)) { if (typ1->v_type != typ2->v_type) - EMSG(_("E735: Can only compare Dictionary with Dictionary")); + emsg(_("E735: Can only compare Dictionary with Dictionary")); else - EMSG(_("E736: Invalid operation for Dictionary")); + emsg(_("E736: Invalid operation for Dictionary")); clear_tv(typ1); return FAIL; } @@ -9679,7 +9679,7 @@ typval_compare( { if (type != TYPE_EQUAL && type != TYPE_NEQUAL) { - EMSG(_("E694: Invalid operation for Funcrefs")); + emsg(_("E694: Invalid operation for Funcrefs")); clear_tv(typ1); return FAIL; } @@ -10672,7 +10672,7 @@ filter_map(typval_T *argvars, typval_T * } else { - EMSG2(_(e_listdictarg), ermsg); + semsg(_(e_listdictarg), ermsg); return; } @@ -10740,7 +10740,7 @@ filter_map(typval_T *argvars, typval_T * break; if (tv.v_type != VAR_NUMBER) { - EMSG(_(e_invalblob)); + emsg(_(e_invalblob)); return; } tv.v_type = VAR_NUMBER; diff --git a/src/evalfunc.c b/src/evalfunc.c --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -1188,7 +1188,7 @@ get_float_arg(typval_T *argvars, float_T *f = (float_T)argvars[0].vval.v_number; return OK; } - EMSG(_("E808: Number or Float required")); + emsg(_("E808: Number or Float required")); return FAIL; } @@ -1269,7 +1269,7 @@ f_add(typval_T *argvars, typval_T *rettv } } else - EMSG(_(e_listreq)); + emsg(_(e_listreq)); } /* @@ -1954,7 +1954,7 @@ get_buf_arg(typval_T *arg) buf = tv_get_buf(arg, FALSE); --emsg_off; if (buf == NULL) - EMSG2(_("E158: Invalid buffer name: %s"), tv_get_string(arg)); + semsg(_("E158: Invalid buffer name: %s"), tv_get_string(arg)); return buf; } #endif @@ -2130,7 +2130,7 @@ f_call(typval_T *argvars, typval_T *rett if (argvars[1].v_type != VAR_LIST) { - EMSG(_(e_listreq)); + emsg(_(e_listreq)); return; } if (argvars[1].vval.v_list == NULL) @@ -2152,7 +2152,7 @@ f_call(typval_T *argvars, typval_T *rett { if (argvars[2].v_type != VAR_DICT) { - EMSG(_(e_dictreq)); + emsg(_(e_dictreq)); return; } selfdict = argvars[2].vval.v_dict; @@ -2563,7 +2563,7 @@ f_complete(typval_T *argvars, typval_T * if ((State & INSERT) == 0) { - EMSG(_("E785: complete() can only be used in Insert mode")); + emsg(_("E785: complete() can only be used in Insert mode")); return; } @@ -2574,7 +2574,7 @@ f_complete(typval_T *argvars, typval_T * if (argvars[1].v_type != VAR_LIST || argvars[1].vval.v_list == NULL) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } @@ -2770,7 +2770,7 @@ f_count(typval_T *argvars, typval_T *ret { li = list_find(l, idx); if (li == NULL) - EMSGN(_(e_listidx), idx); + semsg(_(e_listidx), idx); } } if (error) @@ -2793,7 +2793,7 @@ f_count(typval_T *argvars, typval_T *ret if (argvars[2].v_type != VAR_UNKNOWN) { if (argvars[3].v_type != VAR_UNKNOWN) - EMSG(_(e_invarg)); + emsg(_(e_invarg)); } todo = error ? 0 : (int)d->dv_hashtab.ht_used; @@ -2809,7 +2809,7 @@ f_count(typval_T *argvars, typval_T *ret } } else - EMSG2(_(e_listdictarg), "count()"); + semsg(_(e_listdictarg), "count()"); rettv->vval.v_number = n; } @@ -2864,7 +2864,7 @@ f_cursor(typval_T *argvars, typval_T *re if (list2fpos(argvars, &pos, NULL, &curswant) == FAIL) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } line = pos.lnum; @@ -2925,7 +2925,7 @@ f_debugbreak(typval_T *argvars, typval_T rettv->vval.v_number = FAIL; pid = (int)tv_get_number(&argvars[0]); if (pid == 0) - EMSG(_(e_invarg)); + emsg(_(e_invarg)); else { HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid); @@ -2952,7 +2952,7 @@ f_deepcopy(typval_T *argvars, typval_T * if (argvars[1].v_type != VAR_UNKNOWN) noref = (int)tv_get_number_chk(&argvars[1], NULL); if (noref < 0 || noref > 1) - EMSG(_(e_invarg)); + emsg(_(e_invarg)); else { copyID = get_copyID(); @@ -2977,7 +2977,7 @@ f_delete(typval_T *argvars, typval_T *re name = tv_get_string(&argvars[0]); if (name == NULL || *name == NUL) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } @@ -2996,7 +2996,7 @@ f_delete(typval_T *argvars, typval_T *re /* delete a directory recursively */ rettv->vval.v_number = delete_recursive(name); else - EMSG2(_(e_invexpr2), flags); + semsg(_(e_invexpr2), flags); } /* @@ -3255,13 +3255,13 @@ f_eval(typval_T *argvars, typval_T *rett if (s == NULL || eval1(&s, rettv, TRUE) == FAIL) { if (p != NULL && !aborting()) - EMSG2(_(e_invexpr2), p); + semsg(_(e_invexpr2), p); need_clr_eos = FALSE; rettv->v_type = VAR_NUMBER; rettv->vval.v_number = 0; } else if (*s != NUL) - EMSG(_(e_trailing)); + emsg(_(e_trailing)); } /* @@ -3528,7 +3528,7 @@ f_expand(typval_T *argvars, typval_T *re { char_u *s; int len; - char_u *errormsg; + char *errormsg; int options = WILD_SILENT|WILD_USE_NL|WILD_LIST_NOTFOUND; expand_T xpc; int error = FALSE; @@ -3624,7 +3624,7 @@ f_extend(typval_T *argvars, typval_T *re item = list_find(l1, before); if (item == NULL) { - EMSGN(_(e_listidx), before); + semsg(_(e_listidx), before); return; } } @@ -3660,7 +3660,7 @@ f_extend(typval_T *argvars, typval_T *re break; if (i == 3) { - EMSG2(_(e_invarg2), action); + semsg(_(e_invarg2), action); return; } } @@ -3673,7 +3673,7 @@ f_extend(typval_T *argvars, typval_T *re } } else - EMSG2(_(e_listdictarg), "extend()"); + semsg(_(e_listdictarg), "extend()"); } /* @@ -4197,12 +4197,12 @@ common_function(typval_T *argvars, typva if (s == NULL || *s == NUL || (use_string && VIM_ISDIGIT(*s)) || (is_funcref && trans_name == NULL)) - EMSG2(_(e_invarg2), use_string ? tv_get_string(&argvars[0]) : s); + semsg(_(e_invarg2), use_string ? tv_get_string(&argvars[0]) : s); /* Don't check an autoload name for existence here. */ else if (trans_name != NULL && (is_funcref ? find_func(trans_name) == NULL : !translated_function_exists(trans_name))) - EMSG2(_("E700: Unknown function: %s"), s); + semsg(_("E700: Unknown function: %s"), s); else { int dict_idx = 0; @@ -4247,7 +4247,7 @@ common_function(typval_T *argvars, typva { if (argvars[dict_idx].v_type != VAR_DICT) { - EMSG(_("E922: expected a dict")); + emsg(_("E922: expected a dict")); vim_free(name); goto theend; } @@ -4258,7 +4258,7 @@ common_function(typval_T *argvars, typva { if (argvars[arg_idx].v_type != VAR_LIST) { - EMSG(_("E923: Second argument of function() must be a list or a dict")); + emsg(_("E923: Second argument of function() must be a list or a dict")); vim_free(name); goto theend; } @@ -4409,7 +4409,7 @@ f_get(typval_T *argvars, typval_T *rettv { rettv->v_type = VAR_NUMBER; if (idx >= blob_len(argvars[0].vval.v_blob)) - EMSGN(_(e_blobidx), idx); + semsg(_(e_blobidx), idx); else rettv->vval.v_number = blob_get(argvars[0].vval.v_blob, idx); } @@ -4480,12 +4480,12 @@ f_get(typval_T *argvars, typval_T *rettv } } else - EMSG2(_(e_invarg2), what); + semsg(_(e_invarg2), what); return; } } else - EMSG2(_(e_listdictarg), "get()"); + semsg(_(e_listdictarg), "get()"); if (tv == NULL) { @@ -5029,9 +5029,9 @@ f_getcompletion(typval_T *argvars, typva if (xpc.xp_context == EXPAND_NOTHING) { if (argvars[1].v_type == VAR_STRING) - EMSG2(_(e_invarg2), argvars[1].vval.v_string); - else - EMSG(_(e_invarg)); + semsg(_(e_invarg2), argvars[1].vval.v_string); + else + emsg(_(e_invarg)); return; } @@ -5363,7 +5363,7 @@ get_qf_loc_list(int is_qf, win_T *wp, ty qf_get_properties(wp, d, rettv->vval.v_dict); } else - EMSG(_(e_dictreq)); + emsg(_(e_dictreq)); } } } @@ -6765,7 +6765,7 @@ f_has_key(typval_T *argvars, typval_T *r { if (argvars[0].v_type != VAR_DICT) { - EMSG(_(e_dictreq)); + emsg(_(e_dictreq)); return; } if (argvars[0].vval.v_dict == NULL) @@ -7055,7 +7055,7 @@ f_index(typval_T *argvars, typval_T *ret } else if (argvars[0].v_type != VAR_LIST) { - EMSG(_(e_listreq)); + emsg(_(e_listreq)); return; } @@ -7155,7 +7155,7 @@ f_inputlist(typval_T *argvars, typval_T #endif if (argvars[0].v_type != VAR_LIST || argvars[0].vval.v_list == NULL) { - EMSG2(_(e_listarg), "inputlist()"); + semsg(_(e_listarg), "inputlist()"); return; } @@ -7256,7 +7256,7 @@ f_insert(typval_T *argvars, typval_T *re return; // type error; errmsg already given if (before < 0 || before > len) { - EMSG2(_(e_invarg2), tv_get_string(&argvars[2])); + semsg(_(e_invarg2), tv_get_string(&argvars[2])); return; } } @@ -7265,7 +7265,7 @@ f_insert(typval_T *argvars, typval_T *re return; if (val < 0 || val > 255) { - EMSG2(_(e_invarg2), tv_get_string(&argvars[1])); + semsg(_(e_invarg2), tv_get_string(&argvars[1])); return; } @@ -7279,7 +7279,7 @@ f_insert(typval_T *argvars, typval_T *re copy_tv(&argvars[0], rettv); } else if (argvars[0].v_type != VAR_LIST) - EMSG2(_(e_listarg), "insert()"); + semsg(_(e_listarg), "insert()"); else if ((l = argvars[0].vval.v_list) != NULL && !tv_check_lock(l->lv_lock, (char_u *)N_("insert() argument"), TRUE)) { @@ -7295,7 +7295,7 @@ f_insert(typval_T *argvars, typval_T *re item = list_find(l, before); if (item == NULL) { - EMSGN(_(e_listidx), before); + semsg(_(e_listidx), before); l = NULL; } } @@ -7357,7 +7357,7 @@ f_islocked(typval_T *argvars, typval_T * if (end != NULL && lv.ll_name != NULL) { if (*end != NUL) - EMSG(_(e_trailing)); + emsg(_(e_trailing)); else { if (lv.ll_tv == NULL) @@ -7375,9 +7375,9 @@ f_islocked(typval_T *argvars, typval_T * } } else if (lv.ll_range) - EMSG(_("E786: Range not allowed")); + emsg(_("E786: Range not allowed")); else if (lv.ll_newkey != NULL) - EMSG2(_(e_dictkey), lv.ll_newkey); + semsg(_(e_dictkey), lv.ll_newkey); else if (lv.ll_list != NULL) /* List item. */ rettv->vval.v_number = tv_islocked(&lv.ll_li->li_tv); @@ -7423,13 +7423,13 @@ get_job_arg(typval_T *tv) if (tv->v_type != VAR_JOB) { - EMSG2(_(e_invarg2), tv_get_string(tv)); + semsg(_(e_invarg2), tv_get_string(tv)); return NULL; } job = tv->vval.v_job; if (job == NULL) - EMSG(_("E916: not a valid job")); + emsg(_("E916: not a valid job")); return job; } @@ -7535,7 +7535,7 @@ f_join(typval_T *argvars, typval_T *rett if (argvars[0].v_type != VAR_LIST) { - EMSG(_(e_listreq)); + emsg(_(e_listreq)); return; } if (argvars[0].vval.v_list == NULL) @@ -7570,7 +7570,7 @@ f_js_decode(typval_T *argvars, typval_T reader.js_fill = NULL; reader.js_used = 0; if (json_decode_all(&reader, rettv, JSON_JS) != OK) - EMSG(_(e_invarg)); + emsg(_(e_invarg)); } /* @@ -7661,7 +7661,7 @@ f_len(typval_T *argvars, typval_T *rettv case VAR_PARTIAL: case VAR_JOB: case VAR_CHANNEL: - EMSG(_("E701: Invalid type for len()")); + emsg(_("E701: Invalid type for len()")); break; } } @@ -8199,7 +8199,7 @@ matchadd_dict_arg(typval_T *tv, char_u * if (tv->v_type != VAR_DICT) { - EMSG(_(e_dictreq)); + emsg(_(e_dictreq)); return FAIL; } @@ -8212,7 +8212,7 @@ matchadd_dict_arg(typval_T *tv, char_u * *win = find_win_by_nr_or_id(&di->di_tv); if (*win == NULL) { - EMSG(_("E957: Invalid window number")); + emsg(_("E957: Invalid window number")); return FAIL; } } @@ -8256,7 +8256,7 @@ f_matchadd(typval_T *argvars UNUSED, typ return; if (id >= 1 && id <= 3) { - EMSGN(_("E798: ID is reserved for \":match\": %ld"), id); + semsg(_("E798: ID is reserved for \":match\": %ld"), id); return; } @@ -8289,7 +8289,7 @@ f_matchaddpos(typval_T *argvars UNUSED, if (argvars[1].v_type != VAR_LIST) { - EMSG2(_(e_listarg), "matchaddpos()"); + semsg(_(e_listarg), "matchaddpos()"); return; } l = argvars[1].vval.v_list; @@ -8314,7 +8314,7 @@ f_matchaddpos(typval_T *argvars UNUSED, /* id == 3 is ok because matchaddpos() is supposed to substitute :3match */ if (id == 1 || id == 2) { - EMSGN(_("E798: ID is reserved for \":match\": %ld"), id); + semsg(_("E798: ID is reserved for \":match\": %ld"), id); return; } @@ -8461,7 +8461,7 @@ max_min(typval_T *argvars, typval_T *ret } } else - EMSG2(_(e_listdictarg), domax ? "max()" : "min()"); + semsg(_(e_listdictarg), domax ? "max()" : "min()"); rettv->vval.v_number = error ? 0 : n; } @@ -9027,9 +9027,9 @@ f_range(typval_T *argvars, typval_T *ret if (error) return; /* type error; errmsg already given */ if (stride == 0) - EMSG(_("E726: Stride is zero")); + emsg(_("E726: Stride is zero")); else if (stride > 0 ? end + 1 < start : end - 1 > start) - EMSG(_("E727: Start past end")); + emsg(_("E727: Start past end")); else { if (rettv_list_alloc(rettv) == OK) @@ -9089,7 +9089,7 @@ f_readfile(typval_T *argvars, typval_T * fname = tv_get_string(&argvars[0]); if (*fname == NUL || (fd = mch_fopen((char *)fname, READBIN)) == NULL) { - EMSG2(_(e_notopen), *fname == NUL ? (char_u *)_("") : fname); + semsg(_(e_notopen), *fname == NUL ? (char_u *)_("") : fname); return; } @@ -9097,7 +9097,7 @@ f_readfile(typval_T *argvars, typval_T * { if (read_blob(fd, rettv->vval.v_blob) == FAIL) { - EMSG("cannot read file"); + emsg("cannot read file"); blob_free(rettv->vval.v_blob); } fclose(fd); @@ -9437,7 +9437,7 @@ check_connection(void) make_connection(); if (X_DISPLAY == NULL) { - EMSG(_("E240: No connection to the X server")); + emsg(_("E240: No connection to the X server")); return FAIL; } return OK; @@ -9483,11 +9483,11 @@ remote_common(typval_T *argvars, typval_ { if (r != NULL) { - EMSG(r); /* sending worked but evaluation failed */ + emsg((char *)r); // sending worked but evaluation failed vim_free(r); } else - EMSG2(_("E241: Unable to send to %s"), server_name); + semsg(_("E241: Unable to send to %s"), server_name); return; } @@ -9637,7 +9637,7 @@ f_remote_read(typval_T *argvars UNUSED, || serverReadReply(X_DISPLAY, serverStrToWin(serverid), &r, FALSE, timeout) < 0) # endif - EMSG(_("E277: Unable to read a server reply")); + emsg(_("E277: Unable to read a server reply")); } #endif rettv->v_type = VAR_STRING; @@ -9669,7 +9669,7 @@ f_remote_startserver(typval_T *argvars U if (server == NULL) return; /* type error; errmsg already given */ if (serverName != NULL) - EMSG(_("E941: already started a server")); + emsg(_("E941: already started a server")); else { # ifdef FEAT_X11 @@ -9680,7 +9680,7 @@ f_remote_startserver(typval_T *argvars U # endif } #else - EMSG(_("E942: +clientserver feature not available")); + emsg(_("E942: +clientserver feature not available")); #endif } @@ -9704,7 +9704,7 @@ f_remove(typval_T *argvars, typval_T *re if (argvars[0].v_type == VAR_DICT) { if (argvars[2].v_type != VAR_UNKNOWN) - EMSG2(_(e_toomanyarg), "remove()"); + semsg(_(e_toomanyarg), "remove()"); else if ((d = argvars[0].vval.v_dict) != NULL && !tv_check_lock(d->dv_lock, arg_errmsg, TRUE)) { @@ -9713,7 +9713,7 @@ f_remove(typval_T *argvars, typval_T *re { di = dict_find(d, key, -1); if (di == NULL) - EMSG2(_(e_dictkey), key); + semsg(_(e_dictkey), key); else if (!var_check_fixed(di->di_flags, arg_errmsg, TRUE) && !var_check_ro(di->di_flags, arg_errmsg, TRUE)) { @@ -9738,7 +9738,7 @@ f_remove(typval_T *argvars, typval_T *re idx = len + idx; if (idx < 0 || idx >= len) { - EMSGN(_(e_blobidx), idx); + semsg(_(e_blobidx), idx); return; } if (argvars[2].v_type == VAR_UNKNOWN) @@ -9762,7 +9762,7 @@ f_remove(typval_T *argvars, typval_T *re end = len + end; if (end >= len || idx > end) { - EMSGN(_(e_blobidx), end); + semsg(_(e_blobidx), end); return; } blob = blob_alloc(); @@ -9787,7 +9787,7 @@ f_remove(typval_T *argvars, typval_T *re } } else if (argvars[0].v_type != VAR_LIST) - EMSG2(_(e_listdictarg), "remove()"); + semsg(_(e_listdictarg), "remove()"); else if ((l = argvars[0].vval.v_list) != NULL && !tv_check_lock(l->lv_lock, arg_errmsg, TRUE)) { @@ -9795,7 +9795,7 @@ f_remove(typval_T *argvars, typval_T *re if (error) ; // type error: do nothing, errmsg already given else if ((item = list_find(l, idx)) == NULL) - EMSGN(_(e_listidx), idx); + semsg(_(e_listidx), idx); else { if (argvars[2].v_type == VAR_UNKNOWN) @@ -9812,7 +9812,7 @@ f_remove(typval_T *argvars, typval_T *re if (error) ; // type error: do nothing else if ((item2 = list_find(l, end)) == NULL) - EMSGN(_(e_listidx), end); + semsg(_(e_listidx), end); else { int cnt = 0; @@ -9824,7 +9824,7 @@ f_remove(typval_T *argvars, typval_T *re break; } if (li == NULL) /* didn't find "item2" after "item" */ - EMSG(_(e_invrange)); + emsg(_(e_invrange)); else { vimlist_remove(l, item, item2); @@ -9976,7 +9976,7 @@ f_resolve(typval_T *argvars, typval_T *r { vim_free(p); vim_free(remain); - EMSG(_("E655: Too many symbolic links (cycle?)")); + emsg(_("E655: Too many symbolic links (cycle?)")); rettv->vval.v_string = NULL; goto fail; } @@ -10134,7 +10134,7 @@ f_reverse(typval_T *argvars, typval_T *r } if (argvars[0].v_type != VAR_LIST) - EMSG2(_(e_listarg), "reverse()"); + semsg(_(e_listarg), "reverse()"); else if ((l = argvars[0].vval.v_list) != NULL && !tv_check_lock(l->lv_lock, (char_u *)N_("reverse() argument"), TRUE)) @@ -10202,7 +10202,7 @@ get_search_arg(typval_T *varp, int *flag } if (mask == 0) { - EMSG2(_(e_invarg2), flags); + semsg(_(e_invarg2), flags); dir = 0; } else @@ -10279,7 +10279,7 @@ search_cmn(typval_T *argvars, pos_T *mat if (((flags & (SP_REPEAT | SP_RETCOUNT)) != 0) || ((flags & SP_NOMOVE) && (flags & SP_SETPCMARK))) { - EMSG2(_(e_invarg2), tv_get_string(&argvars[1])); + semsg(_(e_invarg2), tv_get_string(&argvars[1])); goto theend; } @@ -10485,7 +10485,7 @@ searchpair_cmn(typval_T *argvars, pos_T if ((flags & (SP_END | SP_SUBPAT)) != 0 || ((flags & SP_NOMOVE) && (flags & SP_SETPCMARK))) { - EMSG2(_(e_invarg2), tv_get_string(&argvars[3])); + semsg(_(e_invarg2), tv_get_string(&argvars[3])); goto theend; } @@ -10504,7 +10504,7 @@ searchpair_cmn(typval_T *argvars, pos_T && skip->v_type != VAR_STRING) { /* Type error */ - EMSG2(_(e_invarg2), tv_get_string(&argvars[4])); + semsg(_(e_invarg2), tv_get_string(&argvars[4])); goto theend; } if (argvars[5].v_type != VAR_UNKNOWN) @@ -10512,7 +10512,7 @@ searchpair_cmn(typval_T *argvars, pos_T lnum_stop = (long)tv_get_number_chk(&argvars[5], NULL); if (lnum_stop < 0) { - EMSG2(_(e_invarg2), tv_get_string(&argvars[5])); + semsg(_(e_invarg2), tv_get_string(&argvars[5])); goto theend; } #ifdef FEAT_RELTIME @@ -10521,7 +10521,7 @@ searchpair_cmn(typval_T *argvars, pos_T time_limit = (long)tv_get_number_chk(&argvars[6], NULL); if (time_limit < 0) { - EMSG2(_(e_invarg2), tv_get_string(&argvars[6])); + semsg(_(e_invarg2), tv_get_string(&argvars[6])); goto theend; } } @@ -10786,7 +10786,7 @@ f_server2client(typval_T *argvars UNUSED if (serverSendReply(server, reply) < 0) { - EMSG(_("E258: Unable to send to client")); + emsg(_("E258: Unable to send to client")); return; } rettv->vval.v_number = 0; @@ -10898,7 +10898,7 @@ f_setcharsearch(typval_T *argvars, typva if (argvars[0].v_type != VAR_DICT) { - EMSG(_(e_dictreq)); + emsg(_(e_dictreq)); return; } @@ -10966,7 +10966,7 @@ f_setfperm(typval_T *argvars, typval_T * return; if (STRLEN(mode_str) != 9) { - EMSG2(_(e_invarg2), mode_str); + semsg(_(e_invarg2), mode_str); return; } @@ -11013,9 +11013,9 @@ set_qf_ll_list( #ifdef FEAT_QUICKFIX if (list_arg->v_type != VAR_LIST) - EMSG(_(e_listreq)); + emsg(_(e_listreq)); else if (recursive != 0) - EMSG(_(e_au_recursive)); + emsg(_(e_au_recursive)); else { list_T *l = list_arg->vval.v_list; @@ -11031,12 +11031,12 @@ set_qf_ll_list( act[1] == NUL) action = *act; else - EMSG2(_(e_invact), act); + semsg(_(e_invact), act); } else if (action_arg->v_type == VAR_UNKNOWN) action = ' '; else - EMSG(_(e_stringreq)); + emsg(_(e_stringreq)); if (action_arg->v_type != VAR_UNKNOWN && what_arg->v_type != VAR_UNKNOWN) @@ -11045,7 +11045,7 @@ set_qf_ll_list( d = what_arg->vval.v_dict; else { - EMSG(_(e_dictreq)); + emsg(_(e_dictreq)); valid_dict = FALSE; } } @@ -11090,7 +11090,7 @@ f_setmatches(typval_T *argvars UNUSED, t rettv->vval.v_number = -1; if (argvars[0].v_type != VAR_LIST) { - EMSG(_(e_listreq)); + emsg(_(e_listreq)); return; } if ((l = argvars[0].vval.v_list) != NULL) @@ -11104,7 +11104,7 @@ f_setmatches(typval_T *argvars UNUSED, t if (li->li_tv.v_type != VAR_DICT || (d = li->li_tv.vval.v_dict) == NULL) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } if (!(dict_find(d, (char_u *)"group", -1) != NULL @@ -11113,7 +11113,7 @@ f_setmatches(typval_T *argvars UNUSED, t && dict_find(d, (char_u *)"priority", -1) != NULL && dict_find(d, (char_u *)"id", -1) != NULL)) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } li = li->li_next; @@ -11224,7 +11224,7 @@ f_setpos(typval_T *argvars, typval_T *re rettv->vval.v_number = 0; } else - EMSG(_(e_invarg)); + emsg(_(e_invarg)); } } } @@ -11424,7 +11424,7 @@ f_settagstack(typval_T *argvars, typval_ // second argument: dict with items to set in the tag stack if (argvars[1].v_type != VAR_DICT) { - EMSG(_(e_dictreq)); + emsg(_(e_dictreq)); return; } d = argvars[1].vval.v_dict; @@ -11445,13 +11445,13 @@ f_settagstack(typval_T *argvars, typval_ action = *actstr; else { - EMSG2(_(e_invact2), actstr); + semsg(_(e_invact2), actstr); return; } } else { - EMSG(_(e_stringreq)); + emsg(_(e_stringreq)); return; } @@ -11545,7 +11545,7 @@ f_sign_define(typval_T *argvars, typval_ { if (argvars[1].v_type != VAR_DICT) { - EMSG(_(e_dictreq)); + emsg(_(e_dictreq)); return; } @@ -11616,7 +11616,7 @@ f_sign_getplaced(typval_T *argvars, typv if (argvars[1].v_type != VAR_DICT || ((dict = argvars[1].vval.v_dict) == NULL)) { - EMSG(_(e_dictreq)); + emsg(_(e_dictreq)); return; } if ((di = dict_find(dict, (char_u *)"lnum", -1)) != NULL) @@ -11667,7 +11667,7 @@ f_sign_jump(typval_T *argvars, typval_T return; if (sign_id <= 0) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } @@ -11719,7 +11719,7 @@ f_sign_place(typval_T *argvars, typval_T return; if (sign_id < 0) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } @@ -11751,7 +11751,7 @@ f_sign_place(typval_T *argvars, typval_T if (argvars[4].v_type != VAR_DICT || ((dict = argvars[4].vval.v_dict) == NULL)) { - EMSG(_(e_dictreq)); + emsg(_(e_dictreq)); goto cleanup; } @@ -11823,7 +11823,7 @@ f_sign_unplace(typval_T *argvars, typval if (argvars[0].v_type != VAR_STRING) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } @@ -11841,7 +11841,7 @@ f_sign_unplace(typval_T *argvars, typval { if (argvars[1].v_type != VAR_DICT) { - EMSG(_(e_dictreq)); + emsg(_(e_dictreq)); goto cleanup; } dict = argvars[1].vval.v_dict; @@ -12120,7 +12120,7 @@ do_sort_uniq(typval_T *argvars, typval_T sortinfo = &info; if (argvars[0].v_type != VAR_LIST) - EMSG2(_(e_listarg), sort ? "sort()" : "uniq()"); + semsg(_(e_listarg), sort ? "sort()" : "uniq()"); else { l = argvars[0].vval.v_list; @@ -12163,7 +12163,7 @@ do_sort_uniq(typval_T *argvars, typval_T info.item_compare_func = tv_get_string(&argvars[1]); else if (i != 0) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); goto theend; } if (info.item_compare_func != NULL) @@ -12203,7 +12203,7 @@ do_sort_uniq(typval_T *argvars, typval_T /* optional third argument: {dict} */ if (argvars[2].v_type != VAR_DICT) { - EMSG(_(e_dictreq)); + emsg(_(e_dictreq)); goto theend; } info.item_compare_selfdict = argvars[2].vval.v_dict; @@ -12233,7 +12233,7 @@ do_sort_uniq(typval_T *argvars, typval_T || info.item_compare_partial != NULL) && item_compare2((void *)&ptrs[0], (void *)&ptrs[1]) == ITEM_COMPARE_FAIL) - EMSG(_("E702: Sort compare function failed")); + emsg(_("E702: Sort compare function failed")); else { /* Sort the array with item pointers. */ @@ -12271,7 +12271,7 @@ do_sort_uniq(typval_T *argvars, typval_T ptrs[i++].item = li; if (info.item_compare_func_err) { - EMSG(_("E882: Uniq compare function failed")); + emsg(_("E882: Uniq compare function failed")); break; } } @@ -12580,7 +12580,7 @@ f_str2nr(typval_T *argvars, typval_T *re base = (int)tv_get_number(&argvars[1]); if (base != 2 && base != 8 && base != 10 && base != 16) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } } @@ -12782,7 +12782,7 @@ f_strchars(typval_T *argvars, typval_T * if (argvars[1].v_type != VAR_UNKNOWN) skipcc = (int)tv_get_number_chk(&argvars[1], NULL); if (skipcc < 0 || skipcc > 1) - EMSG(_(e_invarg)); + emsg(_(e_invarg)); else { #ifdef FEAT_MBYTE @@ -13022,7 +13022,7 @@ f_submatch(typval_T *argvars, typval_T * return; if (no < 0 || no >= NSUBEXP) { - EMSGN(_("E935: invalid submatch number: %d"), no); + semsg(_("E935: invalid submatch number: %d"), no); return; } if (argvars[1].v_type != VAR_UNKNOWN) @@ -13357,14 +13357,14 @@ get_cmd_output_as_rettv( */ if ((infile = vim_tempname('i', TRUE)) == NULL) { - EMSG(_(e_notmp)); + emsg(_(e_notmp)); goto errret; } fd = mch_fopen((char *)infile, WRITEBIN); if (fd == NULL) { - EMSG2(_(e_notopen), infile); + semsg(_(e_notopen), infile); goto errret; } if (argvars[1].v_type == VAR_NUMBER) @@ -13375,7 +13375,7 @@ get_cmd_output_as_rettv( buf = buflist_findnr(argvars[1].vval.v_number); if (buf == NULL) { - EMSGN(_(e_nobufnr), argvars[1].vval.v_number); + semsg(_(e_nobufnr), argvars[1].vval.v_number); fclose(fd); goto errret; } @@ -13419,7 +13419,7 @@ get_cmd_output_as_rettv( err = TRUE; if (err) { - EMSG(_("E677: Error writing temp file")); + emsg(_("E677: Error writing temp file")); goto errret; } } @@ -13587,7 +13587,7 @@ f_tabpagenr(typval_T *argvars UNUSED, ty if (STRCMP(arg, "$") == 0) nr = tabpage_index(NULL) - 1; else - EMSG2(_(e_invexpr2), arg); + semsg(_(e_invexpr2), arg); } } else @@ -13623,7 +13623,7 @@ get_winnr(tabpage_T *tp, typval_T *argva } else { - EMSG2(_(e_invexpr2), arg); + semsg(_(e_invexpr2), arg); nr = 0; } } @@ -13781,12 +13781,12 @@ f_test_alloc_fail(typval_T *argvars, typ || argvars[1].v_type != VAR_NUMBER || argvars[1].vval.v_number < 0 || argvars[2].v_type != VAR_NUMBER) - EMSG(_(e_invarg)); + emsg(_(e_invarg)); else { alloc_fail_id = argvars[0].vval.v_number; if (alloc_fail_id >= aid_last) - EMSG(_(e_invarg)); + emsg(_(e_invarg)); alloc_fail_countdown = argvars[1].vval.v_number; alloc_fail_repeat = argvars[2].vval.v_number; did_outofmem_msg = FALSE; @@ -13830,12 +13830,12 @@ f_test_option_not_set(typval_T *argvars, char_u *name = (char_u *)""; if (argvars[0].v_type != VAR_STRING) - EMSG(_(e_invarg)); + emsg(_(e_invarg)); else { name = tv_get_string(&argvars[0]); if (reset_option_was_set(name) == FAIL) - EMSG2(_(e_invarg2), name); + semsg(_(e_invarg2), name); } } @@ -13851,7 +13851,7 @@ f_test_override(typval_T *argvars, typva if (argvars[0].v_type != VAR_STRING || (argvars[1].v_type) != VAR_NUMBER) - EMSG(_(e_invarg)); + emsg(_(e_invarg)); else { name = tv_get_string(&argvars[0]); @@ -13892,7 +13892,7 @@ f_test_override(typval_T *argvars, typva } } else - EMSG2(_(e_invarg2), name); + semsg(_(e_invarg2), name); } } @@ -13980,7 +13980,7 @@ f_test_scrollbar(typval_T *argvars, typv || (argvars[1].v_type) != VAR_NUMBER || (argvars[2].v_type) != VAR_NUMBER) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } which = tv_get_string(&argvars[0]); @@ -13995,7 +13995,7 @@ f_test_scrollbar(typval_T *argvars, typv sb = &gui.bottom_sbar; if (sb == NULL) { - EMSG2(_(e_invarg2), which); + semsg(_(e_invarg2), which); return; } gui_drag_scrollbar(sb, value, dragging); @@ -14035,7 +14035,7 @@ get_callback(typval_T *arg, partial_T ** } if (arg->v_type == VAR_NUMBER && arg->vval.v_number == 0) return (char_u *)""; - EMSG(_("E921: Invalid callback argument")); + emsg(_("E921: Invalid callback argument")); return NULL; } @@ -14069,7 +14069,7 @@ f_timer_info(typval_T *argvars, typval_T if (argvars[0].v_type != VAR_UNKNOWN) { if (argvars[0].v_type != VAR_NUMBER) - EMSG(_(e_number_exp)); + emsg(_(e_number_exp)); else { timer = find_timer((int)tv_get_number(&argvars[0])); @@ -14091,7 +14091,7 @@ f_timer_pause(typval_T *argvars, typval_ int paused = (int)tv_get_number(&argvars[1]); if (argvars[0].v_type != VAR_NUMBER) - EMSG(_(e_number_exp)); + emsg(_(e_number_exp)); else { timer = find_timer((int)tv_get_number(&argvars[0])); @@ -14121,7 +14121,7 @@ f_timer_start(typval_T *argvars, typval_ if (argvars[2].v_type != VAR_DICT || (dict = argvars[2].vval.v_dict) == NULL) { - EMSG2(_(e_invarg2), tv_get_string(&argvars[2])); + semsg(_(e_invarg2), tv_get_string(&argvars[2])); return; } if (dict_find(dict, (char_u *)"repeat", -1) != NULL) @@ -14157,7 +14157,7 @@ f_timer_stop(typval_T *argvars, typval_T if (argvars[0].v_type != VAR_NUMBER) { - EMSG(_(e_number_exp)); + emsg(_(e_number_exp)); return; } timer = find_timer((int)tv_get_number(&argvars[0])); @@ -14238,7 +14238,7 @@ f_tr(typval_T *argvars, typval_T *rettv) #ifdef FEAT_MBYTE error: #endif - EMSG2(_(e_invarg2), fromstr); + semsg(_(e_invarg2), fromstr); ga_clear(&ga); return; } @@ -14673,7 +14673,7 @@ f_winrestview(typval_T *argvars, typval_ if (argvars[0].v_type != VAR_DICT || (dict = argvars[0].vval.v_dict) == NULL) - EMSG(_(e_invarg)); + emsg(_(e_invarg)); else { if (dict_find(dict, (char_u *)"lnum", -1) != NULL) @@ -14809,7 +14809,7 @@ f_writefile(typval_T *argvars, typval_T } else { - EMSG2(_(e_invarg2), "writefile()"); + semsg(_(e_invarg2), "writefile()"); return; } @@ -14840,7 +14840,7 @@ f_writefile(typval_T *argvars, typval_T if (*fname == NUL || (fd = mch_fopen((char *)fname, append ? APPENDBIN : WRITEBIN)) == NULL) { - EMSG2(_(e_notcreate), *fname == NUL ? (char_u *)_("") : fname); + semsg(_(e_notcreate), *fname == NUL ? (char_u *)_("") : fname); ret = -1; } else if (blob) diff --git a/src/ex_cmds.c b/src/ex_cmds.c --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -467,7 +467,7 @@ ex_sort(exarg_T *eap) s = skip_regexp(p + 1, *p, TRUE, NULL); if (*s != *p) { - EMSG(_(e_invalpat)); + emsg(_(e_invalpat)); goto sortend; } *s = NUL; @@ -476,7 +476,7 @@ ex_sort(exarg_T *eap) { if (last_search_pat() == NULL) { - EMSG(_(e_noprevre)); + emsg(_(e_noprevre)); goto sortend; } regmatch.regprog = vim_regcomp(last_search_pat(), RE_MAGIC); @@ -490,7 +490,7 @@ ex_sort(exarg_T *eap) } else { - EMSG2(_(e_invarg2), p); + semsg(_(e_invarg2), p); goto sortend; } } @@ -498,7 +498,7 @@ ex_sort(exarg_T *eap) /* Can only have one of 'n', 'b', 'o' and 'x'. */ if (format_found > 1) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); goto sortend; } @@ -668,7 +668,7 @@ sortend: vim_free(sortbuf2); vim_regfree(regmatch.regprog); if (got_int) - EMSG(_(e_interr)); + emsg(_(e_interr)); } /* @@ -725,7 +725,7 @@ ex_retab(exarg_T *eap) new_ts = getdigits(&(eap->arg)); if (new_ts < 0) { - EMSG(_(e_positive)); + emsg(_(e_positive)); return; } if (new_ts == 0) @@ -835,7 +835,7 @@ ex_retab(exarg_T *eap) line_breakcheck(); } if (got_int) - EMSG(_(e_interr)); + emsg(_(e_interr)); #ifdef FEAT_VARTABS // If a single value was given then it can be considered equal to @@ -909,7 +909,7 @@ do_move(linenr_T line1, linenr_T line2, if (dest >= line1 && dest < line2) { - EMSG(_("E134: Cannot move a range of lines into itself")); + emsg(_("E134: Cannot move a range of lines into itself")); return FAIL; } @@ -1002,7 +1002,7 @@ do_move(linenr_T line1, linenr_T line2, ml_delete(line1 + extra, TRUE); if (!global_busy && num_lines > p_report) - smsg((char_u *)NGETTEXT("%ld line moved", "%ld lines moved", num_lines), + smsg(NGETTEXT("%ld line moved", "%ld lines moved", num_lines), (long)num_lines); /* @@ -1147,7 +1147,7 @@ do_bang( { if (prevcmd == NULL) { - EMSG(_(e_noprev)); + emsg(_(e_noprev)); vim_free(newcmd); return; } @@ -1334,7 +1334,7 @@ do_filter( if ((do_in && (itmp = vim_tempname('i', FALSE)) == NULL) || (do_out && (otmp = vim_tempname('o', FALSE)) == NULL)) { - EMSG(_(e_notmp)); + emsg(_(e_notmp)); goto filterend; } @@ -1351,7 +1351,7 @@ do_filter( #if defined(FEAT_EVAL) if (!aborting()) #endif - (void)EMSG2(_(e_notcreate), itmp); /* will call wait_return */ + (void)semsg(_(e_notcreate), itmp); /* will call wait_return */ goto filterend; } if (curbuf != old_curbuf) @@ -1426,7 +1426,7 @@ do_filter( #endif { msg_putchar('\n'); - EMSG2(_(e_notread), otmp); + semsg(_(e_notread), otmp); } goto error; } @@ -1514,7 +1514,7 @@ filterend: if (curbuf != old_curbuf) { --no_wait_return; - EMSG(_("E135: *Filter* Autocommands must not change current buffer")); + emsg(_("E135: *Filter* Autocommands must not change current buffer")); } if (itmp != NULL) mch_remove(itmp); @@ -1871,10 +1871,10 @@ viminfo_error(char *errnum, char *messag STRNCAT(IObuff, line, IOSIZE - STRLEN(IObuff) - 1); if (IObuff[STRLEN(IObuff) - 1] == '\n') IObuff[STRLEN(IObuff) - 1] = NUL; - emsg(IObuff); + emsg((char *)IObuff); if (++viminfo_errcnt >= 10) { - EMSG(_("E136: viminfo: Too many errors, skipping rest of file")); + emsg(_("E136: viminfo: Too many errors, skipping rest of file")); return TRUE; } return FALSE; @@ -1903,7 +1903,7 @@ read_viminfo( if (p_verbose > 0) { verbose_enter(); - smsg((char_u *)_("Reading viminfo file \"%s\"%s%s%s"), + smsg(_("Reading viminfo file \"%s\"%s%s%s"), fname, (flags & VIF_WANT_INFO) ? _(" info") : "", (flags & VIF_WANT_MARKS) ? _(" marks") : "", @@ -2003,7 +2003,7 @@ write_viminfo(char_u *file, int forceit) int tt = msg_didany; /* avoid a wait_return for this message, it's annoying */ - EMSG2(_("E137: Viminfo file is not writable: %s"), fname); + semsg(_("E137: Viminfo file is not writable: %s"), fname); msg_didany = tt; fclose(fp_in); goto end; @@ -2126,7 +2126,7 @@ write_viminfo(char_u *file, int forceit) { /* They all exist? Must be something wrong! Don't write * the viminfo file then. */ - EMSG2(_("E929: Too many viminfo temp files, like %s!"), + semsg(_("E929: Too many viminfo temp files, like %s!"), tempname); break; } @@ -2172,7 +2172,7 @@ write_viminfo(char_u *file, int forceit) */ if (fp_out == NULL) { - EMSG2(_("E138: Can't write viminfo file %s!"), + semsg(_("E138: Can't write viminfo file %s!"), (fp_in == NULL || tempname == NULL) ? fname : tempname); if (fp_in != NULL) fclose(fp_in); @@ -2182,7 +2182,7 @@ write_viminfo(char_u *file, int forceit) if (p_verbose > 0) { verbose_enter(); - smsg((char_u *)_("Writing viminfo file \"%s\""), fname); + smsg(_("Writing viminfo file \"%s\""), fname); verbose_leave(); } @@ -2203,7 +2203,7 @@ write_viminfo(char_u *file, int forceit) if (vim_rename(tempname, fname) == -1) { ++viminfo_errcnt; - EMSG2(_("E886: Can't rename viminfo file to %s!"), fname); + semsg(_("E886: Can't rename viminfo file to %s!"), fname); } # ifdef WIN3264 /* If the viminfo file was hidden then also hide the new file. */ @@ -3127,7 +3127,7 @@ ex_file(exarg_T *eap) || eap->line2 > 0 || eap->addr_count > 1)) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } @@ -3205,7 +3205,7 @@ do_write(exarg_T *eap) { if (eap->cmdidx == CMD_saveas) { - EMSG(_(e_argreq)); + emsg(_(e_argreq)); goto theend; } other = FALSE; @@ -3237,7 +3237,7 @@ do_write(exarg_T *eap) { /* Overwriting a file that is loaded in another buffer is not a * good idea. */ - EMSG(_(e_bufloaded)); + emsg(_(e_bufloaded)); goto theend; } } @@ -3278,7 +3278,7 @@ do_write(exarg_T *eap) else #endif { - EMSG(_("E140: Use ! to write partial buffer")); + emsg(_("E140: Use ! to write partial buffer")); goto theend; } } @@ -3417,7 +3417,7 @@ check_overwrite( /* with UNIX it is possible to open a directory */ if (mch_isdir(ffname)) { - EMSG2(_(e_isadir2), ffname); + semsg(_(e_isadir2), ffname); return FAIL; } #endif @@ -3434,7 +3434,7 @@ check_overwrite( else #endif { - EMSG(_(e_exists)); + emsg(_(e_exists)); return FAIL; } } @@ -3491,7 +3491,7 @@ check_overwrite( else #endif { - EMSG2(_("E768: Swap file exists: %s (:silent! overrides)"), + semsg(_("E768: Swap file exists: %s (:silent! overrides)"), swapname); vim_free(swapname); return FAIL; @@ -3565,7 +3565,7 @@ do_wqall(exarg_T *eap) #endif if (buf->b_ffname == NULL) { - EMSGN(_("E141: No file name for buffer %ld"), (long)buf->b_fnum); + semsg(_("E141: No file name for buffer %ld"), (long)buf->b_fnum); ++error; } else if (check_readonly(&eap->forceit, buf) @@ -3605,7 +3605,7 @@ not_writing(void) { if (p_write) return FALSE; - EMSG(_("E142: File not written: Writing is disabled by 'write' option")); + emsg(_("E142: File not written: Writing is disabled by 'write' option")); return TRUE; } @@ -3651,9 +3651,9 @@ check_readonly(int *forceit, buf_T *buf) else #endif if (buf->b_p_ro) - EMSG(_(e_readonly)); + emsg(_(e_readonly)); else - EMSG2(_("E505: \"%s\" is read-only (add ! to override)"), + semsg(_("E505: \"%s\" is read-only (add ! to override)"), buf->b_fname); return TRUE; } @@ -4488,7 +4488,7 @@ theend: static void delbuf_msg(char_u *name) { - EMSG2(_("E143: Autocommands unexpectedly deleted new buffer %s"), + semsg(_("E143: Autocommands unexpectedly deleted new buffer %s"), name == NULL ? (char_u *)"" : name); vim_free(name); au_new_curbuf.br_buf = NULL; @@ -4707,7 +4707,7 @@ ex_z(exarg_T *eap) { if (!VIM_ISDIGIT(*x)) { - EMSG(_("E144: non-numeric argument to :z")); + emsg(_("E144: non-numeric argument to :z")); return; } else @@ -4817,7 +4817,7 @@ check_restricted(void) { if (restricted) { - EMSG(_("E145: Shell commands not allowed in rvim")); + emsg(_("E145: Shell commands not allowed in rvim")); return TRUE; } return FALSE; @@ -4834,7 +4834,7 @@ check_secure(void) if (secure) { secure = 2; - EMSG(_(e_curdir)); + emsg(_(e_curdir)); return TRUE; } #ifdef HAVE_SANDBOX @@ -4844,7 +4844,7 @@ check_secure(void) */ if (sandbox != 0) { - EMSG(_(e_sandbox)); + emsg(_(e_sandbox)); return TRUE; } #endif @@ -4933,7 +4933,7 @@ do_sub(exarg_T *eap) /* don't accept alphanumeric for separator */ if (isalpha(*cmd)) { - EMSG(_("E146: Regular expressions can't be delimited by letters")); + emsg(_("E146: Regular expressions can't be delimited by letters")); return; } /* @@ -4946,7 +4946,7 @@ do_sub(exarg_T *eap) ++cmd; if (vim_strchr((char_u *)"/?&", *cmd) == NULL) { - EMSG(_(e_backslash)); + emsg(_(e_backslash)); return; } if (*cmd != '&') @@ -4994,7 +4994,7 @@ do_sub(exarg_T *eap) { if (old_sub == NULL) /* there is no previous command */ { - EMSG(_(e_nopresub)); + emsg(_(e_nopresub)); return; } sub = old_sub; @@ -5010,7 +5010,7 @@ do_sub(exarg_T *eap) { if (old_sub == NULL) /* there is no previous command */ { - EMSG(_(e_nopresub)); + emsg(_(e_nopresub)); return; } pat = NULL; /* search_regcomp() will use previous pattern */ @@ -5137,7 +5137,7 @@ do_sub(exarg_T *eap) i = getdigits(&cmd); if (i <= 0 && !eap->skip && subflags.do_error) { - EMSG(_(e_zerocount)); + emsg(_(e_zerocount)); return; } eap->line1 = eap->line2; @@ -5155,7 +5155,7 @@ do_sub(exarg_T *eap) eap->nextcmd = check_nextcmd(cmd); if (eap->nextcmd == NULL) { - EMSG(_(e_trailing)); + emsg(_(e_trailing)); return; } } @@ -5166,14 +5166,14 @@ do_sub(exarg_T *eap) if (!subflags.do_count && !curbuf->b_p_ma) { /* Substitution is not allowed in non-'modifiable' buffer */ - EMSG(_(e_modifiable)); + emsg(_(e_modifiable)); return; } if (search_regcomp(pat, RE_SUBST, which_pat, SEARCH_HIS, ®match) == FAIL) { if (subflags.do_error) - EMSG(_(e_invcmd)); + emsg(_(e_invcmd)); return; } @@ -5496,7 +5496,7 @@ do_sub(exarg_T *eap) /* write message same highlighting as for * wait_return */ smsg_attr(HL_ATTR(HLF_R), - (char_u *)_("replace with %s (y/n/a/q/l/^E/^Y)?"), sub); + _("replace with %s (y/n/a/q/l/^E/^Y)?"), sub); msg_no_more = FALSE; msg_scroll = i; showruler(TRUE); @@ -5949,11 +5949,11 @@ outofmem: else if (!global_busy) { if (got_int) /* interrupted */ - EMSG(_(e_interr)); + emsg(_(e_interr)); else if (got_match) /* did find something but nothing substituted */ MSG(""); else if (subflags.do_error) /* nothing found */ - EMSG2(_(e_patnotf2), get_search_pat()); + semsg(_(e_patnotf2), get_search_pat()); } #ifdef FEAT_FOLDING @@ -6018,7 +6018,7 @@ do_sub_msg( } if (got_int) { - EMSG(_(e_interr)); + emsg(_(e_interr)); return TRUE; } return FALSE; @@ -6071,7 +6071,7 @@ ex_global(exarg_T *eap) || eap->line2 != curbuf->b_ml.ml_line_count)) { /* will increment global_busy to break out of the loop */ - EMSG(_("E147: Cannot do :global recursive with a range")); + emsg(_("E147: Cannot do :global recursive with a range")); return; } @@ -6092,7 +6092,7 @@ ex_global(exarg_T *eap) ++cmd; if (vim_strchr((char_u *)"/?&", *cmd) == NULL) { - EMSG(_(e_backslash)); + emsg(_(e_backslash)); return; } if (*cmd == '&') @@ -6104,7 +6104,7 @@ ex_global(exarg_T *eap) } else if (*cmd == NUL) { - EMSG(_("E148: Regular expression missing from global")); + emsg(_("E148: Regular expression missing from global")); return; } else @@ -6125,7 +6125,7 @@ ex_global(exarg_T *eap) if (search_regcomp(pat, RE_BOTH, which_pat, SEARCH_HIS, ®match) == FAIL) { - EMSG(_(e_invcmd)); + emsg(_(e_invcmd)); return; } @@ -6163,9 +6163,9 @@ ex_global(exarg_T *eap) else if (ndone == 0) { if (type == 'v') - smsg((char_u *)_("Pattern found in every line: %s"), pat); + smsg(_("Pattern found in every line: %s"), pat); else - smsg((char_u *)_("Pattern not found: %s"), pat); + smsg(_("Pattern not found: %s"), pat); } else { @@ -6366,7 +6366,7 @@ ex_help(exarg_T *eap) if (eap->forceit && *arg == NUL && !curbuf->b_help) { - EMSG(_("E478: Don't panic!")); + emsg(_("E478: Don't panic!")); return; } @@ -6412,10 +6412,10 @@ ex_help(exarg_T *eap) { #ifdef FEAT_MULTI_LANG if (lang != NULL) - EMSG3(_("E661: Sorry, no '%s' help for %s"), lang, arg); + semsg(_("E661: Sorry, no '%s' help for %s"), lang, arg); else #endif - EMSG2(_("E149: Sorry, no help for %s"), arg); + semsg(_("E149: Sorry, no help for %s"), arg); if (n != FAIL) FreeWild(num_matches, matches); return; @@ -6451,7 +6451,7 @@ ex_help(exarg_T *eap) */ if ((helpfd = mch_fopen((char *)p_hf, READBIN)) == NULL) { - smsg((char_u *)_("Sorry, help file \"%s\" not found"), p_hf); + smsg(_("Sorry, help file \"%s\" not found"), p_hf); goto erret; } fclose(helpfd); @@ -7230,7 +7230,7 @@ helptags_one( || filecount == 0) { if (!got_int) - EMSG2(_("E151: No match: %s"), NameBuff); + semsg(_("E151: No match: %s"), NameBuff); return; } @@ -7244,7 +7244,7 @@ helptags_one( fd_tags = mch_fopen((char *)NameBuff, "w"); if (fd_tags == NULL) { - EMSG2(_("E152: Cannot open %s for writing"), NameBuff); + semsg(_("E152: Cannot open %s for writing"), NameBuff); FreeWild(filecount, files); return; } @@ -7281,7 +7281,7 @@ helptags_one( fd = mch_fopen((char *)files[fi], "r"); if (fd == NULL) { - EMSG2(_("E153: Unable to open %s for reading"), files[fi]); + semsg(_("E153: Unable to open %s for reading"), files[fi]); continue; } fname = files[fi] + dirlen + 1; @@ -7317,7 +7317,7 @@ helptags_one( utf8 = this_utf8; else if (utf8 != this_utf8) { - EMSG2(_("E670: Mix of help file encodings within a language: %s"), files[fi]); + semsg(_("E670: Mix of help file encodings within a language: %s"), files[fi]); mix = !got_int; got_int = TRUE; } @@ -7401,7 +7401,7 @@ helptags_one( vim_snprintf((char *)NameBuff, MAXPATHL, _("E154: Duplicate tag \"%s\" in file %s/%s"), ((char_u **)ga.ga_data)[i], dir, p2 + 1); - EMSG(NameBuff); + emsg((char *)NameBuff); *p2 = '\t'; break; } @@ -7473,7 +7473,7 @@ do_helptags(char_u *dirname, int add_hel EW_FILE|EW_SILENT) == FAIL || filecount == 0) { - EMSG2(_("E151: No match: %s"), NameBuff); + semsg(_("E151: No match: %s"), NameBuff); return; } @@ -7586,7 +7586,7 @@ ex_helptags(exarg_T *eap) dirname = ExpandOne(&xpc, eap->arg, NULL, WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE); if (dirname == NULL || !mch_isdir(dirname)) - EMSG2(_("E150: Not a directory: %s"), eap->arg); + semsg(_("E150: Not a directory: %s"), eap->arg); else do_helptags(dirname, add_help_tags); vim_free(dirname); diff --git a/src/ex_cmds.h b/src/ex_cmds.h --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -1799,7 +1799,7 @@ struct exarg #ifdef FEAT_USR_CMDS int useridx; /* user command index */ #endif - char_u *errmsg; /* returned error message */ + char *errmsg; /* returned error message */ char_u *(*getline)(int, void *, int); void *cookie; /* argument for getline() */ #ifdef FEAT_EVAL diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -146,22 +146,22 @@ do_debug(char_u *cmd) MSG(_("Entering Debug mode. Type \"cont\" to continue.")); if (debug_oldval != NULL) { - smsg((char_u *)_("Oldval = \"%s\""), debug_oldval); + smsg(_("Oldval = \"%s\""), debug_oldval); vim_free(debug_oldval); debug_oldval = NULL; } if (debug_newval != NULL) { - smsg((char_u *)_("Newval = \"%s\""), debug_newval); + smsg(_("Newval = \"%s\""), debug_newval); vim_free(debug_newval); debug_newval = NULL; } if (sourcing_name != NULL) msg(sourcing_name); if (sourcing_lnum != 0) - smsg((char_u *)_("line %ld: %s"), (long)sourcing_lnum, cmd); + smsg(_("line %ld: %s"), (long)sourcing_lnum, cmd); else - smsg((char_u *)_("cmd: %s"), cmd); + smsg(_("cmd: %s"), cmd); /* * Repeat getting a command and executing it. */ @@ -399,7 +399,7 @@ do_checkbacktracelevel(void) if (debug_backtrace_level > max) { debug_backtrace_level = max; - smsg((char_u *)_("frame at highest level: %d"), max); + smsg(_("frame at highest level: %d"), max); } } } @@ -421,9 +421,9 @@ do_showbacktrace(char_u *cmd) if (next != NULL) *next = NUL; if (i == max - debug_backtrace_level) - smsg((char_u *)"->%d %s", max - i, cur); + smsg("->%d %s", max - i, cur); else - smsg((char_u *)" %d %s", max - i, cur); + smsg(" %d %s", max - i, cur); ++i; if (next == NULL) break; @@ -432,9 +432,9 @@ do_showbacktrace(char_u *cmd) } } if (sourcing_lnum != 0) - smsg((char_u *)_("line %ld: %s"), (long)sourcing_lnum, cmd); + smsg(_("line %ld: %s"), (long)sourcing_lnum, cmd); else - smsg((char_u *)_("cmd: %s"), cmd); + smsg(_("cmd: %s"), cmd); } /* @@ -487,7 +487,7 @@ dbg_check_breakpoint(exarg_T *eap) p = (char_u *)""; else p = (char_u *)""; - smsg((char_u *)_("Breakpoint in \"%s%s\" line %ld"), + smsg(_("Breakpoint in \"%s%s\" line %ld"), p, debug_breakpoint_name + (*p == NUL ? 0 : 3), (long)debug_breakpoint_lnum); @@ -607,7 +607,7 @@ dbg_parsearg( { if (curbuf->b_ffname == NULL) { - EMSG(_(e_noname)); + emsg(_(e_noname)); return FAIL; } bp->dbg_type = DBG_FILE; @@ -621,7 +621,7 @@ dbg_parsearg( bp->dbg_type = DBG_EXPR; else { - EMSG2(_(e_invarg2), p); + semsg(_(e_invarg2), p); return FAIL; } p = skipwhite(p + 4); @@ -646,7 +646,7 @@ dbg_parsearg( || (here && *p != NUL) || (bp->dbg_type == DBG_FUNC && strstr((char *)p, "()") != NULL)) { - EMSG2(_(e_invarg2), arg); + semsg(_(e_invarg2), arg); return FAIL; } @@ -817,7 +817,7 @@ ex_breakdel(exarg_T *eap) } if (todel < 0) - EMSG2(_("E161: Breakpoint not found: %s"), eap->arg); + semsg(_("E161: Breakpoint not found: %s"), eap->arg); else { while (gap->ga_len > 0) @@ -865,13 +865,13 @@ ex_breaklist(exarg_T *eap UNUSED) if (bp->dbg_type == DBG_FILE) home_replace(NULL, bp->dbg_name, NameBuff, MAXPATHL, TRUE); if (bp->dbg_type != DBG_EXPR) - smsg((char_u *)_("%3d %s %s line %ld"), + smsg(_("%3d %s %s line %ld"), bp->dbg_nr, bp->dbg_type == DBG_FUNC ? "func" : "file", bp->dbg_type == DBG_FUNC ? bp->dbg_name : NameBuff, (long)bp->dbg_lnum); else - smsg((char_u *)_("%3d expr %s"), + smsg(_("%3d expr %s"), bp->dbg_nr, bp->dbg_name); } } @@ -1726,7 +1726,7 @@ ex_profile(exarg_T *eap) set_vim_var_nr(VV_PROFILING, 1L); } else if (do_profiling == PROF_NONE) - EMSG(_("E750: First use \":profile start {fname}\"")); + emsg(_("E750: First use \":profile start {fname}\"")); else if (STRCMP(eap->arg, "pause") == 0) { if (do_profiling == PROF_YES) @@ -1828,7 +1828,7 @@ profile_dump(void) { fd = mch_fopen((char *)profile_fname, "w"); if (fd == NULL) - EMSG2(_(e_notopen), profile_fname); + semsg(_(e_notopen), profile_fname); else { script_dump_profile(fd); @@ -2357,11 +2357,11 @@ check_changed_any( if ( #ifdef FEAT_TERMINAL term_job_running(buf->b_term) - ? EMSG2(_("E947: Job still running in buffer \"%s\""), + ? semsg(_("E947: Job still running in buffer \"%s\""), buf->b_fname) : #endif - EMSG2(_("E162: No write since last change for buffer \"%s\""), + semsg(_("E162: No write since last change for buffer \"%s\""), buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname)) { save = no_wait_return; @@ -2407,7 +2407,7 @@ check_fname(void) { if (curbuf->b_ffname == NULL) { - EMSG(_(e_noname)); + emsg(_(e_noname)); return FAIL; } return OK; @@ -2629,7 +2629,7 @@ do_arglist( vim_regfree(regmatch.regprog); vim_free(p); if (!didone) - EMSG2(_(e_nomatch2), ((char_u **)new_ga.ga_data)[i]); + semsg(_(e_nomatch2), ((char_u **)new_ga.ga_data)[i]); } ga_clear(&new_ga); } @@ -2640,7 +2640,7 @@ do_arglist( ga_clear(&new_ga); if (i == FAIL || exp_count == 0) { - EMSG(_(e_nomatch)); + emsg(_(e_nomatch)); return FAIL; } @@ -2847,11 +2847,11 @@ do_argfile(exarg_T *eap, int argn) if (argn < 0 || argn >= ARGCOUNT) { if (ARGCOUNT <= 1) - EMSG(_("E163: There is only one file to edit")); + emsg(_("E163: There is only one file to edit")); else if (argn < 0) - EMSG(_("E164: Cannot go before first file")); + emsg(_("E164: Cannot go before first file")); else - EMSG(_("E165: Cannot go beyond last file")); + emsg(_("E165: Cannot go beyond last file")); } else { @@ -2992,12 +2992,12 @@ ex_argdelete(exarg_T *eap) n = eap->line2 - eap->line1 + 1; if (*eap->arg != NUL) /* Can't have both a range and an argument. */ - EMSG(_(e_invarg)); + emsg(_(e_invarg)); else if (n <= 0) { /* Don't give an error for ":%argdel" if the list is empty. */ if (eap->line1 != 1 || eap->line2 != 0) - EMSG(_(e_invrange)); + emsg(_(e_invrange)); } else { @@ -3017,7 +3017,7 @@ ex_argdelete(exarg_T *eap) } } else if (*eap->arg == NUL) - EMSG(_(e_argreq)); + emsg(_(e_argreq)); else do_arglist(eap->arg, AL_DEL, 0, FALSE); #ifdef FEAT_TITLE @@ -3364,7 +3364,7 @@ ex_compiler(exarg_T *eap) sprintf((char *)buf, "compiler/%s.vim", eap->arg); if (source_runtime(buf, DIP_ALL) == FAIL) - EMSG2(_("E666: compiler not supported: %s"), eap->arg); + semsg(_("E666: compiler not supported: %s"), eap->arg); vim_free(buf); do_cmdline_cmd((char_u *)":delcommand CompilerSet"); @@ -3476,7 +3476,7 @@ do_in_path( if (p_verbose > 1 && name != NULL) { verbose_enter(); - smsg((char_u *)_("Searching for \"%s\" in \"%s\""), + smsg(_("Searching for \"%s\" in \"%s\""), (char *)name, (char *)path); verbose_leave(); } @@ -3524,7 +3524,7 @@ do_in_path( if (p_verbose > 2) { verbose_enter(); - smsg((char_u *)_("Searching for \"%s\""), buf); + smsg(_("Searching for \"%s\""), buf); verbose_leave(); } @@ -3552,11 +3552,11 @@ do_in_path( char *basepath = path == p_rtp ? "runtimepath" : "packpath"; if (flags & DIP_ERR) - EMSG3(_(e_dirnotf), basepath, name); + semsg(_(e_dirnotf), basepath, name); else if (p_verbose > 0) { verbose_enter(); - smsg((char_u *)_("not found in '%s': \"%s\""), basepath, name); + smsg(_("not found in '%s': \"%s\""), basepath, name); verbose_leave(); } } @@ -4208,7 +4208,7 @@ ex_source(exarg_T *eap) cmd_source(char_u *fname, exarg_T *eap) { if (*fname == NUL) - EMSG(_(e_argreq)); + emsg(_(e_argreq)); else if (eap != NULL && eap->forceit) /* ":source!": read Normal mode commands @@ -4227,7 +4227,7 @@ cmd_source(char_u *fname, exarg_T *eap) /* ":source" read ex commands */ else if (do_source(fname, FALSE, DOSO_NONE) == FAIL) - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); } /* @@ -4371,7 +4371,7 @@ do_source( return retval; if (mch_isdir(fname_exp)) { - smsg((char_u *)_("Cannot source a directory: \"%s\""), fname); + smsg(_("Cannot source a directory: \"%s\""), fname); goto theend; } @@ -4430,9 +4430,9 @@ do_source( { verbose_enter(); if (sourcing_name == NULL) - smsg((char_u *)_("could not source \"%s\""), fname); + smsg(_("could not source \"%s\""), fname); else - smsg((char_u *)_("line %ld: could not source \"%s\""), + smsg(_("line %ld: could not source \"%s\""), sourcing_lnum, fname); verbose_leave(); } @@ -4448,9 +4448,9 @@ do_source( { verbose_enter(); if (sourcing_name == NULL) - smsg((char_u *)_("sourcing \"%s\""), fname); + smsg(_("sourcing \"%s\""), fname); else - smsg((char_u *)_("line %ld: sourcing \"%s\""), + smsg(_("line %ld: sourcing \"%s\""), sourcing_lnum, fname); verbose_leave(); } @@ -4638,15 +4638,15 @@ do_source( #endif if (got_int) - EMSG(_(e_interr)); + emsg(_(e_interr)); sourcing_name = save_sourcing_name; sourcing_lnum = save_sourcing_lnum; if (p_verbose > 1) { verbose_enter(); - smsg((char_u *)_("finished sourcing %s"), fname); + smsg(_("finished sourcing %s"), fname); if (sourcing_name != NULL) - smsg((char_u *)_("continuing in %s"), sourcing_name); + smsg(_("continuing in %s"), sourcing_name); verbose_leave(); } #ifdef STARTUPTIME @@ -4709,7 +4709,7 @@ ex_scriptnames(exarg_T *eap) { // :script {scriptId}: edit the script if (eap->line2 < 1 || eap->line2 > script_items.ga_len) - EMSG(_(e_invarg)); + emsg(_(e_invarg)); else { eap->arg = SCRIPT_ITEM(eap->line2).sn_name; @@ -4723,7 +4723,7 @@ ex_scriptnames(exarg_T *eap) { home_replace(NULL, SCRIPT_ITEM(i).sn_name, NameBuff, MAXPATHL, TRUE); - smsg((char_u *)"%3d: %s", i, NameBuff); + smsg("%3d: %s", i, NameBuff); } } @@ -5067,7 +5067,7 @@ get_one_sourceline(struct source_cookie if (!sp->error) { msg_source(HL_ATTR(HLF_W)); - EMSG(_("W15: Warning: Wrong line separator, ^M may be missing")); + emsg(_("W15: Warning: Wrong line separator, ^M may be missing")); } sp->error = TRUE; sp->fileformat = EOL_UNIX; @@ -5200,7 +5200,7 @@ ex_scriptencoding(exarg_T *eap UNUSED) if (!getline_equal(eap->getline, eap->cookie, getsourceline)) { - EMSG(_("E167: :scriptencoding used outside of a sourced file")); + emsg(_("E167: :scriptencoding used outside of a sourced file")); return; } @@ -5232,7 +5232,7 @@ ex_finish(exarg_T *eap) if (getline_equal(eap->getline, eap->cookie, getsourceline)) do_finish(eap, FALSE); else - EMSG(_("E168: :finish used outside of a sourced file")); + emsg(_("E168: :finish used outside of a sourced file")); } /* @@ -5553,7 +5553,7 @@ ex_language(exarg_T *eap) p = (char_u *)setlocale(what, NULL); if (p == NULL || *p == NUL) p = (char_u *)"Unknown"; - smsg((char_u *)_("Current %slanguage: \"%s\""), whatstr, p); + smsg(_("Current %slanguage: \"%s\""), whatstr, p); } else { @@ -5570,7 +5570,7 @@ ex_language(exarg_T *eap) #endif } if (loc == NULL) - EMSG2(_("E197: Cannot set language to \"%s\""), name); + semsg(_("E197: Cannot set language to \"%s\""), name); else { #ifdef HAVE_NL_MSG_CAT_CNTR diff --git a/src/ex_docmd.c b/src/ex_docmd.c --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -126,7 +126,7 @@ static void get_flags(exarg_T *eap); # define HAVE_EX_SCRIPT_NI static void ex_script_ni(exarg_T *eap); #endif -static char_u *invalid_range(exarg_T *eap); +static char *invalid_range(exarg_T *eap); static void correct_range(exarg_T *eap); #ifdef FEAT_QUICKFIX static char_u *replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep); @@ -301,7 +301,7 @@ static void close_redir(void); static void ex_mkrc(exarg_T *eap); static void ex_mark(exarg_T *eap); #ifdef FEAT_USR_CMDS -static char_u *uc_fun_cmd(void); +static char *uc_fun_cmd(void); static char_u *find_ucmd(exarg_T *eap, char_u *p, int *full, expand_T *xp, int *compl); #endif static void ex_startinsert(exarg_T *eap); @@ -594,7 +594,7 @@ do_exmode( || changedtick != CHANGEDTICK(curbuf)) && !ex_no_reprint) { if (curbuf->b_ml.ml_flags & ML_EMPTY) - EMSG(_(e_emptybuf)); + emsg(_(e_emptybuf)); else { if (ex_pressedreturn) @@ -613,9 +613,9 @@ do_exmode( else if (ex_pressedreturn && !ex_no_reprint) /* must be at EOF */ { if (curbuf->b_ml.ml_flags & ML_EMPTY) - EMSG(_(e_emptybuf)); + emsg(_(e_emptybuf)); else - EMSG(_("E501: At end-of-file")); + emsg(_("E501: At end-of-file")); } } @@ -718,7 +718,7 @@ do_cmdline( #endif ) { - EMSG(_("E169: Command too recursive")); + emsg(_("E169: Command too recursive")); #ifdef FEAT_EVAL /* When converting to an exception, we do not include the command name * since this is not an error of the specific command. */ @@ -967,7 +967,7 @@ do_cmdline( next_cmdline = vim_strsave(next_cmdline); if (next_cmdline == NULL) { - EMSG(_(e_outofmem)); + emsg(_(e_outofmem)); retval = FAIL; break; } @@ -1019,7 +1019,7 @@ do_cmdline( ++no_wait_return; verbose_enter_scroll(); - smsg((char_u *)_("line %ld: %s"), + smsg(_("line %ld: %s"), (long)sourcing_lnum, cmdline_copy); if (msg_silent == 0) msg_puts((char_u *)"\n"); /* don't overwrite this */ @@ -1251,13 +1251,13 @@ do_cmdline( && !func_has_ended(real_cookie)))) { if (cstack.cs_flags[cstack.cs_idx] & CSF_TRY) - EMSG(_(e_endtry)); + emsg(_(e_endtry)); else if (cstack.cs_flags[cstack.cs_idx] & CSF_WHILE) - EMSG(_(e_endwhile)); + emsg(_(e_endwhile)); else if (cstack.cs_flags[cstack.cs_idx] & CSF_FOR) - EMSG(_(e_endfor)); + emsg(_(e_endfor)); else - EMSG(_(e_endif)); + emsg(_(e_endif)); } /* @@ -1347,7 +1347,7 @@ do_cmdline( } else if (p != NULL) { - emsg(p); + semsg(p); vim_free(p); } vim_free(sourcing_name); @@ -1700,7 +1700,7 @@ do_one_cmd( char_u *p; linenr_T lnum; long n; - char_u *errormsg = NULL; /* error message */ + char *errormsg = NULL; /* error message */ char_u *after_modifier = NULL; exarg_T ea; /* Ex command arguments */ int save_msg_scroll = msg_scroll; @@ -1898,7 +1898,7 @@ do_one_cmd( } if (ea.line2 < 0) - errormsg = (char_u *)_(e_invrange); + errormsg = _(e_invrange); else { if (ea.line2 == 0) @@ -1938,7 +1938,7 @@ do_one_cmd( if (p == NULL) { if (!ea.skip) - errormsg = (char_u *)_("E464: Ambiguous use of user-defined command"); + errormsg = _("E464: Ambiguous use of user-defined command"); goto doend; } /* Check for wrong commands. */ @@ -1963,7 +1963,7 @@ do_one_cmd( else append_command(*cmdlinep); } - errormsg = IObuff; + errormsg = (char *)IObuff; did_emsg_syntax = TRUE; } goto doend; @@ -2014,14 +2014,14 @@ do_one_cmd( if (sandbox != 0 && !(ea.argt & SBOXOK)) { /* Command not allowed in sandbox. */ - errormsg = (char_u *)_(e_sandbox); + errormsg = _(e_sandbox); goto doend; } #endif if (!curbuf->b_p_ma && (ea.argt & MODIFY)) { /* Command not allowed in non-'modifiable' buffer */ - errormsg = (char_u *)_(e_modifiable); + errormsg = _(e_modifiable); goto doend; } @@ -2029,7 +2029,7 @@ do_one_cmd( && !IS_USER_CMDIDX(ea.cmdidx)) { /* Command not allowed when editing the command line. */ - errormsg = (char_u *)_(get_text_locked_msg()); + errormsg = _(get_text_locked_msg()); goto doend; } @@ -2048,14 +2048,14 @@ do_one_cmd( if (!ni && !(ea.argt & RANGE) && ea.addr_count > 0) { /* no range allowed */ - errormsg = (char_u *)_(e_norange); + errormsg = _(e_norange); goto doend; } } if (!ni && !(ea.argt & BANG) && ea.forceit) /* no allowed */ { - errormsg = (char_u *)_(e_nobang); + errormsg = _(e_nobang); goto doend; } @@ -2076,7 +2076,7 @@ do_one_cmd( { if (sourcing || exmode_active) { - errormsg = (char_u *)_("E493: Backwards range given"); + errormsg = _("E493: Backwards range given"); goto doend; } if (ask_yesno((char_u *) @@ -2138,7 +2138,7 @@ do_one_cmd( while (ea.arg[0] == '+' && ea.arg[1] == '+') if (getargopt(&ea) == FAIL && !ni) { - errormsg = (char_u *)_(e_invarg); + errormsg = _(e_invarg); goto doend; } @@ -2148,7 +2148,7 @@ do_one_cmd( { if (*++ea.arg != '>') /* typed wrong */ { - errormsg = (char_u *)_("E494: Use w or w>>"); + errormsg = _("E494: Use w or w>>"); goto doend; } ea.arg = skipwhite(ea.arg + 1); @@ -2322,7 +2322,7 @@ do_one_cmd( ea.arg = skipwhite(ea.arg); if (n <= 0 && !ni && (ea.argt & ZEROR) == 0) { - errormsg = (char_u *)_(e_zerocount); + errormsg = _(e_zerocount); goto doend; } if (ea.argt & NOTADR) /* e.g. :buffer 2, :sleep 3 */ @@ -2354,13 +2354,13 @@ do_one_cmd( if (!ni && !(ea.argt & EXTRA) && *ea.arg != NUL && *ea.arg != '"' && (*ea.arg != '|' || (ea.argt & TRLBAR) == 0)) { - errormsg = (char_u *)_(e_trailing); + errormsg = _(e_trailing); goto doend; } if (!ni && (ea.argt & NEEDARG) && *ea.arg == NUL) { - errormsg = (char_u *)_(e_argreq); + errormsg = _(e_argreq); goto doend; } @@ -2525,7 +2525,7 @@ do_one_cmd( ea.errmsg = NULL; (cmdnames[ea.cmdidx].cmd_func)(&ea); if (ea.errmsg != NULL) - errormsg = (char_u *)_(ea.errmsg); + errormsg = _(ea.errmsg); } #ifdef FEAT_EVAL @@ -2560,10 +2560,10 @@ doend: { if (sourcing) { - if (errormsg != IObuff) + if (errormsg != (char *)IObuff) { STRCPY(IObuff, errormsg); - errormsg = IObuff; + errormsg = (char *)IObuff; } append_command(*cmdlinep); } @@ -2633,7 +2633,7 @@ doend: * May set "errormsg" to an error message. */ int -parse_command_modifiers(exarg_T *eap, char_u **errormsg, int skip_only) +parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only) { char_u *p; @@ -2839,7 +2839,7 @@ parse_command_modifiers(exarg_T *eap, ch { if (tabnr < 0 || tabnr > LAST_TAB_NR) { - *errormsg = (char_u *)_(e_invrange); + *errormsg = _(e_invrange); return FAIL; } cmdmod.tab = tabnr + 1; @@ -2912,7 +2912,7 @@ free_cmdmod(void) * Return FAIL and set "errormsg" or return OK. */ int -parse_cmd_address(exarg_T *eap, char_u **errormsg, int silent) +parse_cmd_address(exarg_T *eap, char **errormsg, int silent) { int address_count = 1; linenr_T lnum; @@ -2998,13 +2998,13 @@ parse_cmd_address(exarg_T *eap, char_u * { // there is no Vim command which uses '%' and // ADDR_WINDOWS or ADDR_TABS - *errormsg = (char_u *)_(e_invrange); + *errormsg = _(e_invrange); return FAIL; } break; case ADDR_TABS_RELATIVE: case ADDR_OTHER: - *errormsg = (char_u *)_(e_invrange); + *errormsg = _(e_invrange); return FAIL; case ADDR_ARGUMENTS: if (ARGCOUNT == 0) @@ -3033,7 +3033,7 @@ parse_cmd_address(exarg_T *eap, char_u * // '*' - visual area if (eap->addr_type != ADDR_LINES) { - *errormsg = (char_u *)_(e_invrange); + *errormsg = _(e_invrange); return FAIL; } @@ -3216,7 +3216,7 @@ find_command(exarg_T *eap, int *full UNU if (command_count != (int)CMD_SIZE) { - iemsg((char_u *)_("E943: Command table needs to be updated, run 'make cmdidxs'")); + iemsg(_("E943: Command table needs to be updated, run 'make cmdidxs'")); getout(1); } @@ -4491,7 +4491,7 @@ get_address( lnum = CURRENT_TAB_NR; break; case ADDR_TABS_RELATIVE: - EMSG(_(e_invrange)); + emsg(_(e_invrange)); cmd = NULL; goto error; break; @@ -4533,7 +4533,7 @@ get_address( lnum = LAST_TAB_NR; break; case ADDR_TABS_RELATIVE: - EMSG(_(e_invrange)); + emsg(_(e_invrange)); cmd = NULL; goto error; break; @@ -4555,7 +4555,7 @@ get_address( } if (addr_type != ADDR_LINES) { - EMSG(_(e_invaddr)); + emsg(_(e_invaddr)); cmd = NULL; goto error; } @@ -4587,7 +4587,7 @@ get_address( c = *cmd++; if (addr_type != ADDR_LINES) { - EMSG(_(e_invaddr)); + emsg(_(e_invaddr)); cmd = NULL; goto error; } @@ -4637,7 +4637,7 @@ get_address( ++cmd; if (addr_type != ADDR_LINES) { - EMSG(_(e_invaddr)); + emsg(_(e_invaddr)); cmd = NULL; goto error; } @@ -4647,7 +4647,7 @@ get_address( i = RE_SEARCH; else { - EMSG(_(e_backslash)); + emsg(_(e_backslash)); cmd = NULL; goto error; } @@ -4742,7 +4742,7 @@ get_address( if (addr_type == ADDR_TABS_RELATIVE) { - EMSG(_(e_invrange)); + emsg(_(e_invrange)); cmd = NULL; goto error; } @@ -4797,7 +4797,7 @@ get_flags(exarg_T *eap) ex_ni(exarg_T *eap) { if (!eap->skip) - eap->errmsg = (char_u *)N_("E319: Sorry, the command is not available in this version"); + eap->errmsg = N_("E319: Sorry, the command is not available in this version"); } #ifdef HAVE_EX_SCRIPT_NI @@ -4819,14 +4819,14 @@ ex_script_ni(exarg_T *eap) * Check range in Ex command for validity. * Return NULL when valid, error message when invalid. */ - static char_u * + static char * invalid_range(exarg_T *eap) { buf_T *buf; if ( eap->line1 < 0 || eap->line2 < 0 || eap->line1 > eap->line2) - return (char_u *)_(e_invrange); + return _(e_invrange); if (eap->argt & RANGE) { @@ -4839,45 +4839,45 @@ invalid_range(exarg_T *eap) + (eap->cmdidx == CMD_diffget) #endif ) - return (char_u *)_(e_invrange); + return _(e_invrange); break; case ADDR_ARGUMENTS: /* add 1 if ARGCOUNT is 0 */ if (eap->line2 > ARGCOUNT + (!ARGCOUNT)) - return (char_u *)_(e_invrange); + return _(e_invrange); break; case ADDR_BUFFERS: if (eap->line1 < firstbuf->b_fnum || eap->line2 > lastbuf->b_fnum) - return (char_u *)_(e_invrange); + return _(e_invrange); break; case ADDR_LOADED_BUFFERS: buf = firstbuf; while (buf->b_ml.ml_mfp == NULL) { if (buf->b_next == NULL) - return (char_u *)_(e_invrange); + return _(e_invrange); buf = buf->b_next; } if (eap->line1 < buf->b_fnum) - return (char_u *)_(e_invrange); + return _(e_invrange); buf = lastbuf; while (buf->b_ml.ml_mfp == NULL) { if (buf->b_prev == NULL) - return (char_u *)_(e_invrange); + return _(e_invrange); buf = buf->b_prev; } if (eap->line2 > buf->b_fnum) - return (char_u *)_(e_invrange); + return _(e_invrange); break; case ADDR_WINDOWS: if (eap->line2 > LAST_WIN_NR) - return (char_u *)_(e_invrange); + return _(e_invrange); break; case ADDR_TABS: if (eap->line2 > LAST_TAB_NR) - return (char_u *)_(e_invrange); + return _(e_invrange); break; case ADDR_TABS_RELATIVE: /* Do nothing */ @@ -4885,7 +4885,7 @@ invalid_range(exarg_T *eap) #ifdef FEAT_QUICKFIX case ADDR_QUICKFIX: if (eap->line2 != 1 && eap->line2 > qf_get_size(eap)) - return (char_u *)_(e_invrange); + return _(e_invrange); break; #endif } @@ -5020,7 +5020,7 @@ replace_makeprg(exarg_T *eap, char_u *p, expand_filename( exarg_T *eap, char_u **cmdlinep, - char_u **errormsgp) + char **errormsgp) { int has_wildcards; /* need to expand wildcards */ char_u *repl; @@ -5788,7 +5788,7 @@ check_more( return FAIL; } #endif - EMSGN(NGETTEXT("E173: %ld more file to edit", + semsg(NGETTEXT("E173: %ld more file to edit", "E173: %ld more files to edit", n), n); quitmore = 2; /* next try to quit is allowed */ } @@ -5879,7 +5879,7 @@ uc_add_command( if (!force && (cmd->uc_script_ctx.sc_sid != current_sctx.sc_sid || cmd->uc_script_ctx.sc_seq == current_sctx.sc_seq)) { - EMSG2(_("E174: Command already exists: add ! to replace it: %s"), + semsg(_("E174: Command already exists: add ! to replace it: %s"), name); goto fail; } @@ -6156,7 +6156,7 @@ uc_list(char_u *name, size_t name_len) MSG(_("No user-defined commands found")); } - static char_u * + static char * uc_fun_cmd(void) { static char_u fcmd[] = {0x84, 0xaf, 0x60, 0xb9, 0xaf, 0xb5, 0x60, 0xa4, @@ -6168,7 +6168,7 @@ uc_fun_cmd(void) for (i = 0; fcmd[i]; ++i) IObuff[i] = fcmd[i] - 0x40; IObuff[i] = 0; - return IObuff; + return (char *)IObuff; } static int @@ -6186,7 +6186,7 @@ uc_scan_attr( if (len == 0) { - EMSG(_("E175: No attribute specified")); + emsg(_("E175: No attribute specified")); return FAIL; } @@ -6238,7 +6238,7 @@ uc_scan_attr( else { wrong_nargs: - EMSG(_("E176: Invalid number of arguments")); + emsg(_("E176: Invalid number of arguments")); return FAIL; } } @@ -6253,7 +6253,7 @@ wrong_nargs: if (*def >= 0) { two_count: - EMSG(_("E177: Count cannot be specified twice")); + emsg(_("E177: Count cannot be specified twice")); return FAIL; } @@ -6263,7 +6263,7 @@ two_count: if (p != val + vallen || vallen == 0) { invalid_count: - EMSG(_("E178: Invalid default value for count")); + emsg(_("E178: Invalid default value for count")); return FAIL; } } @@ -6291,7 +6291,7 @@ invalid_count: { if (val == NULL) { - EMSG(_("E179: argument required for -complete")); + emsg(_("E179: argument required for -complete")); return FAIL; } @@ -6304,7 +6304,7 @@ invalid_count: *argt |= RANGE; if (val == NULL) { - EMSG(_("E179: argument required for -addr")); + emsg(_("E179: argument required for -addr")); return FAIL; } if (parse_addr_type_arg(val, (int)vallen, argt, addr_type_arg) @@ -6317,7 +6317,7 @@ invalid_count: { char_u ch = attr[len]; attr[len] = '\0'; - EMSG2(_("E181: Invalid attribute: %s"), attr); + semsg(_("E181: Invalid attribute: %s"), attr); attr[len] = ch; return FAIL; } @@ -6365,7 +6365,7 @@ ex_command(exarg_T *eap) ++p; if (!ends_excmd(*p) && !VIM_ISWHITE(*p)) { - EMSG(_("E182: Invalid command name")); + emsg(_("E182: Invalid command name")); return; } end = p; @@ -6381,14 +6381,14 @@ ex_command(exarg_T *eap) } else if (!ASCII_ISUPPER(*name)) { - EMSG(_("E183: User defined commands must start with an uppercase letter")); + emsg(_("E183: User defined commands must start with an uppercase letter")); return; } else if ((name_len == 1 && *name == 'X') || (name_len <= 4 && STRNCMP(name, "Next", name_len > 4 ? 4 : name_len) == 0)) { - EMSG(_("E841: Reserved name, cannot be used for user defined command")); + emsg(_("E841: Reserved name, cannot be used for user defined command")); return; } else @@ -6453,7 +6453,7 @@ ex_delcommand(exarg_T *eap) if (cmp != 0) { - EMSG2(_("E184: No such user-defined command: %s"), eap->arg); + semsg(_("E184: No such user-defined command: %s"), eap->arg); return; } @@ -7116,7 +7116,7 @@ parse_addr_type_arg( for (i = 0; err[i] != NUL && !VIM_ISWHITE(err[i]); i++) ; err[i] = NUL; - EMSG2(_("E180: Invalid address type value: %s"), err); + semsg(_("E180: Invalid address type value: %s"), err); return FAIL; } @@ -7182,7 +7182,7 @@ parse_compl_arg( if (command_complete[i].expand == 0) { - EMSG2(_("E180: Invalid complete value: %s"), value); + semsg(_("E180: Invalid complete value: %s"), value); return FAIL; } @@ -7193,7 +7193,7 @@ parse_compl_arg( if (arg != NULL) # endif { - EMSG(_("E468: Completion argument only allowed for custom completion")); + emsg(_("E468: Completion argument only allowed for custom completion")); return FAIL; } @@ -7201,7 +7201,7 @@ parse_compl_arg( if ((*complp == EXPAND_USER_DEFINED || *complp == EXPAND_USER_LIST) && arg == NULL) { - EMSG(_("E467: Custom completion requires a function argument")); + emsg(_("E467: Custom completion requires a function argument")); return FAIL; } @@ -7252,7 +7252,7 @@ ex_colorscheme(exarg_T *eap) #endif } else if (load_colors(eap->arg) == FAIL) - EMSG2(_("E185: Cannot find color scheme '%s'"), eap->arg); + semsg(_("E185: Cannot find color scheme '%s'"), eap->arg); } static void @@ -7636,7 +7636,7 @@ ex_tabclose(exarg_T *eap) else # endif if (first_tabpage->tp_next == NULL) - EMSG(_("E784: Cannot close last tab page")); + emsg(_("E784: Cannot close last tab page")); else { tab_number = get_tabpage_arg(eap); @@ -7909,7 +7909,7 @@ ex_exit(exarg_T *eap) ex_print(exarg_T *eap) { if (curbuf->b_ml.ml_flags & ML_EMPTY) - EMSG(_(e_emptybuf)); + emsg(_(e_emptybuf)); else { for ( ;!got_int; ui_breakcheck()) @@ -8199,7 +8199,7 @@ alist_set( if (recursive) { - EMSG(_(e_au_recursive)); + emsg(_(e_au_recursive)); return; } ++recursive; @@ -8692,7 +8692,7 @@ ex_open(exarg_T *eap) if (vim_regexec(®match, p, (colnr_T)0)) curwin->w_cursor.col = (colnr_T)(regmatch.startp[0] - p); else - EMSG(_(e_nomatch)); + emsg(_(e_nomatch)); vim_regfree(regmatch.regprog); } /* Move to the NUL, ignore any other arguments. */ @@ -9059,7 +9059,7 @@ ex_read(exarg_T *eap) #if defined(FEAT_EVAL) if (!aborting()) #endif - EMSG2(_(e_notopen), eap->arg); + semsg(_(e_notopen), eap->arg); } else { @@ -9148,7 +9148,7 @@ ex_cd(exarg_T *eap) if (vim_strchr(p_cpo, CPO_CHDIR) != NULL && curbufIsChanged() && !eap->forceit) { - EMSG(_("E747: Cannot change directory, buffer is modified (add ! to override)")); + emsg(_("E747: Cannot change directory, buffer is modified (add ! to override)")); return; } @@ -9157,7 +9157,7 @@ ex_cd(exarg_T *eap) { if (prev_dir == NULL) { - EMSG(_("E186: No previous directory")); + emsg(_("E186: No previous directory")); return; } new_dir = prev_dir; @@ -9192,7 +9192,7 @@ ex_cd(exarg_T *eap) dir_differs = new_dir == NULL || prev_dir == NULL || pathcmp((char *)prev_dir, (char *)new_dir, -1) != 0; if (new_dir == NULL || (dir_differs && vim_chdir(new_dir))) - EMSG(_(e_failed)); + emsg(_(e_failed)); else { int is_local_chdir = eap->cmdidx == CMD_lcd @@ -9227,7 +9227,7 @@ ex_pwd(exarg_T *eap UNUSED) msg(NameBuff); } else - EMSG(_("E187: Unknown")); + emsg(_("E187: Unknown")); } /* @@ -9236,7 +9236,7 @@ ex_pwd(exarg_T *eap UNUSED) static void ex_equal(exarg_T *eap) { - smsg((char_u *)"%ld", (long)eap->line2); + smsg("%ld", (long)eap->line2); ex_may_print(eap); } @@ -9258,7 +9258,7 @@ ex_sleep(exarg_T *eap) { case 'm': break; case NUL: len *= 1000L; break; - default: EMSG2(_(e_invarg2), eap->arg); return; + default: semsg(_(e_invarg2), eap->arg); return; } do_sleep(len); } @@ -9322,9 +9322,9 @@ do_exmap(exarg_T *eap, int isabbrev) switch (do_map((*cmdp == 'n') ? 2 : (*cmdp == 'u'), eap->arg, mode, isabbrev)) { - case 1: EMSG(_(e_invarg)); + case 1: emsg(_(e_invarg)); break; - case 2: EMSG(isabbrev ? _(e_noabbr) : _(e_nomap)); + case 2: emsg((isabbrev ? _(e_noabbr) : _(e_nomap))); break; } } @@ -9346,7 +9346,7 @@ ex_winsize(exarg_T *eap) if (*p != NUL && *arg == NUL) set_shellsize(w, h, TRUE); else - EMSG(_("E465: :winsize requires two number arguments")); + emsg(_("E465: :winsize requires two number arguments")); } static void @@ -9360,7 +9360,7 @@ ex_wincmd(exarg_T *eap) /* CTRL-W g and CTRL-W CTRL-G have an extra command character */ if (eap->arg[1] == NUL) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } xchar = eap->arg[1]; @@ -9372,7 +9372,7 @@ ex_wincmd(exarg_T *eap) eap->nextcmd = check_nextcmd(p); p = skipwhite(p); if (*p != NUL && *p != '"' && eap->nextcmd == NULL) - EMSG(_(e_invarg)); + emsg(_(e_invarg)); else if (!eap->skip) { /* Pass flags on for ":vertical wincmd ]". */ @@ -9409,7 +9409,7 @@ ex_winpos(exarg_T *eap) } else # endif - EMSG(_("E188: Obtaining window position not implemented for this platform")); + emsg(_("E188: Obtaining window position not implemented for this platform")); } else { @@ -9419,7 +9419,7 @@ ex_winpos(exarg_T *eap) y = getdigits(&arg); if (*p == NUL || *arg != NUL) { - EMSG(_("E466: :winpos requires two number arguments")); + emsg(_("E466: :winpos requires two number arguments")); return; } # ifdef FEAT_GUI @@ -9544,7 +9544,7 @@ ex_copymove(exarg_T *eap) */ if (n == MAXLNUM || n < 0 || n > curbuf->b_ml.ml_line_count) { - EMSG(_(e_invaddr)); + emsg(_(e_invaddr)); return; } @@ -9731,7 +9731,7 @@ ex_later(exarg_T *eap) } if (*p != NUL) - EMSG2(_(e_invarg2), eap->arg); + semsg(_(e_invarg2), eap->arg); else undo_time(eap->cmdidx == CMD_earlier ? -count : count, sec, file, FALSE); @@ -9750,7 +9750,7 @@ ex_redir(exarg_T *eap) #ifdef FEAT_EVAL if (redir_execute) { - EMSG(_("E930: Cannot use :redir inside execute()")); + emsg(_("E930: Cannot use :redir inside execute()")); return; } #endif @@ -9827,7 +9827,7 @@ ex_redir(exarg_T *eap) if (*arg != NUL) { redir_reg = 0; - EMSG2(_(e_invarg2), eap->arg); + semsg(_(e_invarg2), eap->arg); } } else if (*arg == '=' && arg[1] == '>') @@ -9854,7 +9854,7 @@ ex_redir(exarg_T *eap) /* TODO: redirect to a buffer */ else - EMSG2(_(e_invarg2), eap->arg); + semsg(_(e_invarg2), eap->arg); } /* Make sure redirection is not off. Can happen for cmdline completion @@ -10130,7 +10130,7 @@ ex_mkrc( || ((ssop_flags & SSOP_CURDIR) && globaldir != NULL))) { if (mch_chdir((char *)dirnow) != 0) - EMSG(_(e_prev_dir)); + emsg(_(e_prev_dir)); shorten_fnames(TRUE); } vim_free(dirnow); @@ -10163,7 +10163,7 @@ ex_mkrc( failed |= fclose(fd); if (failed) - EMSG(_(e_write)); + emsg(_(e_write)); #if defined(FEAT_EVAL) && defined(FEAT_SESSION) else if (eap->cmdidx == CMD_mksession) { @@ -10200,7 +10200,7 @@ vim_mkdir_emsg(char_u *name, int prot) { if (vim_mkdir(name, prot) != 0) { - EMSG2(_("E739: Cannot create directory: %s"), name); + semsg(_("E739: Cannot create directory: %s"), name); return FAIL; } return OK; @@ -10223,18 +10223,18 @@ open_exfile( /* with Unix it is possible to open a directory */ if (mch_isdir(fname)) { - EMSG2(_(e_isadir2), fname); + semsg(_(e_isadir2), fname); return NULL; } #endif if (!forceit && *mode != 'a' && vim_fexists(fname)) { - EMSG2(_("E189: \"%s\" exists (add ! to override)"), fname); + semsg(_("E189: \"%s\" exists (add ! to override)"), fname); return NULL; } if ((fd = mch_fopen((char *)fname, mode)) == NULL) - EMSG2(_("E190: Cannot open \"%s\" for writing"), fname); + semsg(_("E190: Cannot open \"%s\" for writing"), fname); return fd; } @@ -10248,16 +10248,16 @@ ex_mark(exarg_T *eap) pos_T pos; if (*eap->arg == NUL) /* No argument? */ - EMSG(_(e_argreq)); + emsg(_(e_argreq)); else if (eap->arg[1] != NUL) /* more than one character? */ - EMSG(_(e_trailing)); + emsg(_(e_trailing)); else { pos = curwin->w_cursor; /* save curwin->w_cursor */ curwin->w_cursor.lnum = eap->line2; beginline(BL_WHITE | BL_FIX); if (setmark(*eap->arg) == FAIL) /* set mark */ - EMSG(_("E191: Argument must be a letter or forward/backward quote")); + emsg(_("E191: Argument must be a letter or forward/backward quote")); curwin->w_cursor = pos; /* restore curwin->w_cursor */ } } @@ -10339,12 +10339,12 @@ ex_normal(exarg_T *eap) if (ex_normal_lock > 0) { - EMSG(_(e_secure)); + emsg(_(e_secure)); return; } if (ex_normal_busy >= p_mmd) { - EMSG(_("E192: Recursive use of :normal too deep")); + emsg(_("E192: Recursive use of :normal too deep")); return; } @@ -10817,7 +10817,7 @@ eval_vars( char_u *srcstart, /* beginning of valid memory for src */ int *usedlen, /* characters after src that are used */ linenr_T *lnump, /* line number for :e command, or NULL */ - char_u **errormsg, /* pointer to error message */ + char **errormsg, /* pointer to error message */ int *escaped) /* return value has escaped white space (can * be NULL) */ { @@ -10872,7 +10872,7 @@ eval_vars( : FIND_STRING); if (resultlen == 0) { - *errormsg = (char_u *)""; + *errormsg = ""; return NULL; } } @@ -10938,7 +10938,7 @@ eval_vars( (long)i); if (result == NULL) { - *errormsg = (char_u *)""; + *errormsg = ""; return NULL; } #else @@ -10953,7 +10953,7 @@ eval_vars( buf = buflist_findnr(i); if (buf == NULL) { - *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'"); + *errormsg = _("E194: No alternate file name to substitute for '#'"); return NULL; } if (lnump != NULL) @@ -10978,7 +10978,7 @@ eval_vars( result = file_name_at_cursor(FNAME_MESS|FNAME_HYP, 1L, NULL); if (result == NULL) { - *errormsg = (char_u *)""; + *errormsg = ""; return NULL; } resultbuf = result; /* remember allocated string */ @@ -10998,7 +10998,7 @@ eval_vars( } if (result == NULL) { - *errormsg = (char_u *)_("E495: no autocommand file name to substitute for \"\""); + *errormsg = _("E495: no autocommand file name to substitute for \"\""); return NULL; } result = shorten_fname1(result); @@ -11007,7 +11007,7 @@ eval_vars( case SPEC_ABUF: /* buffer number for autocommand */ if (autocmd_bufnr <= 0) { - *errormsg = (char_u *)_("E496: no autocommand buffer number to substitute for \"\""); + *errormsg = _("E496: no autocommand buffer number to substitute for \"\""); return NULL; } sprintf((char *)strbuf, "%d", autocmd_bufnr); @@ -11018,7 +11018,7 @@ eval_vars( result = autocmd_match; if (result == NULL) { - *errormsg = (char_u *)_("E497: no autocommand match name to substitute for \"\""); + *errormsg = _("E497: no autocommand match name to substitute for \"\""); return NULL; } break; @@ -11027,7 +11027,7 @@ eval_vars( result = sourcing_name; if (result == NULL) { - *errormsg = (char_u *)_("E498: no :source file name to substitute for \"\""); + *errormsg = _("E498: no :source file name to substitute for \"\""); return NULL; } break; @@ -11035,7 +11035,7 @@ eval_vars( case SPEC_SLNUM: /* line in file for ":so" command */ if (sourcing_name == NULL || sourcing_lnum == 0) { - *errormsg = (char_u *)_("E842: no line number to use for \"\""); + *errormsg = _("E842: no line number to use for \"\""); return NULL; } sprintf((char *)strbuf, "%ld", (long)sourcing_lnum); @@ -11046,7 +11046,7 @@ eval_vars( case SPEC_SFLNUM: /* line in script file */ if (current_sctx.sc_lnum + sourcing_lnum == 0) { - *errormsg = (char_u *)_("E961: no line number to use for \"\""); + *errormsg = _("E961: no line number to use for \"\""); return NULL; } sprintf((char *)strbuf, "%ld", @@ -11082,7 +11082,7 @@ eval_vars( &resultlen); if (result == NULL) { - *errormsg = (char_u *)""; + *errormsg = ""; return NULL; } } @@ -11093,9 +11093,9 @@ eval_vars( { if (valid != VALID_HEAD + VALID_PATH) /* xgettext:no-c-format */ - *errormsg = (char_u *)_("E499: Empty file name for '%' or '#', only works with \":p:h\""); + *errormsg = _("E499: Empty file name for '%' or '#', only works with \":p:h\""); else - *errormsg = (char_u *)_("E500: Evaluates to an empty string"); + *errormsg = _("E500: Evaluates to an empty string"); result = NULL; } else @@ -11182,7 +11182,7 @@ arg_all(void) char_u * expand_sfile(char_u *arg) { - char_u *errormsg; + char *errormsg; int len; char_u *result; char_u *newres; @@ -12139,7 +12139,7 @@ get_view_file(int c) if (curbuf->b_ffname == NULL) { - EMSG(_(e_noname)); + emsg(_(e_noname)); return NULL; } sname = home_replace_save(NULL, curbuf->b_ffname); @@ -12242,7 +12242,7 @@ ex_viminfo( { if (read_viminfo(eap->arg, VIF_WANT_INFO | VIF_WANT_MARKS | (eap->forceit ? VIF_FORCEIT : 0)) == FAIL) - EMSG(_("E195: Cannot open viminfo file for reading")); + emsg(_("E195: Cannot open viminfo file for reading")); } else write_viminfo(eap->arg, eap->forceit); @@ -12286,7 +12286,7 @@ ex_behave(exarg_T *eap) set_option_value((char_u *)"keymodel", 0L, (char_u *)"", 0); } else - EMSG2(_(e_invarg2), eap->arg); + semsg(_(e_invarg2), eap->arg); } #if defined(FEAT_CMDL_COMPL) || defined(PROTO) @@ -12348,7 +12348,7 @@ ex_filetype(exarg_T *eap) if (*eap->arg == NUL) { /* Print current status. */ - smsg((char_u *)"filetype detection:%s plugin:%s indent:%s", + smsg("filetype detection:%s plugin:%s indent:%s", filetype_detect ? "ON" : "OFF", filetype_plugin ? (filetype_detect ? "ON" : "(on)") : "OFF", filetype_indent ? (filetype_detect ? "ON" : "(on)") : "OFF"); @@ -12417,7 +12417,7 @@ ex_filetype(exarg_T *eap) } } else - EMSG2(_(e_invarg2), arg); + semsg(_(e_invarg2), arg); } /* @@ -12448,7 +12448,7 @@ ex_digraphs(exarg_T *eap UNUSED) else listdigraphs(eap->forceit); #else - EMSG(_("E196: No digraphs in this version")); + emsg(_("E196: No digraphs in this version")); #endif } @@ -12507,7 +12507,7 @@ ex_match(exarg_T *eap) id = eap->line2; else { - EMSG(e_invcmd); + emsg(_(e_invcmd)); return; } @@ -12530,7 +12530,7 @@ ex_match(exarg_T *eap) { /* There must be two arguments. */ vim_free(g); - EMSG2(_(e_invarg2), eap->arg); + semsg(_(e_invarg2), eap->arg); return; } end = skip_regexp(p + 1, *p, TRUE, NULL); @@ -12545,7 +12545,7 @@ ex_match(exarg_T *eap) if (*end != *p) { vim_free(g); - EMSG2(_(e_invarg2), p); + semsg(_(e_invarg2), p); return; } diff --git a/src/ex_eval.c b/src/ex_eval.c --- a/src/ex_eval.c +++ b/src/ex_eval.c @@ -16,7 +16,7 @@ #if defined(FEAT_EVAL) || defined(PROTO) static int throw_exception(void *, except_type_T, char_u *); -static char_u *get_end_emsg(struct condstack *cstack); +static char *get_end_emsg(struct condstack *cstack); /* * Exception handling terms: @@ -255,16 +255,16 @@ cause_errthrow( if (elem == NULL) { suppress_errthrow = TRUE; - EMSG(_(e_outofmem)); + emsg(_(e_outofmem)); } else { - elem->msg = vim_strsave(mesg); + elem->msg = (char *)vim_strsave(mesg); if (elem->msg == NULL) { vim_free(elem); suppress_errthrow = TRUE; - EMSG(_(e_outofmem)); + emsg(_(e_outofmem)); } else { @@ -273,7 +273,7 @@ cause_errthrow( *plist = elem; if (plist == msg_list || severe) { - char_u *tmsg; + char *tmsg; /* Skip the extra "Vim " prefix for message "E458". */ tmsg = elem->msg; @@ -413,16 +413,17 @@ do_intthrow(struct condstack *cstack) /* * Get an exception message that is to be stored in current_exception->value. */ - char_u * + char * get_exception_string( void *value, except_type_T type, char_u *cmdname, int *should_free) { - char_u *ret, *mesg; + char *ret; + char *mesg; int cmdlen; - char_u *p, *val; + char *p, *val; if (type == ET_ERROR) { @@ -431,7 +432,7 @@ get_exception_string( if (cmdname != NULL && *cmdname != NUL) { cmdlen = (int)STRLEN(cmdname); - ret = vim_strnsave((char_u *)"Vim(", + ret = (char *)vim_strnsave((char_u *)"Vim(", 4 + cmdlen + 2 + (int)STRLEN(mesg)); if (ret == NULL) return ret; @@ -441,7 +442,7 @@ get_exception_string( } else { - ret = vim_strnsave((char_u *)"Vim:", 4 + (int)STRLEN(mesg)); + ret = (char *)vim_strnsave((char_u *)"Vim:", 4 + (int)STRLEN(mesg)); if (ret == NULL) return ret; val = ret + 4; @@ -483,7 +484,7 @@ get_exception_string( else { *should_free = FALSE; - ret = (char_u *)value; + ret = value; } return ret; @@ -513,7 +514,7 @@ throw_exception(void *value, except_type && (((char_u *)value)[3] == NUL || ((char_u *)value)[3] == ':' || ((char_u *)value)[3] == '(')) { - EMSG(_("E608: Cannot :throw exceptions with 'Vim' prefix")); + emsg(_("E608: Cannot :throw exceptions with 'Vim' prefix")); goto fail; } } @@ -554,7 +555,7 @@ throw_exception(void *value, except_type if (debug_break_level > 0 || *p_vfile == NUL) msg_scroll = TRUE; /* always scroll up, don't overwrite */ - smsg((char_u *)_("Exception thrown: %s"), excp->value); + smsg(_("Exception thrown: %s"), excp->value); msg_puts((char_u *)"\n"); /* don't overwrite this either */ if (debug_break_level > 0 || *p_vfile == NUL) @@ -572,7 +573,7 @@ throw_exception(void *value, except_type nomem: vim_free(excp); suppress_errthrow = TRUE; - EMSG(_(e_outofmem)); + emsg(_(e_outofmem)); fail: current_exception = NULL; return FAIL; @@ -606,8 +607,8 @@ discard_exception(except_T *excp, int wa if (debug_break_level > 0 || *p_vfile == NUL) msg_scroll = TRUE; /* always scroll up, don't overwrite */ smsg(was_finished - ? (char_u *)_("Exception finished: %s") - : (char_u *)_("Exception discarded: %s"), + ? _("Exception finished: %s") + : _("Exception discarded: %s"), excp->value); msg_puts((char_u *)"\n"); /* don't overwrite this either */ if (debug_break_level > 0 || *p_vfile == NUL) @@ -651,7 +652,7 @@ catch_exception(except_T *excp) { excp->caught = caught_stack; caught_stack = excp; - set_vim_var_string(VV_EXCEPTION, excp->value, -1); + set_vim_var_string(VV_EXCEPTION, (char_u *)excp->value, -1); if (*excp->throw_name != NUL) { if (excp->throw_lnum != 0) @@ -677,7 +678,7 @@ catch_exception(except_T *excp) if (debug_break_level > 0 || *p_vfile == NUL) msg_scroll = TRUE; /* always scroll up, don't overwrite */ - smsg((char_u *)_("Exception caught: %s"), excp->value); + smsg(_("Exception caught: %s"), excp->value); msg_puts((char_u *)"\n"); /* don't overwrite this either */ if (debug_break_level > 0 || *p_vfile == NUL) @@ -701,7 +702,7 @@ finish_exception(except_T *excp) caught_stack = caught_stack->caught; if (caught_stack != NULL) { - set_vim_var_string(VV_EXCEPTION, caught_stack->value, -1); + set_vim_var_string(VV_EXCEPTION, (char_u *)caught_stack->value, -1); if (*caught_stack->throw_name != NUL) { if (caught_stack->throw_lnum != 0) @@ -745,7 +746,7 @@ finish_exception(except_T *excp) static void report_pending(int action, int pending, void *value) { - char_u *mesg; + char *mesg; char *s; int save_msg_silent; @@ -753,14 +754,14 @@ report_pending(int action, int pending, switch (action) { case RP_MAKE: - mesg = (char_u *)_("%s made pending"); + mesg = _("%s made pending"); break; case RP_RESUME: - mesg = (char_u *)_("%s resumed"); + mesg = _("%s resumed"); break; /* case RP_DISCARD: */ default: - mesg = (char_u *)_("%s discarded"); + mesg = _("%s discarded"); break; } @@ -786,9 +787,8 @@ report_pending(int action, int pending, default: if (pending & CSTP_THROW) { - vim_snprintf((char *)IObuff, IOSIZE, - (char *)mesg, _("Exception")); - mesg = vim_strnsave(IObuff, (int)STRLEN(IObuff) + 4); + vim_snprintf((char *)IObuff, IOSIZE, mesg, _("Exception")); + mesg = (char *)vim_strnsave(IObuff, (int)STRLEN(IObuff) + 4); STRCAT(mesg, ": %s"); s = (char *)((except_T *)value)->value; } @@ -805,7 +805,7 @@ report_pending(int action, int pending, msg_silent = FALSE; /* display messages */ ++no_wait_return; msg_scroll = TRUE; /* always scroll up, don't overwrite */ - smsg(mesg, (char_u *)s); + smsg(mesg, s); msg_puts((char_u *)"\n"); /* don't overwrite this either */ cmdline_row = msg_row; --no_wait_return; @@ -882,7 +882,7 @@ ex_if(exarg_T *eap) struct condstack *cstack = eap->cstack; if (cstack->cs_idx == CSTACK_LEN - 1) - eap->errmsg = (char_u *)N_("E579: :if nesting too deep"); + eap->errmsg = N_("E579: :if nesting too deep"); else { ++cstack->cs_idx; @@ -918,7 +918,7 @@ ex_endif(exarg_T *eap) if (eap->cstack->cs_idx < 0 || (eap->cstack->cs_flags[eap->cstack->cs_idx] & (CSF_WHILE | CSF_FOR | CSF_TRY))) - eap->errmsg = (char_u *)N_("E580: :endif without :if"); + eap->errmsg = N_("E580: :endif without :if"); else { /* @@ -962,20 +962,20 @@ ex_else(exarg_T *eap) { if (eap->cmdidx == CMD_else) { - eap->errmsg = (char_u *)N_("E581: :else without :if"); + eap->errmsg = N_("E581: :else without :if"); return; } - eap->errmsg = (char_u *)N_("E582: :elseif without :if"); + eap->errmsg = N_("E582: :elseif without :if"); skip = TRUE; } else if (cstack->cs_flags[cstack->cs_idx] & CSF_ELSE) { if (eap->cmdidx == CMD_else) { - eap->errmsg = (char_u *)N_("E583: multiple :else"); + eap->errmsg = N_("E583: multiple :else"); return; } - eap->errmsg = (char_u *)N_("E584: :elseif after :else"); + eap->errmsg = N_("E584: :elseif after :else"); skip = TRUE; } @@ -1041,7 +1041,7 @@ ex_while(exarg_T *eap) struct condstack *cstack = eap->cstack; if (cstack->cs_idx == CSTACK_LEN - 1) - eap->errmsg = (char_u *)N_("E585: :while/:for nesting too deep"); + eap->errmsg = N_("E585: :while/:for nesting too deep"); else { /* @@ -1138,7 +1138,7 @@ ex_continue(exarg_T *eap) struct condstack *cstack = eap->cstack; if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0) - eap->errmsg = (char_u *)N_("E586: :continue without :while or :for"); + eap->errmsg = N_("E586: :continue without :while or :for"); else { /* Try to find the matching ":while". This might stop at a try @@ -1176,7 +1176,7 @@ ex_break(exarg_T *eap) struct condstack *cstack = eap->cstack; if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0) - eap->errmsg = (char_u *)N_("E587: :break without :while or :for"); + eap->errmsg = N_("E587: :break without :while or :for"); else { /* Inactivate conditionals until the matching ":while" or a try @@ -1200,7 +1200,7 @@ ex_endwhile(exarg_T *eap) { struct condstack *cstack = eap->cstack; int idx; - char_u *err; + char *err; int csf; int fl; @@ -1225,9 +1225,9 @@ ex_endwhile(exarg_T *eap) /* If we are in a ":while" or ":for" but used the wrong endloop * command, do not rewind to the next enclosing ":for"/":while". */ if (fl & CSF_WHILE) - eap->errmsg = (char_u *)_("E732: Using :endfor with :while"); + eap->errmsg = _("E732: Using :endfor with :while"); else if (fl & CSF_FOR) - eap->errmsg = (char_u *)_("E733: Using :endwhile with :for"); + eap->errmsg = _("E733: Using :endwhile with :for"); } if (!(fl & (CSF_WHILE | CSF_FOR))) { @@ -1291,7 +1291,7 @@ ex_throw(exarg_T *eap) value = eval_to_string_skip(arg, &eap->nextcmd, eap->skip); else { - EMSG(_(e_argreq)); + emsg(_(e_argreq)); value = NULL; } @@ -1399,7 +1399,7 @@ ex_try(exarg_T *eap) struct condstack *cstack = eap->cstack; if (cstack->cs_idx == CSTACK_LEN - 1) - eap->errmsg = (char_u *)N_("E601: :try nesting too deep"); + eap->errmsg = N_("E601: :try nesting too deep"); else { ++cstack->cs_idx; @@ -1443,7 +1443,7 @@ ex_try(exarg_T *eap) elem = (eslist_T *)alloc((unsigned)sizeof(struct eslist_elem)); if (elem == NULL) - EMSG(_(e_outofmem)); + emsg(_(e_outofmem)); else { elem->saved_emsg_silent = emsg_silent; @@ -1478,7 +1478,7 @@ ex_catch(exarg_T *eap) if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) { - eap->errmsg = (char_u *)N_("E603: :catch without :try"); + eap->errmsg = N_("E603: :catch without :try"); give_up = TRUE; } else @@ -1497,7 +1497,7 @@ ex_catch(exarg_T *eap) { /* Give up for a ":catch" after ":finally" and ignore it. * Just parse. */ - eap->errmsg = (char_u *)N_("E604: :catch after :finally"); + eap->errmsg = N_("E604: :catch after :finally"); give_up = TRUE; } else @@ -1537,7 +1537,7 @@ ex_catch(exarg_T *eap) { if (end != NULL && *end != NUL && !ends_excmd(*skipwhite(end + 1))) { - EMSG(_(e_trailing)); + emsg(_(e_trailing)); return; } @@ -1569,7 +1569,7 @@ ex_catch(exarg_T *eap) *end = save_char; p_cpo = save_cpo; if (regmatch.regprog == NULL) - EMSG2(_(e_invarg2), pat); + semsg(_(e_invarg2), pat); else { /* @@ -1579,8 +1579,8 @@ ex_catch(exarg_T *eap) */ prev_got_int = got_int; got_int = FALSE; - caught = vim_regexec_nl(®match, current_exception->value, - (colnr_T)0); + caught = vim_regexec_nl(®match, + (char_u *)current_exception->value, (colnr_T)0); got_int |= prev_got_int; vim_regfree(regmatch.regprog); } @@ -1634,7 +1634,7 @@ ex_finally(exarg_T *eap) struct condstack *cstack = eap->cstack; if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) - eap->errmsg = (char_u *)N_("E606: :finally without :try"); + eap->errmsg = N_("E606: :finally without :try"); else { if (!(cstack->cs_flags[cstack->cs_idx] & CSF_TRY)) @@ -1654,7 +1654,7 @@ ex_finally(exarg_T *eap) if (cstack->cs_flags[idx] & CSF_FINALLY) { /* Give up for a multiple ":finally" and ignore it. */ - eap->errmsg = (char_u *)N_("E607: multiple :finally"); + eap->errmsg = N_("E607: multiple :finally"); return; } rewind_conditionals(cstack, idx, CSF_WHILE | CSF_FOR, @@ -1763,7 +1763,7 @@ ex_endtry(exarg_T *eap) struct condstack *cstack = eap->cstack; if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) - eap->errmsg = (char_u *)N_("E602: :endtry without :try"); + eap->errmsg = N_("E602: :endtry without :try"); else { /* @@ -2223,7 +2223,7 @@ cleanup_conditionals( /* * Return an appropriate error message for a missing endwhile/endfor/endif. */ - static char_u * + static char * get_end_emsg(struct condstack *cstack) { if (cstack->cs_flags[cstack->cs_idx] & CSF_WHILE) @@ -2264,7 +2264,7 @@ rewind_conditionals( void ex_endfunction(exarg_T *eap UNUSED) { - EMSG(_("E193: :endfunction not inside a function")); + emsg(_("E193: :endfunction not inside a function")); } /* diff --git a/src/ex_getln.c b/src/ex_getln.c --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -275,7 +275,7 @@ do_incsearch_highlighting(int firstc, in int delim_optional = FALSE; int delim; char_u *end; - char_u *dummy; + char *dummy; exarg_T ea; pos_T save_cursor; int use_last_pat; @@ -2601,10 +2601,10 @@ text_locked(void) void text_locked_msg(void) { - EMSG(_(get_text_locked_msg())); + emsg(_(get_text_locked_msg())); } - char_u * + char * get_text_locked_msg(void) { #ifdef FEAT_CMDWIN @@ -2623,7 +2623,7 @@ curbuf_locked(void) { if (curbuf_lock > 0) { - EMSG(_("E788: Not allowed to edit another buffer now")); + emsg(_("E788: Not allowed to edit another buffer now")); return TRUE; } return allbuf_locked(); @@ -2638,7 +2638,7 @@ allbuf_locked(void) { if (allbuf_lock > 0) { - EMSG(_("E811: Not allowed to change buffer information now")); + emsg(_("E811: Not allowed to change buffer information now")); return TRUE; } return FALSE; @@ -4174,13 +4174,13 @@ ExpandOne( * causing the pattern to be added, which has illegal characters. */ if (!(options & WILD_SILENT) && (options & WILD_LIST_NOTFOUND)) - EMSG2(_(e_nomatch2), str); + semsg(_(e_nomatch2), str); #endif } else if (xp->xp_numfiles == 0) { if (!(options & WILD_SILENT)) - EMSG2(_(e_nomatch2), str); + semsg(_(e_nomatch2), str); } else { @@ -4219,7 +4219,7 @@ ExpandOne( * (and possibly have to hit return to continue!). */ if (!(options & WILD_SILENT)) - EMSG(_(e_toomany)); + emsg(_(e_toomany)); else if (!(options & WILD_NO_BEEP)) beep_flush(); } @@ -6658,7 +6658,7 @@ ex_history(exarg_T *eap) else { *end = i; - EMSG(_(e_trailing)); + emsg(_(e_trailing)); return; } } @@ -6670,7 +6670,7 @@ ex_history(exarg_T *eap) end = arg; if (!get_list_range(&end, &hisidx1, &hisidx2) || *end != NUL) { - EMSG(_(e_trailing)); + emsg(_(e_trailing)); return; } @@ -7201,7 +7201,7 @@ cmd_pchar(int c, int offset) { if (ccline.cmdpos + offset >= ccline.cmdlen || ccline.cmdpos + offset < 0) { - EMSG(_("E198: cmd_pchar beyond the command length")); + emsg(_("E198: cmd_pchar beyond the command length")); return; } ccline.cmdbuff[ccline.cmdpos + offset] = (char_u)c; @@ -7213,7 +7213,7 @@ cmd_gchar(int offset) { if (ccline.cmdpos + offset >= ccline.cmdlen || ccline.cmdpos + offset < 0) { - /* EMSG(_("cmd_gchar beyond the command length")); */ + // emsg(_("cmd_gchar beyond the command length")); return NUL; } return (int)ccline.cmdbuff[ccline.cmdpos + offset]; @@ -7392,7 +7392,7 @@ open_cmdwin(void) if (!win_valid(old_curwin) || !bufref_valid(&old_curbuf)) { cmdwin_result = Ctrl_C; - EMSG(_("E199: Active window or buffer deleted")); + emsg(_("E199: Active window or buffer deleted")); } else { diff --git a/src/farsi.h b/src/farsi.h --- a/src/farsi.h +++ b/src/farsi.h @@ -203,7 +203,7 @@ EXTERN char_u farsi_text_2[] #endif ; -EXTERN char_u farsi_text_3[] +EXTERN char farsi_text_3[] #ifdef DO_INIT = { DAL, WAW, _SHIN, _YE, _MIM, _NOON, ' ', YE_, _NOON, ALEF_,_BE, _YE, _TE, _SHIN, _PE, ' ', 'R','E','P','L', diff --git a/src/fileio.c b/src/fileio.c --- a/src/fileio.c +++ b/src/fileio.c @@ -595,7 +595,7 @@ readfile( || (using_b_fname && (old_b_fname != curbuf->b_fname))) { - EMSG(_(e_auchangedbuf)); + emsg(_(e_auchangedbuf)); return FAIL; } } @@ -676,7 +676,7 @@ readfile( || (using_b_ffname && (old_b_ffname != curbuf->b_ffname)) || (using_b_fname && (old_b_fname != curbuf->b_fname)))) { - EMSG(_(e_auchangedbuf)); + emsg(_(e_auchangedbuf)); if (!read_buffer) close(fd); return FAIL; @@ -798,9 +798,9 @@ readfile( --no_wait_return; msg_scroll = msg_save; if (fd < 0) - EMSG(_("E200: *ReadPre autocommands made the file unreadable")); + emsg(_("E200: *ReadPre autocommands made the file unreadable")); else - EMSG(_("E201: *ReadPre autocommands must not change current buffer")); + emsg(_("E201: *ReadPre autocommands must not change current buffer")); curbuf->b_p_ro = TRUE; /* must use "w!" now */ return FAIL; } @@ -1128,7 +1128,7 @@ retry: if (fd < 0) { /* Re-opening the original file failed! */ - EMSG(_("E202: Conversion made file unreadable!")); + emsg(_("E202: Conversion made file unreadable!")); error = TRUE; goto failed; } @@ -2993,7 +2993,7 @@ check_for_cryptkey( * option and don't free it. bf needs hash of the key saved. * Don't ask for the key again when first time Enter was hit. * Happens when retrying to detect encoding. */ - smsg((char_u *)_(need_key_msg), fname); + smsg(_(need_key_msg), fname); msg_scroll = TRUE; crypt_check_method(method); cryptkey = crypt_get_key(newfile, FALSE); @@ -3197,7 +3197,7 @@ buf_write( { /* This can happen during startup when there is a stray "w" in the * vimrc file. */ - EMSG(_(e_emptybuf)); + emsg(_(e_emptybuf)); return FAIL; } @@ -3211,7 +3211,7 @@ buf_write( /* Avoid a crash for a long name. */ if (STRLEN(fname) >= MAXPATHL) { - EMSG(_(e_longname)); + emsg(_(e_longname)); return FAIL; } @@ -3399,7 +3399,7 @@ buf_write( --no_wait_return; msg_scroll = msg_save; if (nofile_err) - EMSG(_("E676: No matching autocommands for acwrite buffer")); + emsg(_("E676: No matching autocommands for acwrite buffer")); if (nofile_err #ifdef FEAT_EVAL @@ -3434,7 +3434,7 @@ buf_write( #ifdef FEAT_EVAL if (!aborting()) #endif - EMSG(_("E203: Autocommands deleted or unloaded buffer to be written")); + emsg(_("E203: Autocommands deleted or unloaded buffer to be written")); return FAIL; } @@ -3457,7 +3457,7 @@ buf_write( { --no_wait_return; msg_scroll = msg_save; - EMSG(_("E204: Autocommand changed number of lines in unexpected way")); + emsg(_("E204: Autocommand changed number of lines in unexpected way")); return FAIL; } } @@ -5055,7 +5055,7 @@ restore_backup: * the current backup file becomes the original file */ if (org == NULL) - EMSG(_("E205: Patchmode: can't save original file")); + emsg(_("E205: Patchmode: can't save original file")); else if (mch_stat(org, &st) < 0) { vim_rename(backup, (char_u *)org); @@ -5077,7 +5077,7 @@ restore_backup: || (empty_fd = mch_open(org, O_CREAT | O_EXTRA | O_EXCL | O_NOFOLLOW, perm < 0 ? 0666 : (perm & 0777))) < 0) - EMSG(_("E206: patchmode: can't touch empty original file")); + emsg(_("E206: patchmode: can't touch empty original file")); else close(empty_fd); } @@ -5092,7 +5092,7 @@ restore_backup: * Remove the backup unless 'backup' option is set */ if (!p_bk && backup != NULL && mch_remove(backup) != 0) - EMSG(_("E207: Can't delete backup file")); + emsg(_("E207: Can't delete backup file")); #ifdef FEAT_SUN_WORKSHOP if (usingSunWorkShop) @@ -5151,7 +5151,7 @@ nofail: mch_memmove(IObuff, errnum, (size_t)numlen); } STRCAT(IObuff, errmsg); - emsg(IObuff); + emsg((char *)IObuff); if (errmsg_allocated) vim_free(errmsg); @@ -5251,7 +5251,7 @@ set_rw_fname(char_u *fname, char_u *sfna if (curbuf != buf) { /* We are in another buffer now, don't do the renaming. */ - EMSG(_(e_auchangedbuf)); + emsg(_(e_auchangedbuf)); return FAIL; } @@ -6732,7 +6732,7 @@ vim_rename(char_u *from, char_u *to) #endif if (errmsg != NULL) { - EMSG2(errmsg, to); + semsg(errmsg, to); return -1; } mch_remove(from); @@ -6872,7 +6872,7 @@ buf_check_timestamp( int stat_res; int retval = 0; char_u *path; - char_u *tbuf; + char *tbuf; char *mesg = NULL; char *mesg2 = ""; int helpmesg = FALSE; @@ -6983,7 +6983,7 @@ buf_check_timestamp( if (n) { if (!bufref_valid(&bufref)) - EMSG(_("E246: FileChangedShell autocommand deleted buffer")); + emsg(_("E246: FileChangedShell autocommand deleted buffer")); #ifdef FEAT_EVAL s = get_vim_var_str(VV_FCS_CHOICE); if (STRCMP(s, "reload") == 0 && *reason != 'd') @@ -7052,13 +7052,13 @@ buf_check_timestamp( { if (!helpmesg) mesg2 = ""; - tbuf = alloc((unsigned)(STRLEN(path) + STRLEN(mesg) + tbuf = (char *)alloc((unsigned)(STRLEN(path) + STRLEN(mesg) + STRLEN(mesg2) + 2)); - sprintf((char *)tbuf, mesg, path); + sprintf(tbuf, mesg, path); #ifdef FEAT_EVAL /* Set warningmsg here, before the unimportant and output-specific * mesg2 has been appended. */ - set_vim_var_string(VV_WARNINGMSG, tbuf, -1); + set_vim_var_string(VV_WARNINGMSG, (char_u *)tbuf, -1); #endif #if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG) if (can_reload) @@ -7068,7 +7068,8 @@ buf_check_timestamp( STRCAT(tbuf, "\n"); STRCAT(tbuf, mesg2); } - if (do_dialog(VIM_WARNING, (char_u *)_("Warning"), tbuf, + if (do_dialog(VIM_WARNING, (char_u *)_("Warning"), + (char_u *)tbuf, (char_u *)_("&OK\n&Load File"), 1, NULL, TRUE) == 2) reload = TRUE; } @@ -7081,7 +7082,7 @@ buf_check_timestamp( STRCAT(tbuf, "; "); STRCAT(tbuf, mesg2); } - EMSG(tbuf); + emsg(tbuf); retval = 2; } else @@ -7089,7 +7090,7 @@ buf_check_timestamp( if (!autocmd_busy) { msg_start(); - msg_puts_attr(tbuf, HL_ATTR(HLF_E) + MSG_HIST); + msg_puts_attr((char_u *)tbuf, HL_ATTR(HLF_E) + MSG_HIST); if (*mesg2 != NUL) msg_puts_attr((char_u *)mesg2, HL_ATTR(HLF_W) + MSG_HIST); @@ -7213,7 +7214,7 @@ buf_reload(buf_T *buf, int orig_mode) if (savebuf == NULL || saved == FAIL || buf != curbuf || move_lines(buf, savebuf) == FAIL) { - EMSG2(_("E462: Could not prepare for reloading \"%s\""), + semsg(_("E462: Could not prepare for reloading \"%s\""), buf->b_fname); saved = FAIL; } @@ -7230,7 +7231,7 @@ buf_reload(buf_T *buf, int orig_mode) #if defined(FEAT_EVAL) if (!aborting()) #endif - EMSG2(_("E321: Could not reload \"%s\""), buf->b_fname); + semsg(_("E321: Could not reload \"%s\""), buf->b_fname); if (savebuf != NULL && bufref_valid(&bufref) && buf == curbuf) { /* Put the text back from the save buffer. First @@ -8076,8 +8077,7 @@ aubuflocal_remove(buf_T *buf) if (p_verbose >= 6) { verbose_enter(); - smsg((char_u *) - _("auto-removing autocommand: %s "), + smsg(_("auto-removing autocommand: %s "), event_nr2name(event), buf->b_fnum); verbose_leave(); } @@ -8121,9 +8121,9 @@ au_del_group(char_u *name) i = au_find_group(name); if (i == AUGROUP_ERROR) /* the group doesn't exist */ - EMSG2(_("E367: No such group: \"%s\""), name); + semsg(_("E367: No such group: \"%s\""), name); else if (i == current_augroup) - EMSG(_("E936: Cannot delete the current group")); + emsg(_("E936: Cannot delete the current group")); else { event_T event; @@ -8188,7 +8188,7 @@ do_augroup(char_u *arg, int del_group) if (del_group) { if (*arg == NUL) - EMSG(_(e_argreq)); + emsg(_(e_argreq)); else au_del_group(arg); } @@ -8295,7 +8295,7 @@ find_end_event( { if (arg[1] && !VIM_ISWHITE(arg[1])) { - EMSG2(_("E215: Illegal character after *: %s"), arg); + semsg(_("E215: Illegal character after *: %s"), arg); return NULL; } pat = arg + 1; @@ -8307,9 +8307,9 @@ find_end_event( if ((int)event_name2nr(pat, &p) >= (int)NUM_EVENTS) { if (have_group) - EMSG2(_("E216: No such event: %s"), pat); + semsg(_("E216: No such event: %s"), pat); else - EMSG2(_("E216: No such group or event: %s"), pat); + semsg(_("E216: No such group or event: %s"), pat); return NULL; } } @@ -8773,7 +8773,7 @@ do_autocmd_event( if (is_buflocal && (buflocal_nr == 0 || buflist_findnr(buflocal_nr) == NULL)) { - EMSGN(_("E680: : invalid buffer number "), + semsg(_("E680: : invalid buffer number "), buflocal_nr); return FAIL; } @@ -8876,7 +8876,7 @@ do_doautocmd( if (*arg == '*') { - EMSG(_("E217: Can't execute autocommands for ALL events")); + emsg(_("E217: Can't execute autocommands for ALL events")); return FAIL; } @@ -9461,7 +9461,7 @@ apply_autocmds_group( */ if (nesting == 10) { - EMSG(_("E218: autocommand nesting too deep")); + emsg(_("E218: autocommand nesting too deep")); goto BYPASS_AU; } @@ -9869,7 +9869,7 @@ auto_next_pat( if (p_verbose >= 8) { verbose_enter(); - smsg((char_u *)_("Executing %s"), sourcing_name); + smsg(_("Executing %s"), sourcing_name); verbose_leave(); } } @@ -9935,7 +9935,7 @@ getnextac(int c UNUSED, void *cookie, in if (p_verbose >= 9) { verbose_enter_scroll(); - smsg((char_u *)_("autocommand %s"), ac->cmd); + smsg(_("autocommand %s"), ac->cmd); msg_puts((char_u *)"\n"); /* don't overwrite this either */ verbose_leave_scroll(); } @@ -10483,9 +10483,9 @@ file_pat_to_reg_pat( if (nested != 0) { if (nested < 0) - EMSG(_("E219: Missing {.")); + emsg(_("E219: Missing {.")); else - EMSG(_("E220: Missing }.")); + emsg(_("E220: Missing }.")); VIM_CLEAR(reg_pat); } return reg_pat; diff --git a/src/fold.c b/src/fold.c --- a/src/fold.c +++ b/src/fold.c @@ -410,7 +410,7 @@ opFoldRange( (void)hasFolding(lnum, NULL, &lnum_next); } if (done == DONE_NOTHING) - EMSG(_(e_nofold)); + emsg(_(e_nofold)); /* Force a redraw to remove the Visual highlighting. */ if (had_visual) redraw_curbuf_later(INVERTED); @@ -561,9 +561,9 @@ foldManualAllowed(int create) if (foldmethodIsManual(curwin) || foldmethodIsMarker(curwin)) return TRUE; if (create) - EMSG(_("E350: Cannot create fold with current 'foldmethod'")); + emsg(_("E350: Cannot create fold with current 'foldmethod'")); else - EMSG(_("E351: Cannot delete fold with current 'foldmethod'")); + emsg(_("E351: Cannot delete fold with current 'foldmethod'")); return FALSE; } @@ -775,7 +775,7 @@ deleteFold( } if (!did_one) { - EMSG(_(e_nofold)); + emsg(_(e_nofold)); /* Force a redraw to remove the Visual highlighting. */ if (had_visual) redraw_curbuf_later(INVERTED); @@ -1211,7 +1211,7 @@ setFoldRepeat(linenr_T lnum, long count, { /* Only give an error message when no fold could be opened. */ if (n == 0 && !(done & DONE_FOLD)) - EMSG(_(e_nofold)); + emsg(_(e_nofold)); break; } } @@ -1363,7 +1363,7 @@ setManualFoldWin( done |= DONE_FOLD; } else if (donep == NULL && wp == curwin) - EMSG(_(e_nofold)); + emsg(_(e_nofold)); if (donep != NULL) *donep |= done; @@ -1735,7 +1735,7 @@ foldCreateMarkers(linenr_T start, linenr { if (!curbuf->b_p_ma) { - EMSG(_(e_modifiable)); + emsg(_(e_modifiable)); return; } parseMarker(curwin); diff --git a/src/getchar.c b/src/getchar.c --- a/src/getchar.c +++ b/src/getchar.c @@ -237,7 +237,7 @@ add_buff( } else if (buf->bh_curr == NULL) /* buffer has already been read */ { - IEMSG(_("E222: Add to read buffer")); + iemsg(_("E222: Add to read buffer")); return; } else if (buf->bh_index != 0) @@ -998,7 +998,7 @@ ins_typebuf( newlen = typebuf.tb_len + addlen + newoff + 4 * (MAXMAPLEN + 4); if (newlen < 0) /* string is getting too long */ { - EMSG(_(e_toocompl)); /* also calls flush_buffers */ + emsg(_(e_toocompl)); /* also calls flush_buffers */ setcursor(); return FAIL; } @@ -1431,7 +1431,7 @@ openscript( { if (curscript + 1 == NSCRIPT) { - EMSG(_(e_nesting)); + emsg(_(e_nesting)); return; } #ifdef FEAT_EVAL @@ -1446,7 +1446,7 @@ openscript( expand_env(name, NameBuff, MAXPATHL); if ((scriptin[curscript] = mch_fopen((char *)NameBuff, READBIN)) == NULL) { - EMSG2(_(e_notopen), name); + semsg(_(e_notopen), name); if (curscript) --curscript; return; @@ -2508,7 +2508,7 @@ vgetorpeek(int advance) */ if (++mapdepth >= p_mmd) { - EMSG(_("E223: recursive mapping")); + emsg(_("E223: recursive mapping")); if (State & CMDLINE) redrawcmdline(); else @@ -3508,10 +3508,10 @@ do_map( && STRNCMP(mp->m_keys, keys, (size_t)len) == 0) { if (abbrev) - EMSG2(_("E224: global abbreviation already exists for %s"), + semsg(_("E224: global abbreviation already exists for %s"), mp->m_keys); else - EMSG2(_("E225: global mapping already exists for %s"), + semsg(_("E225: global mapping already exists for %s"), mp->m_keys); retval = 5; goto theend; @@ -3643,10 +3643,10 @@ do_map( else if (unique) { if (abbrev) - EMSG2(_("E226: abbreviation already exists for %s"), + semsg(_("E226: abbreviation already exists for %s"), p); else - EMSG2(_("E227: mapping already exists for %s"), p); + semsg(_("E227: mapping already exists for %s"), p); retval = 5; goto theend; } @@ -3892,7 +3892,7 @@ map_clear( local = (STRCMP(arg, "") == 0); if (!local && *arg != NUL) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } #endif @@ -4920,7 +4920,7 @@ makemap( c1 = 't'; break; default: - IEMSG(_("E228: makemap: Illegal mode")); + iemsg(_("E228: makemap: Illegal mode")); return FAIL; } do /* do this twice if c2 is set, 3 times with c3 */ diff --git a/src/globals.h b/src/globals.h --- a/src/globals.h +++ b/src/globals.h @@ -1391,54 +1391,54 @@ EXTERN int netbeansSuppressNoLines INIT( * The error messages that can be shared are included here. * Excluded are errors that are only used once and debugging messages. */ -EXTERN char_u e_abort[] INIT(= N_("E470: Command aborted")); -EXTERN char_u e_argreq[] INIT(= N_("E471: Argument required")); -EXTERN char_u e_backslash[] INIT(= N_("E10: \\ should be followed by /, ? or &")); +EXTERN char e_abort[] INIT(= N_("E470: Command aborted")); +EXTERN char e_argreq[] INIT(= N_("E471: Argument required")); +EXTERN char e_backslash[] INIT(= N_("E10: \\ should be followed by /, ? or &")); #ifdef FEAT_CMDWIN -EXTERN char_u e_cmdwin[] INIT(= N_("E11: Invalid in command-line window; executes, CTRL-C quits")); +EXTERN char e_cmdwin[] INIT(= N_("E11: Invalid in command-line window; executes, CTRL-C quits")); #endif -EXTERN char_u e_curdir[] INIT(= N_("E12: Command not allowed from exrc/vimrc in current dir or tag search")); +EXTERN char e_curdir[] INIT(= N_("E12: Command not allowed from exrc/vimrc in current dir or tag search")); #ifdef FEAT_EVAL -EXTERN char_u e_endif[] INIT(= N_("E171: Missing :endif")); -EXTERN char_u e_endtry[] INIT(= N_("E600: Missing :endtry")); -EXTERN char_u e_endwhile[] INIT(= N_("E170: Missing :endwhile")); -EXTERN char_u e_endfor[] INIT(= N_("E170: Missing :endfor")); -EXTERN char_u e_while[] INIT(= N_("E588: :endwhile without :while")); -EXTERN char_u e_for[] INIT(= N_("E588: :endfor without :for")); +EXTERN char e_endif[] INIT(= N_("E171: Missing :endif")); +EXTERN char e_endtry[] INIT(= N_("E600: Missing :endtry")); +EXTERN char e_endwhile[] INIT(= N_("E170: Missing :endwhile")); +EXTERN char e_endfor[] INIT(= N_("E170: Missing :endfor")); +EXTERN char e_while[] INIT(= N_("E588: :endwhile without :while")); +EXTERN char e_for[] INIT(= N_("E588: :endfor without :for")); #endif -EXTERN char_u e_exists[] INIT(= N_("E13: File exists (add ! to override)")); -EXTERN char_u e_failed[] INIT(= N_("E472: Command failed")); +EXTERN char e_exists[] INIT(= N_("E13: File exists (add ! to override)")); +EXTERN char e_failed[] INIT(= N_("E472: Command failed")); #if defined(FEAT_GUI) && defined(FEAT_XFONTSET) -EXTERN char_u e_fontset[] INIT(= N_("E234: Unknown fontset: %s")); +EXTERN char e_fontset[] INIT(= N_("E234: Unknown fontset: %s")); #endif #if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MAC) \ || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_MSWIN) -EXTERN char_u e_font[] INIT(= N_("E235: Unknown font: %s")); +EXTERN char e_font[] INIT(= N_("E235: Unknown font: %s")); #endif #if defined(FEAT_GUI_X11) && !defined(FEAT_GUI_GTK) -EXTERN char_u e_fontwidth[] INIT(= N_("E236: Font \"%s\" is not fixed-width")); +EXTERN char e_fontwidth[] INIT(= N_("E236: Font \"%s\" is not fixed-width")); #endif -EXTERN char_u e_internal[] INIT(= N_("E473: Internal error")); -EXTERN char_u e_intern2[] INIT(= N_("E685: Internal error: %s")); -EXTERN char_u e_interr[] INIT(= N_("Interrupted")); -EXTERN char_u e_invaddr[] INIT(= N_("E14: Invalid address")); -EXTERN char_u e_invarg[] INIT(= N_("E474: Invalid argument")); -EXTERN char_u e_invarg2[] INIT(= N_("E475: Invalid argument: %s")); -EXTERN char_u e_invargval[] INIT(= N_("E475: Invalid value for argument %s")); -EXTERN char_u e_invargNval[] INIT(= N_("E475: Invalid value for argument %s: %s")); +EXTERN char e_internal[] INIT(= N_("E473: Internal error")); +EXTERN char e_intern2[] INIT(= N_("E685: Internal error: %s")); +EXTERN char e_interr[] INIT(= N_("Interrupted")); +EXTERN char e_invaddr[] INIT(= N_("E14: Invalid address")); +EXTERN char e_invarg[] INIT(= N_("E474: Invalid argument")); +EXTERN char e_invarg2[] INIT(= N_("E475: Invalid argument: %s")); +EXTERN char e_invargval[] INIT(= N_("E475: Invalid value for argument %s")); +EXTERN char e_invargNval[] INIT(= N_("E475: Invalid value for argument %s: %s")); #ifdef FEAT_EVAL -EXTERN char_u e_invexpr2[] INIT(= N_("E15: Invalid expression: %s")); +EXTERN char e_invexpr2[] INIT(= N_("E15: Invalid expression: %s")); #endif -EXTERN char_u e_invrange[] INIT(= N_("E16: Invalid range")); -EXTERN char_u e_invcmd[] INIT(= N_("E476: Invalid command")); +EXTERN char e_invrange[] INIT(= N_("E16: Invalid range")); +EXTERN char e_invcmd[] INIT(= N_("E476: Invalid command")); #if defined(UNIX) || defined(FEAT_SYN_HL) || defined(FEAT_SPELL) -EXTERN char_u e_isadir2[] INIT(= N_("E17: \"%s\" is a directory")); +EXTERN char e_isadir2[] INIT(= N_("E17: \"%s\" is a directory")); #endif #ifdef FEAT_LIBCALL -EXTERN char_u e_libcall[] INIT(= N_("E364: Library call failed for \"%s()\"")); +EXTERN char e_libcall[] INIT(= N_("E364: Library call failed for \"%s()\"")); #endif #ifdef HAVE_FSYNC -EXTERN char_u e_fsync[] INIT(= N_("E667: Fsync failed")); +EXTERN char e_fsync[] INIT(= N_("E667: Fsync failed")); #endif #if defined(DYNAMIC_PERL) \ || defined(DYNAMIC_PYTHON) || defined(DYNAMIC_PYTHON3) \ @@ -1448,145 +1448,145 @@ EXTERN char_u e_fsync[] INIT(= N_("E667 || defined(DYNAMIC_GETTEXT) \ || defined(DYNAMIC_MZSCHEME) \ || defined(DYNAMIC_LUA) -EXTERN char_u e_loadlib[] INIT(= N_("E370: Could not load library %s")); -EXTERN char_u e_loadfunc[] INIT(= N_("E448: Could not load library function %s")); +EXTERN char e_loadlib[] INIT(= N_("E370: Could not load library %s")); +EXTERN char e_loadfunc[] INIT(= N_("E448: Could not load library function %s")); #endif -EXTERN char_u e_markinval[] INIT(= N_("E19: Mark has invalid line number")); -EXTERN char_u e_marknotset[] INIT(= N_("E20: Mark not set")); -EXTERN char_u e_modifiable[] INIT(= N_("E21: Cannot make changes, 'modifiable' is off")); -EXTERN char_u e_nesting[] INIT(= N_("E22: Scripts nested too deep")); -EXTERN char_u e_noalt[] INIT(= N_("E23: No alternate file")); -EXTERN char_u e_noabbr[] INIT(= N_("E24: No such abbreviation")); -EXTERN char_u e_nobang[] INIT(= N_("E477: No ! allowed")); +EXTERN char e_markinval[] INIT(= N_("E19: Mark has invalid line number")); +EXTERN char e_marknotset[] INIT(= N_("E20: Mark not set")); +EXTERN char e_modifiable[] INIT(= N_("E21: Cannot make changes, 'modifiable' is off")); +EXTERN char e_nesting[] INIT(= N_("E22: Scripts nested too deep")); +EXTERN char e_noalt[] INIT(= N_("E23: No alternate file")); +EXTERN char e_noabbr[] INIT(= N_("E24: No such abbreviation")); +EXTERN char e_nobang[] INIT(= N_("E477: No ! allowed")); #ifndef FEAT_GUI -EXTERN char_u e_nogvim[] INIT(= N_("E25: GUI cannot be used: Not enabled at compile time")); +EXTERN char e_nogvim[] INIT(= N_("E25: GUI cannot be used: Not enabled at compile time")); #endif #ifndef FEAT_RIGHTLEFT -EXTERN char_u e_nohebrew[] INIT(= N_("E26: Hebrew cannot be used: Not enabled at compile time\n")); +EXTERN char e_nohebrew[] INIT(= N_("E26: Hebrew cannot be used: Not enabled at compile time\n")); #endif #ifndef FEAT_FKMAP -EXTERN char_u e_nofarsi[] INIT(= N_("E27: Farsi cannot be used: Not enabled at compile time\n")); +EXTERN char e_nofarsi[] INIT(= N_("E27: Farsi cannot be used: Not enabled at compile time\n")); #endif #ifndef FEAT_ARABIC -EXTERN char_u e_noarabic[] INIT(= N_("E800: Arabic cannot be used: Not enabled at compile time\n")); +EXTERN char e_noarabic[] INIT(= N_("E800: Arabic cannot be used: Not enabled at compile time\n")); #endif #if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_SYN_HL) -EXTERN char_u e_nogroup[] INIT(= N_("E28: No such highlight group name: %s")); +EXTERN char e_nogroup[] INIT(= N_("E28: No such highlight group name: %s")); #endif -EXTERN char_u e_noinstext[] INIT(= N_("E29: No inserted text yet")); -EXTERN char_u e_nolastcmd[] INIT(= N_("E30: No previous command line")); -EXTERN char_u e_nomap[] INIT(= N_("E31: No such mapping")); -EXTERN char_u e_nomatch[] INIT(= N_("E479: No match")); -EXTERN char_u e_nomatch2[] INIT(= N_("E480: No match: %s")); -EXTERN char_u e_noname[] INIT(= N_("E32: No file name")); -EXTERN char_u e_nopresub[] INIT(= N_("E33: No previous substitute regular expression")); -EXTERN char_u e_noprev[] INIT(= N_("E34: No previous command")); -EXTERN char_u e_noprevre[] INIT(= N_("E35: No previous regular expression")); -EXTERN char_u e_norange[] INIT(= N_("E481: No range allowed")); -EXTERN char_u e_noroom[] INIT(= N_("E36: Not enough room")); +EXTERN char e_noinstext[] INIT(= N_("E29: No inserted text yet")); +EXTERN char e_nolastcmd[] INIT(= N_("E30: No previous command line")); +EXTERN char e_nomap[] INIT(= N_("E31: No such mapping")); +EXTERN char e_nomatch[] INIT(= N_("E479: No match")); +EXTERN char e_nomatch2[] INIT(= N_("E480: No match: %s")); +EXTERN char e_noname[] INIT(= N_("E32: No file name")); +EXTERN char e_nopresub[] INIT(= N_("E33: No previous substitute regular expression")); +EXTERN char e_noprev[] INIT(= N_("E34: No previous command")); +EXTERN char e_noprevre[] INIT(= N_("E35: No previous regular expression")); +EXTERN char e_norange[] INIT(= N_("E481: No range allowed")); +EXTERN char e_noroom[] INIT(= N_("E36: Not enough room")); #ifdef FEAT_CLIENTSERVER -EXTERN char_u e_noserver[] INIT(= N_("E247: no registered server named \"%s\"")); +EXTERN char e_noserver[] INIT(= N_("E247: no registered server named \"%s\"")); #endif -EXTERN char_u e_notcreate[] INIT(= N_("E482: Can't create file %s")); -EXTERN char_u e_notmp[] INIT(= N_("E483: Can't get temp file name")); -EXTERN char_u e_notopen[] INIT(= N_("E484: Can't open file %s")); -EXTERN char_u e_notread[] INIT(= N_("E485: Can't read file %s")); -EXTERN char_u e_null[] INIT(= N_("E38: Null argument")); +EXTERN char e_notcreate[] INIT(= N_("E482: Can't create file %s")); +EXTERN char e_notmp[] INIT(= N_("E483: Can't get temp file name")); +EXTERN char e_notopen[] INIT(= N_("E484: Can't open file %s")); +EXTERN char e_notread[] INIT(= N_("E485: Can't read file %s")); +EXTERN char e_null[] INIT(= N_("E38: Null argument")); #if defined(FEAT_DIGRAPHS) || defined(FEAT_TIMERS) -EXTERN char_u e_number_exp[] INIT(= N_("E39: Number expected")); +EXTERN char e_number_exp[] INIT(= N_("E39: Number expected")); #endif #ifdef FEAT_QUICKFIX -EXTERN char_u e_openerrf[] INIT(= N_("E40: Can't open errorfile %s")); +EXTERN char e_openerrf[] INIT(= N_("E40: Can't open errorfile %s")); #endif #if defined(FEAT_GUI_GTK) || defined(FEAT_GUI_X11) -EXTERN char_u e_opendisp[] INIT(= N_("E233: cannot open display")); +EXTERN char e_opendisp[] INIT(= N_("E233: cannot open display")); #endif -EXTERN char_u e_outofmem[] INIT(= N_("E41: Out of memory!")); +EXTERN char e_outofmem[] INIT(= N_("E41: Out of memory!")); #ifdef FEAT_INS_EXPAND -EXTERN char_u e_patnotf[] INIT(= N_("Pattern not found")); +EXTERN char e_patnotf[] INIT(= N_("Pattern not found")); #endif -EXTERN char_u e_patnotf2[] INIT(= N_("E486: Pattern not found: %s")); -EXTERN char_u e_positive[] INIT(= N_("E487: Argument must be positive")); +EXTERN char e_patnotf2[] INIT(= N_("E486: Pattern not found: %s")); +EXTERN char e_positive[] INIT(= N_("E487: Argument must be positive")); #if defined(UNIX) || defined(FEAT_SESSION) -EXTERN char_u e_prev_dir[] INIT(= N_("E459: Cannot go back to previous directory")); +EXTERN char e_prev_dir[] INIT(= N_("E459: Cannot go back to previous directory")); #endif #ifdef FEAT_QUICKFIX -EXTERN char_u e_quickfix[] INIT(= N_("E42: No Errors")); -EXTERN char_u e_loclist[] INIT(= N_("E776: No location list")); +EXTERN char e_quickfix[] INIT(= N_("E42: No Errors")); +EXTERN char e_loclist[] INIT(= N_("E776: No location list")); #endif -EXTERN char_u e_re_damg[] INIT(= N_("E43: Damaged match string")); -EXTERN char_u e_re_corr[] INIT(= N_("E44: Corrupted regexp program")); -EXTERN char_u e_readonly[] INIT(= N_("E45: 'readonly' option is set (add ! to override)")); +EXTERN char e_re_damg[] INIT(= N_("E43: Damaged match string")); +EXTERN char e_re_corr[] INIT(= N_("E44: Corrupted regexp program")); +EXTERN char e_readonly[] INIT(= N_("E45: 'readonly' option is set (add ! to override)")); #ifdef FEAT_EVAL -EXTERN char_u e_readonlyvar[] INIT(= N_("E46: Cannot change read-only variable \"%s\"")); -EXTERN char_u e_readonlysbx[] INIT(= N_("E794: Cannot set variable in the sandbox: \"%s\"")); -EXTERN char_u e_emptykey[] INIT(= N_("E713: Cannot use empty key for Dictionary")); -EXTERN char_u e_dictreq[] INIT(= N_("E715: Dictionary required")); -EXTERN char_u e_listidx[] INIT(= N_("E684: list index out of range: %ld")); -EXTERN char_u e_blobidx[] INIT(= N_("E979: Blob index out of range: %ld")); -EXTERN char_u e_invalblob[] INIT(= N_("E978: Invalid operation for Blob")); -EXTERN char_u e_toomanyarg[] INIT(= N_("E118: Too many arguments for function: %s")); -EXTERN char_u e_dictkey[] INIT(= N_("E716: Key not present in Dictionary: %s")); -EXTERN char_u e_listreq[] INIT(= N_("E714: List required")); -EXTERN char_u e_listdictarg[] INIT(= N_("E712: Argument of %s must be a List or Dictionary")); +EXTERN char e_readonlyvar[] INIT(= N_("E46: Cannot change read-only variable \"%s\"")); +EXTERN char e_readonlysbx[] INIT(= N_("E794: Cannot set variable in the sandbox: \"%s\"")); +EXTERN char e_emptykey[] INIT(= N_("E713: Cannot use empty key for Dictionary")); +EXTERN char e_dictreq[] INIT(= N_("E715: Dictionary required")); +EXTERN char e_listidx[] INIT(= N_("E684: list index out of range: %ld")); +EXTERN char e_blobidx[] INIT(= N_("E979: Blob index out of range: %ld")); +EXTERN char e_invalblob[] INIT(= N_("E978: Invalid operation for Blob")); +EXTERN char e_toomanyarg[] INIT(= N_("E118: Too many arguments for function: %s")); +EXTERN char e_dictkey[] INIT(= N_("E716: Key not present in Dictionary: %s")); +EXTERN char e_listreq[] INIT(= N_("E714: List required")); +EXTERN char e_listdictarg[] INIT(= N_("E712: Argument of %s must be a List or Dictionary")); #endif #ifdef FEAT_QUICKFIX -EXTERN char_u e_readerrf[] INIT(= N_("E47: Error while reading errorfile")); +EXTERN char e_readerrf[] INIT(= N_("E47: Error while reading errorfile")); #endif #ifdef HAVE_SANDBOX -EXTERN char_u e_sandbox[] INIT(= N_("E48: Not allowed in sandbox")); +EXTERN char e_sandbox[] INIT(= N_("E48: Not allowed in sandbox")); #endif -EXTERN char_u e_secure[] INIT(= N_("E523: Not allowed here")); +EXTERN char e_secure[] INIT(= N_("E523: Not allowed here")); #if defined(AMIGA) || defined(MACOS_X) || defined(MSWIN) \ || defined(UNIX) || defined(VMS) -EXTERN char_u e_screenmode[] INIT(= N_("E359: Screen mode setting not supported")); +EXTERN char e_screenmode[] INIT(= N_("E359: Screen mode setting not supported")); #endif -EXTERN char_u e_scroll[] INIT(= N_("E49: Invalid scroll size")); -EXTERN char_u e_shellempty[] INIT(= N_("E91: 'shell' option is empty")); +EXTERN char e_scroll[] INIT(= N_("E49: Invalid scroll size")); +EXTERN char e_shellempty[] INIT(= N_("E91: 'shell' option is empty")); #if defined(FEAT_SIGN_ICONS) && !defined(FEAT_GUI_GTK) -EXTERN char_u e_signdata[] INIT(= N_("E255: Couldn't read in sign data!")); +EXTERN char e_signdata[] INIT(= N_("E255: Couldn't read in sign data!")); #endif -EXTERN char_u e_swapclose[] INIT(= N_("E72: Close error on swap file")); -EXTERN char_u e_tagstack[] INIT(= N_("E73: tag stack empty")); -EXTERN char_u e_toocompl[] INIT(= N_("E74: Command too complex")); -EXTERN char_u e_longname[] INIT(= N_("E75: Name too long")); -EXTERN char_u e_toomsbra[] INIT(= N_("E76: Too many [")); -EXTERN char_u e_toomany[] INIT(= N_("E77: Too many file names")); -EXTERN char_u e_trailing[] INIT(= N_("E488: Trailing characters")); -EXTERN char_u e_umark[] INIT(= N_("E78: Unknown mark")); -EXTERN char_u e_wildexpand[] INIT(= N_("E79: Cannot expand wildcards")); -EXTERN char_u e_winheight[] INIT(= N_("E591: 'winheight' cannot be smaller than 'winminheight'")); -EXTERN char_u e_winwidth[] INIT(= N_("E592: 'winwidth' cannot be smaller than 'winminwidth'")); -EXTERN char_u e_write[] INIT(= N_("E80: Error while writing")); -EXTERN char_u e_zerocount[] INIT(= N_("E939: Positive count required")); +EXTERN char e_swapclose[] INIT(= N_("E72: Close error on swap file")); +EXTERN char e_tagstack[] INIT(= N_("E73: tag stack empty")); +EXTERN char e_toocompl[] INIT(= N_("E74: Command too complex")); +EXTERN char e_longname[] INIT(= N_("E75: Name too long")); +EXTERN char e_toomsbra[] INIT(= N_("E76: Too many [")); +EXTERN char e_toomany[] INIT(= N_("E77: Too many file names")); +EXTERN char e_trailing[] INIT(= N_("E488: Trailing characters")); +EXTERN char e_umark[] INIT(= N_("E78: Unknown mark")); +EXTERN char e_wildexpand[] INIT(= N_("E79: Cannot expand wildcards")); +EXTERN char e_winheight[] INIT(= N_("E591: 'winheight' cannot be smaller than 'winminheight'")); +EXTERN char e_winwidth[] INIT(= N_("E592: 'winwidth' cannot be smaller than 'winminwidth'")); +EXTERN char e_write[] INIT(= N_("E80: Error while writing")); +EXTERN char e_zerocount[] INIT(= N_("E939: Positive count required")); #ifdef FEAT_EVAL -EXTERN char_u e_usingsid[] INIT(= N_("E81: Using not in a script context")); +EXTERN char e_usingsid[] INIT(= N_("E81: Using not in a script context")); #endif #ifdef FEAT_CLIENTSERVER -EXTERN char_u e_invexprmsg[] INIT(= N_("E449: Invalid expression received")); +EXTERN char e_invexprmsg[] INIT(= N_("E449: Invalid expression received")); #endif #ifdef FEAT_NETBEANS_INTG -EXTERN char_u e_guarded[] INIT(= N_("E463: Region is guarded, cannot modify")); -EXTERN char_u e_nbreadonly[] INIT(= N_("E744: NetBeans does not allow changes in read-only files")); +EXTERN char e_guarded[] INIT(= N_("E463: Region is guarded, cannot modify")); +EXTERN char e_nbreadonly[] INIT(= N_("E744: NetBeans does not allow changes in read-only files")); #endif -EXTERN char_u e_maxmempat[] INIT(= N_("E363: pattern uses more memory than 'maxmempattern'")); -EXTERN char_u e_emptybuf[] INIT(= N_("E749: empty buffer")); -EXTERN char_u e_nobufnr[] INIT(= N_("E86: Buffer %ld does not exist")); +EXTERN char e_maxmempat[] INIT(= N_("E363: pattern uses more memory than 'maxmempattern'")); +EXTERN char e_emptybuf[] INIT(= N_("E749: empty buffer")); +EXTERN char e_nobufnr[] INIT(= N_("E86: Buffer %ld does not exist")); -EXTERN char_u e_invalpat[] INIT(= N_("E682: Invalid search pattern or delimiter")); -EXTERN char_u e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer")); +EXTERN char e_invalpat[] INIT(= N_("E682: Invalid search pattern or delimiter")); +EXTERN char e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer")); #if defined(FEAT_SYN_HL) || \ (defined(FEAT_INS_EXPAND) && defined(FEAT_COMPL_FUNC)) -EXTERN char_u e_notset[] INIT(= N_("E764: Option '%s' is not set")); +EXTERN char e_notset[] INIT(= N_("E764: Option '%s' is not set")); #endif #ifndef FEAT_CLIPBOARD -EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name")); +EXTERN char e_invalidreg[] INIT(= N_("E850: Invalid register name")); #endif -EXTERN char_u e_dirnotf[] INIT(= N_("E919: Directory not found in '%s': \"%s\"")); -EXTERN char_u e_au_recursive[] INIT(= N_("E952: Autocommand caused recursive behavior")); +EXTERN char e_dirnotf[] INIT(= N_("E919: Directory not found in '%s': \"%s\"")); +EXTERN char e_au_recursive[] INIT(= N_("E952: Autocommand caused recursive behavior")); #ifdef FEAT_MENU -EXTERN char_u e_menuothermode[] INIT(= N_("E328: Menu only exists in another mode")); +EXTERN char e_menuothermode[] INIT(= N_("E328: Menu only exists in another mode")); #endif #ifdef FEAT_GUI_MAC diff --git a/src/gui.c b/src/gui.c --- a/src/gui.c +++ b/src/gui.c @@ -215,7 +215,7 @@ gui_do_fork(void) pid = fork(); if (pid < 0) /* Fork error */ { - EMSG(_("E851: Failed to create a new process for the GUI")); + emsg(_("E851: Failed to create a new process for the GUI")); return; } else if (pid > 0) /* Parent */ @@ -239,7 +239,7 @@ gui_do_fork(void) # else waitpid(pid, &exit_status, 0); # endif - EMSG(_("E852: The child process failed to start the GUI")); + emsg(_("E852: The child process failed to start the GUI")); return; } else if (status == GUI_CHILD_IO_ERROR) @@ -362,7 +362,7 @@ gui_init_check(void) if (result != MAYBE) { if (result == FAIL) - EMSG(_("E229: Cannot start the GUI")); + emsg(_("E229: Cannot start the GUI")); return result; } @@ -515,7 +515,7 @@ gui_init(void) if (STRCMP(use_gvimrc, "NONE") != 0 && STRCMP(use_gvimrc, "NORC") != 0 && do_source(use_gvimrc, FALSE, DOSO_NONE) != OK) - EMSG2(_("E230: Cannot read from \"%s\""), use_gvimrc); + semsg(_("E230: Cannot read from \"%s\""), use_gvimrc); } else { @@ -649,12 +649,12 @@ gui_init(void) gui_init_font(*p_guifont == NUL ? hl_get_font_name() : p_guifont, FALSE) == FAIL) { - EMSG(_("E665: Cannot start GUI, no valid font found")); + emsg(_("E665: Cannot start GUI, no valid font found")); goto error2; } #ifdef FEAT_MBYTE if (gui_get_wide_font() == FAIL) - EMSG(_("E231: 'guifontwide' invalid")); + emsg(_("E231: 'guifontwide' invalid")); #endif gui.num_cols = Columns; @@ -769,7 +769,7 @@ gui_init(void) #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) if (!im_xim_isvalid_imactivate()) - EMSG(_("E599: Value of 'imactivatekey' is invalid")); + emsg(_("E599: Value of 'imactivatekey' is invalid")); #endif /* When 'cmdheight' was set during startup it may not have taken * effect yet. */ @@ -4785,7 +4785,7 @@ gui_get_color(char_u *name) && gui.in_use #endif ) - EMSG2(_("E254: Cannot allocate color %s"), name); + semsg(_("E254: Cannot allocate color %s"), name); return t; } diff --git a/src/gui_at_fs.c b/src/gui_at_fs.c --- a/src/gui_at_fs.c +++ b/src/gui_at_fs.c @@ -1063,7 +1063,7 @@ SFinitFont(void) #endif if (!SFfont) { - EMSG2(_("E616: vim_SelFile: can't get font %s"), SF_DEFAULT_FONT); + semsg(_("E616: vim_SelFile: can't get font %s"), SF_DEFAULT_FONT); SFstatus = SEL_FILE_CANCEL; return; } @@ -2629,7 +2629,7 @@ SFprepareToReturn(void) XtRemoveTimeOut(SFdirModTimerId); if (SFchdir(SFstartDir)) { - EMSG(_("E614: vim_SelFile: can't return to current directory")); + emsg(_("E614: vim_SelFile: can't return to current directory")); SFstatus = SEL_FILE_CANCEL; } } @@ -2658,7 +2658,7 @@ vim_SelFile( if (mch_dirname((char_u *)SFstartDir, MAXPATHL) == FAIL) { - EMSG(_("E615: vim_SelFile: can't get current directory")); + emsg(_("E615: vim_SelFile: can't get current directory")); return NULL; } diff --git a/src/gui_at_sb.c b/src/gui_at_sb.c --- a/src/gui_at_sb.c +++ b/src/gui_at_sb.c @@ -485,7 +485,7 @@ CreateGC(Widget w) if (XGetGeometry (XtDisplay(w), sbw->scrollbar.thumb, &root, &x, &y, &width, &height, &bw, &depth) == 0) - EMSG(_("Scrollbar Widget: Could not get geometry of thumb pixmap.")); + emsg(_("Scrollbar Widget: Could not get geometry of thumb pixmap.")); } gcValues.foreground = sbw->scrollbar.foreground; diff --git a/src/gui_beval.c b/src/gui_beval.c --- a/src/gui_beval.c +++ b/src/gui_beval.c @@ -103,7 +103,7 @@ gui_mch_create_beval_area( if (mesg != NULL && mesgCB != NULL) { - IEMSG(_("E232: Cannot create BalloonEval with both message and callback")); + iemsg(_("E232: Cannot create BalloonEval with both message and callback")); return NULL; } diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -1664,7 +1664,7 @@ gui_mch_early_init_check(int give_messag { gui.dying = TRUE; if (give_message) - EMSG(_((char *)e_opendisp)); + emsg(_((char *)e_opendisp)); return FAIL; } return OK; @@ -1710,7 +1710,7 @@ gui_mch_init_check(void) if (!gtk_init_check(&gui_argc, &gui_argv)) { gui.dying = TRUE; - EMSG(_((char *)e_opendisp)); + emsg(_((char *)e_opendisp)); return FAIL; } @@ -5247,7 +5247,7 @@ gui_mch_get_font(char_u *name, int repor if (font == NULL) { if (report_error) - EMSG2(_((char *)e_font), name); + semsg(_((char *)e_font), name); return NULL; } @@ -7138,7 +7138,7 @@ gui_mch_register_sign(char_u *signfile) { /* The error message is already translated and will be more * descriptive than anything we could possibly do ourselves. */ - EMSG2("E255: %s", message); + semsg("E255: %s", message); if (input_conv.vc_type != CONV_NONE) vim_free(message); diff --git a/src/gui_mac.c b/src/gui_mac.c --- a/src/gui_mac.c +++ b/src/gui_mac.c @@ -3556,7 +3556,7 @@ gui_mch_get_font(char_u *name, int giveE if (font == NOFONT) { if (giveErrorIfMissing) - EMSG2(_(e_font), name); + semsg(_(e_font), name); return NOFONT; } /* diff --git a/src/gui_photon.c b/src/gui_photon.c --- a/src/gui_photon.c +++ b/src/gui_photon.c @@ -2937,7 +2937,7 @@ gui_mch_get_font(char_u *vim_font_name, } if (report_error) - EMSG2(e_font, vim_font_name); + semsg(e_font, vim_font_name); return FAIL; } diff --git a/src/gui_w32.c b/src/gui_w32.c --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -1582,7 +1582,7 @@ gui_mch_get_font( if (get_logfont(&lf, name, NULL, giveErrorIfMissing) == OK) font = get_font_handle(&lf); if (font == NOFONT && giveErrorIfMissing) - EMSG2(_(e_font), name); + semsg(_(e_font), name); return font; } @@ -5235,7 +5235,7 @@ gui_mch_set_parent(char *title) EnumWindows(FindWindowTitle, (LPARAM)title); if (vim_parent_hwnd == NULL) { - EMSG2(_("E671: Cannot find window title \"%s\""), title); + semsg(_("E671: Cannot find window title \"%s\""), title); mch_exit(2); } } @@ -5246,7 +5246,7 @@ ole_error(char *arg) { char buf[IOSIZE]; - /* Can't use EMSG() here, we have not finished initialisation yet. */ + /* Can't use emsg() here, we have not finished initialisation yet. */ vim_snprintf(buf, IOSIZE, _("E243: Argument not supported: \"-%s\"; Use the OLE version."), arg); @@ -5468,7 +5468,7 @@ gui_mch_init(void) #endif if (s_hwnd == NULL) { - EMSG(_("E672: Unable to open window inside MDI application")); + emsg(_("E672: Unable to open window inside MDI application")); mch_exit(2); } } @@ -8671,7 +8671,7 @@ gui_mch_register_sign(char_u *signfile) { if (sign.hImage) close_signicon_image(&sign); - EMSG(_(e_signdata)); + emsg(_(e_signdata)); } return (void *)psign; @@ -9025,7 +9025,7 @@ gui_mch_create_beval_area( if (mesg != NULL && mesgCB != NULL) { - IEMSG(_("E232: Cannot create BalloonEval with both message and callback")); + iemsg(_("E232: Cannot create BalloonEval with both message and callback")); return NULL; } diff --git a/src/gui_x11.c b/src/gui_x11.c --- a/src/gui_x11.c +++ b/src/gui_x11.c @@ -1295,7 +1295,7 @@ gui_mch_init_check(void) if (app_context == NULL || gui.dpy == NULL) { gui.dying = TRUE; - EMSG(_(e_opendisp)); + emsg(_(e_opendisp)); return FAIL; } return OK; @@ -1541,7 +1541,7 @@ gui_mch_init(void) } if (gui.color_approx) - EMSG(_("Vim E458: Cannot allocate colormap entry, some colors may be incorrect")); + emsg(_("Vim E458: Cannot allocate colormap entry, some colors may be incorrect")); #ifdef FEAT_SUN_WORKSHOP if (usingSunWorkShop) @@ -1970,7 +1970,7 @@ gui_mch_get_font(char_u *name, int giveE if (font == NULL) { if (giveErrorIfMissing) - EMSG2(_(e_font), name); + semsg(_(e_font), name); return NOFONT; } @@ -1994,7 +1994,7 @@ gui_mch_get_font(char_u *name, int giveE if (font->max_bounds.width != font->min_bounds.width) { - EMSG2(_(e_fontwidth), name); + semsg(_(e_fontwidth), name); XFreeFont(gui.dpy, font); return NOFONT; } @@ -2145,9 +2145,9 @@ gui_mch_get_fontset( if (giveErrorIfMissing) { - EMSG2(_("E250: Fonts for the following charsets are missing in fontset %s:"), name); + semsg(_("E250: Fonts for the following charsets are missing in fontset %s:"), name); for (i = 0; i < num_missing; i++) - EMSG2("%s", missing[i]); + semsg("%s", missing[i]); } XFreeStringList(missing); } @@ -2155,7 +2155,7 @@ gui_mch_get_fontset( if (fontset == NULL) { if (giveErrorIfMissing) - EMSG2(_(e_fontset), name); + semsg(_(e_fontset), name); return NOFONTSET; } @@ -2187,8 +2187,8 @@ check_fontset_sanity(XFontSet fs) { if (xfs[i]->max_bounds.width != xfs[i]->min_bounds.width) { - EMSG2(_("E252: Fontset name: %s"), base_name); - EMSG2(_("Font '%s' is not fixed-width"), font_name[i]); + semsg(_("E252: Fontset name: %s"), base_name); + semsg(_("Font '%s' is not fixed-width"), font_name[i]); return FAIL; } } @@ -2207,12 +2207,12 @@ check_fontset_sanity(XFontSet fs) if ( xfs[i]->max_bounds.width != 2 * min_width && xfs[i]->max_bounds.width != min_width) { - EMSG2(_("E253: Fontset name: %s"), base_name); - EMSG2(_("Font0: %s"), font_name[min_font_idx]); - EMSG2(_("Font1: %s"), font_name[i]); - EMSGN(_("Font%ld width is not twice that of font0"), i); - EMSGN(_("Font0 width: %ld"), xfs[min_font_idx]->max_bounds.width); - EMSGN(_("Font1 width: %ld"), xfs[i]->max_bounds.width); + semsg(_("E253: Fontset name: %s"), base_name); + semsg(_("Font0: %s"), font_name[min_font_idx]); + semsg(_("Font1: %s"), font_name[i]); + semsg(_("Font%ld width is not twice that of font0"), i); + semsg(_("Font0 width: %ld"), xfs[min_font_idx]->max_bounds.width); + semsg(_("Font1 width: %ld"), xfs[i]->max_bounds.width); return FAIL; } } @@ -3326,7 +3326,7 @@ gui_mch_register_sign(char_u *signfile) gui.sign_width = sign->width + 8; */ } else - EMSG(_(e_signdata)); + emsg(_(e_signdata)); } return (void *)sign; diff --git a/src/hangulin.c b/src/hangulin.c --- a/src/hangulin.c +++ b/src/hangulin.c @@ -588,7 +588,7 @@ hangul_automata2(char_u *buf, int_u *c) return AUTOMATA_CORRECT_NEW; default: - IEMSG(_("E256: Hangul automata ERROR")); + iemsg(_("E256: Hangul automata ERROR")); break; } return AUTOMATA_ERROR; /* RrEeAaLlLlYy EeRrRrOoRr */ diff --git a/src/hardcopy.c b/src/hardcopy.c --- a/src/hardcopy.c +++ b/src/hardcopy.c @@ -135,7 +135,7 @@ typedef struct int ff; /* seen form feed character */ } prt_pos_T; -static char_u *parse_list_options(char_u *option_str, option_table_T *table, int table_size); +static char *parse_list_options(char_u *option_str, option_table_T *table, int table_size); static colnr_T hardcopy_line(prt_settings_T *psettings, int page_line, prt_pos_T *ppos); @@ -143,7 +143,7 @@ static colnr_T hardcopy_line(prt_setting * Parse 'printoptions' and set the flags in "printer_opts". * Returns an error message or NULL; */ - char_u * + char * parse_printoptions(void) { return parse_list_options(p_popt, printer_opts, OPT_PRINT_NUM_OPTIONS); @@ -154,7 +154,7 @@ parse_printoptions(void) * Parse 'printmbfont' and set the flags in "mbfont_opts". * Returns an error message or NULL; */ - char_u * + char * parse_printmbfont(void) { return parse_list_options(p_pmfn, mbfont_opts, OPT_MBFONT_NUM_OPTIONS); @@ -170,14 +170,14 @@ parse_printmbfont(void) * Returns an error message for an illegal option, NULL otherwise. * Only used for the printer at the moment... */ - static char_u * + static char * parse_list_options( char_u *option_str, option_table_T *table, int table_size) { option_table_T *old_opts; - char_u *ret = NULL; + char *ret = NULL; char_u *stringp; char_u *colonp; char_u *commap; @@ -205,7 +205,7 @@ parse_list_options( colonp = vim_strchr(stringp, ':'); if (colonp == NULL) { - ret = (char_u *)N_("E550: Missing colon"); + ret = N_("E550: Missing colon"); break; } commap = vim_strchr(stringp, ','); @@ -220,7 +220,7 @@ parse_list_options( if (idx == table_size) { - ret = (char_u *)N_("E551: Illegal component"); + ret = N_("E551: Illegal component"); break; } p = colonp + 1; @@ -230,7 +230,7 @@ parse_list_options( { if (!VIM_ISDIGIT(*p)) { - ret = (char_u *)N_("E552: digit expected"); + ret = N_("E552: digit expected"); break; } @@ -576,13 +576,13 @@ ex_hardcopy(exarg_T *eap) # ifdef FEAT_POSTSCRIPT if (*eap->arg == '>') { - char_u *errormsg = NULL; + char *errormsg = NULL; /* Expand things like "%.ps". */ if (expand_filename(eap, eap->cmdlinep, &errormsg) == FAIL) { if (errormsg != NULL) - EMSG(errormsg); + emsg(errormsg); return; } settings.outfile = skipwhite(eap->arg + 1); @@ -1431,7 +1431,7 @@ prt_write_file_raw_len(char_u *buffer, i && fwrite(buffer, sizeof(char_u), bytes, prt_ps_fd) != (size_t)bytes) { - EMSG(_("E455: Error writing to PostScript output file")); + emsg(_("E455: Error writing to PostScript output file")); prt_file_error = TRUE; } } @@ -1873,7 +1873,7 @@ prt_open_resource(struct prt_ps_resource fd_resource = mch_fopen((char *)resource->filename, READBIN); if (fd_resource == NULL) { - EMSG2(_("E624: Can't open file \"%s\""), resource->filename); + semsg(_("E624: Can't open file \"%s\""), resource->filename); return FALSE; } vim_memset(prt_resfile.buffer, NUL, PRT_FILE_BUFFER_LEN); @@ -1883,7 +1883,7 @@ prt_open_resource(struct prt_ps_resource PRT_FILE_BUFFER_LEN, fd_resource); if (ferror(fd_resource)) { - EMSG2(_("E457: Can't read PostScript resource file \"%s\""), + semsg(_("E457: Can't read PostScript resource file \"%s\""), resource->filename); fclose(fd_resource); return FALSE; @@ -1900,7 +1900,7 @@ prt_open_resource(struct prt_ps_resource if (prt_resfile_strncmp(offset, PRT_RESOURCE_HEADER, (int)STRLEN(PRT_RESOURCE_HEADER)) != 0) { - EMSG2(_("E618: file \"%s\" is not a PostScript resource file"), + semsg(_("E618: file \"%s\" is not a PostScript resource file"), resource->filename); return FALSE; } @@ -1917,7 +1917,7 @@ prt_open_resource(struct prt_ps_resource if (prt_resfile_strncmp(offset, PRT_RESOURCE_RESOURCE, (int)STRLEN(PRT_RESOURCE_RESOURCE)) != 0) { - EMSG2(_("E619: file \"%s\" is not a supported PostScript resource file"), + semsg(_("E619: file \"%s\" is not a supported PostScript resource file"), resource->filename); return FALSE; } @@ -1935,7 +1935,7 @@ prt_open_resource(struct prt_ps_resource resource->type = PRT_RESOURCE_TYPE_CMAP; else { - EMSG2(_("E619: file \"%s\" is not a supported PostScript resource file"), + semsg(_("E619: file \"%s\" is not a supported PostScript resource file"), resource->filename); return FALSE; } @@ -1977,7 +1977,7 @@ prt_open_resource(struct prt_ps_resource if (!seen_title || !seen_version) { - EMSG2(_("E619: file \"%s\" is not a supported PostScript resource file"), + semsg(_("E619: file \"%s\" is not a supported PostScript resource file"), resource->filename); return FALSE; } @@ -1991,7 +1991,7 @@ prt_check_resource(struct prt_ps_resourc /* Version number m.n should match, the revision number does not matter */ if (STRNCMP(resource->version, version, STRLEN(version))) { - EMSG2(_("E621: \"%s\" resource file has wrong version"), + semsg(_("E621: \"%s\" resource file has wrong version"), resource->name); return FALSE; } @@ -2465,7 +2465,7 @@ mch_print_init( /* Check encoding and character set are compatible */ if ((p_mbenc->needs_charset & p_mbchar->has_charset) == 0) { - EMSG(_("E673: Incompatible multi-byte encoding and character set.")); + emsg(_("E673: Incompatible multi-byte encoding and character set.")); return FALSE; } @@ -2482,7 +2482,7 @@ mch_print_init( /* Add custom CMap character set name */ if (*p_pmcs == NUL) { - EMSG(_("E674: printmbcharset cannot be empty with multi-byte encoding.")); + emsg(_("E674: printmbcharset cannot be empty with multi-byte encoding.")); return FALSE; } vim_strncpy((char_u *)prt_cmap, p_pmcs, sizeof(prt_cmap) - 3); @@ -2500,7 +2500,7 @@ mch_print_init( if (!mbfont_opts[OPT_MBFONT_REGULAR].present) { - EMSG(_("E675: No default font specified for multi-byte printing.")); + emsg(_("E675: No default font specified for multi-byte printing.")); return FALSE; } @@ -2677,7 +2677,7 @@ mch_print_init( prt_ps_file_name = vim_tempname('p', TRUE); if (prt_ps_file_name == NULL) { - EMSG(_(e_notmp)); + emsg(_(e_notmp)); return FAIL; } prt_ps_fd = mch_fopen((char *)prt_ps_file_name, WRITEBIN); @@ -2693,7 +2693,7 @@ mch_print_init( } if (prt_ps_fd == NULL) { - EMSG(_("E324: Can't open PostScript output file")); + emsg(_("E324: Can't open PostScript output file")); mch_print_cleanup(); return FAIL; } @@ -2729,7 +2729,7 @@ prt_add_resource(struct prt_ps_resource_ fd_resource = mch_fopen((char *)resource->filename, READBIN); if (fd_resource == NULL) { - EMSG2(_("E456: Can't open file \"%s\""), resource->filename); + semsg(_("E456: Can't open file \"%s\""), resource->filename); return FALSE; } prt_dsc_resources("BeginResource", prt_resource_types[resource->type], @@ -2743,7 +2743,7 @@ prt_add_resource(struct prt_ps_resource_ sizeof(resource_buffer), fd_resource); if (ferror(fd_resource)) { - EMSG2(_("E457: Can't read PostScript resource file \"%s\""), + semsg(_("E457: Can't read PostScript resource file \"%s\""), resource->filename); fclose(fd_resource); return FALSE; @@ -2880,7 +2880,7 @@ mch_print_begin(prt_settings_T *psetting /* Search for external resources VIM supplies */ if (!prt_find_resource("prolog", res_prolog)) { - EMSG(_("E456: Can't find PostScript resource file \"prolog.ps\"")); + emsg(_("E456: Can't find PostScript resource file \"prolog.ps\"")); goto theend; } if (!prt_open_resource(res_prolog)) @@ -2893,7 +2893,7 @@ mch_print_begin(prt_settings_T *psetting /* Look for required version of multi-byte printing procset */ if (!prt_find_resource("cidfont", res_cidfont)) { - EMSG(_("E456: Can't find PostScript resource file \"cidfont.ps\"")); + emsg(_("E456: Can't find PostScript resource file \"cidfont.ps\"")); goto theend; } if (!prt_open_resource(res_cidfont)) @@ -2931,7 +2931,7 @@ mch_print_begin(prt_settings_T *psetting p_encoding = (char_u *)"latin1"; if (!prt_find_resource((char *)p_encoding, res_encoding)) { - EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""), + semsg(_("E456: Can't find PostScript resource file \"%s.ps\""), p_encoding); goto theend; } @@ -2953,7 +2953,7 @@ mch_print_begin(prt_settings_T *psetting /* Include ASCII range encoding vector */ if (!prt_find_resource(prt_ascii_encoding, res_encoding)) { - EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""), + semsg(_("E456: Can't find PostScript resource file \"%s.ps\""), prt_ascii_encoding); goto theend; } @@ -2969,7 +2969,7 @@ mch_print_begin(prt_settings_T *psetting /* Set up encoding conversion if required */ if (FAIL == convert_setup(&prt_conv, p_enc, p_encoding)) { - EMSG2(_("E620: Unable to convert to print encoding \"%s\""), + semsg(_("E620: Unable to convert to print encoding \"%s\""), p_encoding); goto theend; } @@ -2982,7 +2982,7 @@ mch_print_begin(prt_settings_T *psetting /* Find user supplied CMap */ if (!prt_find_resource(prt_cmap, res_cmap)) { - EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""), + semsg(_("E456: Can't find PostScript resource file \"%s.ps\""), prt_cmap); goto theend; } @@ -3236,7 +3236,7 @@ mch_print_end(prt_settings_T *psettings) /* Not printing to a file: use 'printexpr' to print the file. */ if (eval_printexpr(prt_ps_file_name, psettings->arguments) == FAIL) - EMSG(_("E365: Failed to print PostScript file")); + emsg(_("E365: Failed to print PostScript file")); else prt_message((char_u *)_("Print job sent.")); } diff --git a/src/hashtab.c b/src/hashtab.c --- a/src/hashtab.c +++ b/src/hashtab.c @@ -334,9 +334,9 @@ hash_may_resize( #ifdef HT_DEBUG if (ht->ht_used > ht->ht_filled) - EMSG("hash_may_resize(): more used than filled"); + emsg("hash_may_resize(): more used than filled"); if (ht->ht_filled >= ht->ht_mask + 1) - EMSG("hash_may_resize(): table completely filled"); + emsg("hash_may_resize(): table completely filled"); #endif if (minitems == 0) diff --git a/src/if_cscope.c b/src/if_cscope.c --- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -76,7 +76,7 @@ static cscmd_T cs_cmds[] = static void cs_usage_msg(csid_e x) { - (void)EMSG2(_("E560: Usage: cs[cope] %s"), cs_cmds[(int)x].usage); + (void)semsg(_("E560: Usage: cs[cope] %s"), cs_cmds[(int)x].usage); } #if defined(FEAT_CMDL_COMPL) || defined(PROTO) @@ -254,7 +254,7 @@ ex_cstag(exarg_T *eap) if (*eap->arg == NUL) { - (void)EMSG(_("E562: Usage: cstag ")); + (void)emsg(_("E562: Usage: cstag ")); return; } @@ -312,7 +312,7 @@ ex_cstag(exarg_T *eap) if (!ret) { - (void)EMSG(_("E257: cstag: tag not found")); + (void)emsg(_("E257: cstag: tag not found")); #if defined(FEAT_QUICKFIX) g_do_tagpreview = 0; #endif @@ -471,11 +471,11 @@ cs_stat_emsg(char *fname) if (buf != NULL) { (void)sprintf(buf, stat_emsg, fname, errno); - (void)EMSG(buf); + (void)emsg(buf); vim_free(buf); } else - (void)EMSG(_("E563: stat error")); + (void)emsg(_("E563: stat error")); } @@ -579,7 +579,7 @@ staterr: else { if (p_csverbose) - (void)EMSG2( + (void)semsg( _("E564: %s is not a directory or a valid cscope database"), fname); goto add_err; @@ -598,7 +598,7 @@ staterr: { msg_clr_eos(); (void)smsg_attr(HL_ATTR(HLF_R), - (char_u *)_("Added cscope database %s"), + _("Added cscope database %s"), csinfo[i].fname); } } @@ -651,7 +651,7 @@ cs_cnt_connections(void) cs_reading_emsg( int idx) /* connection index */ { - EMSGN(_("E262: error reading cscope connection %ld"), idx); + semsg(_("E262: error reading cscope connection %ld"), idx); } #define CSREAD_BUFSIZE 2048 @@ -757,7 +757,7 @@ cs_create_cmd(char *csoption, char *patt search = 9; break; default : - (void)EMSG(_("E561: unknown cscope search type")); + (void)emsg(_("E561: unknown cscope search type")); cs_usage_msg(Find); return NULL; } @@ -814,7 +814,7 @@ cs_create_connection(int i) to_cs[0] = to_cs[1] = from_cs[0] = from_cs[1] = -1; if (pipe(to_cs) < 0 || pipe(from_cs) < 0) { - (void)EMSG(_("E566: Could not create cscope pipes")); + (void)emsg(_("E566: Could not create cscope pipes")); err_closing: if (to_cs[0] != -1) (void)close(to_cs[0]); @@ -830,7 +830,7 @@ err_closing: switch (csinfo[i].pid = fork()) { case -1: - (void)EMSG(_("E622: Could not fork for cscope")); + (void)emsg(_("E622: Could not fork for cscope")); goto err_closing; case 0: /* child: run cscope. */ if (dup2(to_cs[0], STDIN_FILENO) == -1) @@ -853,7 +853,7 @@ err_closing: if (!(pipe_stdin = CreatePipe(&stdin_rd, &stdin_wr, &sa, 0)) || !(pipe_stdout = CreatePipe(&stdout_rd, &stdout_wr, &sa, 0))) { - (void)EMSG(_("E566: Could not create cscope pipes")); + (void)emsg(_("E566: Could not create cscope pipes")); err_closing: if (pipe_stdin) { @@ -987,7 +987,7 @@ err_closing: if (!created) { PERROR(_("cs_create_connection exec failed")); - (void)EMSG(_("E623: Could not spawn cscope process")); + (void)emsg(_("E623: Could not spawn cscope process")); goto err_closing; } /* else */ @@ -1029,7 +1029,7 @@ cs_find(exarg_T *eap) if (cs_check_for_connections() == FALSE) { - (void)EMSG(_("E567: no cscope connections")); + (void)emsg(_("E567: no cscope connections")); return FALSE; } @@ -1127,7 +1127,7 @@ cs_find_common( if (buf != NULL) { sprintf(buf, nf, *qfpos, *(qfpos-1)); - (void)EMSG(buf); + (void)emsg(buf); vim_free(buf); } return FALSE; @@ -1194,11 +1194,11 @@ cs_find_common( buf = (char *)alloc((unsigned)(strlen(opt) + strlen(pat) + strlen(nf))); if (buf == NULL) - (void)EMSG(nf); + (void)emsg(nf); else { sprintf(buf, nf, opt, pat); - (void)EMSG(buf); + (void)emsg(buf); vim_free(buf); } vim_free(nummatches); @@ -1216,7 +1216,7 @@ cs_find_common( f = mch_fopen((char *)tmp, "w"); if (f == NULL) - EMSG2(_(e_notopen), tmp); + semsg(_(e_notopen), tmp); else { cs_file_results(f, nummatches); @@ -1289,7 +1289,7 @@ cs_help(exarg_T *eap UNUSED) /* Use %*s rather than %30s to ensure proper alignment in utf-8 */ if (space_cnt < 0) space_cnt = 0; - (void)smsg((char_u *)_("%-5s: %s%*s (Usage: %s)"), + (void)smsg(_("%-5s: %s%*s (Usage: %s)"), cmdp->name, help, space_cnt, " ", cmdp->usage); @@ -1378,18 +1378,18 @@ cs_insert_filelist( if (winmsg != NULL) { - (void)EMSG2(cant_msg, winmsg); + (void)semsg(cant_msg, winmsg); LocalFree(winmsg); } else /* subst filename if can't get error text */ - (void)EMSG2(cant_msg, fname); + (void)semsg(cant_msg, fname); } return -1; case FILEINFO_INFO_FAIL: /* GetFileInformationByHandle() failed */ if (p_csverbose) - (void)EMSG(_("E626: cannot get cscope database information")); + (void)emsg(_("E626: cannot get cscope database information")); return -1; } #endif @@ -1412,7 +1412,7 @@ cs_insert_filelist( ) { if (p_csverbose) - (void)EMSG(_("E568: duplicate cscope database not added")); + (void)emsg(_("E568: duplicate cscope database not added")); return -1; } @@ -1555,7 +1555,7 @@ cs_kill(exarg_T *eap UNUSED) if ((i != -1) && (i >= csinfo_size || i < -1 || csinfo[i].fname == NULL)) { if (p_csverbose) - (void)EMSG2(_("E261: cscope connection %s not found"), stok); + (void)semsg(_("E261: cscope connection %s not found"), stok); } else { @@ -1587,7 +1587,7 @@ cs_kill_execute( { msg_clr_eos(); (void)smsg_attr(HL_ATTR(HLF_R) | MSG_HIST, - (char_u *)_("cscope connection %s closed"), cname); + _("cscope connection %s closed"), cname); } cs_release_csp(i, TRUE); } @@ -1723,7 +1723,7 @@ cs_manage_matches( cs_print_tags_priv(mp, cp, cnt); break; default: /* should not reach here */ - IEMSG(_("E570: fatal error in cs_manage_matches")); + iemsg(_("E570: fatal error in cs_manage_matches")); return NULL; } @@ -2141,7 +2141,7 @@ cs_read_prompt(int i) buf[bufpos - epromptlen] = NUL; /* print message to user */ - (void)EMSG2(cs_emsg, buf); + (void)semsg(cs_emsg, buf); /* send RETURN to cscope */ (void)putc('\n', csinfo[i].to_fp); @@ -2162,7 +2162,7 @@ cs_read_prompt(int i) { PERROR("cs_read_prompt EOF"); if (buf != NULL && buf[0] != NUL) - (void)EMSG2(cs_emsg, buf); + (void)semsg(cs_emsg, buf); else if (p_csverbose) cs_reading_emsg(i); /* don't have additional information */ cs_release_csp(i, TRUE); @@ -2476,10 +2476,10 @@ cs_show(exarg_T *eap UNUSED) continue; if (csinfo[i].ppath != NULL) - (void)smsg((char_u *)"%2d %-5ld %-34s %-32s", + (void)smsg("%2d %-5ld %-34s %-32s", i, (long)csinfo[i].pid, csinfo[i].fname, csinfo[i].ppath); else - (void)smsg((char_u *)"%2d %-5ld %-34s ", + (void)smsg("%2d %-5ld %-34s ", i, (long)csinfo[i].pid, csinfo[i].fname); } } diff --git a/src/if_lua.c b/src/if_lua.c --- a/src/if_lua.c +++ b/src/if_lua.c @@ -415,7 +415,7 @@ lua_link_init(char *libname, int verbose if (!hinstLua) { if (verbose) - EMSG2(_(e_loadlib), libname); + semsg(_(e_loadlib), libname); return FAIL; } for (reg = luaV_dll; reg->func; reg++) @@ -425,7 +425,7 @@ lua_link_init(char *libname, int verbose close_dll(hinstLua); hinstLua = 0; if (verbose) - EMSG2(_(e_loadfunc), reg->name); + semsg(_(e_loadfunc), reg->name); return FAIL; } } @@ -1795,7 +1795,7 @@ luaV_luaeval (lua_State *L) return 0; } if (luaV_totypval(L, -1, rettv) == FAIL) - EMSG("luaeval: cannot convert value"); + emsg("luaeval: cannot convert value"); return 0; } @@ -1926,7 +1926,7 @@ lua_init(void) #ifdef DYNAMIC_LUA if (!lua_enabled(TRUE)) { - EMSG(_("Lua library cannot be loaded.")); + emsg(_("Lua library cannot be loaded.")); return FAIL; } #endif @@ -1978,7 +1978,7 @@ ex_luado(exarg_T *eap) if (lua_init() == FAIL) return; if (u_save(eap->line1 - 1, eap->line2 + 1) == FAIL) { - EMSG(_("cannot save undo information")); + emsg(_("cannot save undo information")); return; } luaV_setrange(L, eap->line1, eap->line2); diff --git a/src/if_mzsch.c b/src/if_mzsch.c --- a/src/if_mzsch.c +++ b/src/if_mzsch.c @@ -672,14 +672,14 @@ mzscheme_runtime_link_init(char *sch_dll if (!hMzGC) { if (verbose) - EMSG2(_(e_loadlib), gc_dll); + semsg(_(e_loadlib), gc_dll); return FAIL; } if (!hMzSch) { if (verbose) - EMSG2(_(e_loadlib), sch_dll); + semsg(_(e_loadlib), sch_dll); return FAIL; } @@ -693,7 +693,7 @@ mzscheme_runtime_link_init(char *sch_dll FreeLibrary(hMzGC); hMzGC = 0; if (verbose) - EMSG2(_(e_loadfunc), thunk->name); + semsg(_(e_loadfunc), thunk->name); return FAIL; } } @@ -707,7 +707,7 @@ mzscheme_runtime_link_init(char *sch_dll FreeLibrary(hMzGC); hMzGC = 0; if (verbose) - EMSG2(_(e_loadfunc), thunk->name); + semsg(_(e_loadfunc), thunk->name); return FAIL; } } @@ -1260,13 +1260,13 @@ mzscheme_init(void) #ifdef DYNAMIC_MZSCHEME if (disabled || !mzscheme_enabled(TRUE)) { - EMSG(_("E815: Sorry, this command is disabled, the MzScheme libraries could not be loaded.")); + emsg(_("E815: Sorry, this command is disabled, the MzScheme libraries could not be loaded.")); return -1; } #endif if (load_base_module_failed || startup_mzscheme()) { - EMSG(_("E895: Sorry, this command is disabled, the MzScheme's racket/base module could not be loaded.")); + emsg(_("E895: Sorry, this command is disabled, the MzScheme's racket/base module could not be loaded.")); return -1; } initialized = TRUE; @@ -1572,7 +1572,7 @@ do_intrnl_output(char *mesg, int error) { *p = '\0'; if (error) - EMSG(prev); + emsg(prev); else MSG(prev); prev = p + 1; @@ -1580,7 +1580,7 @@ do_intrnl_output(char *mesg, int error) } if (error) - EMSG(prev); + emsg(prev); else MSG(prev); } diff --git a/src/if_perl.xs b/src/if_perl.xs --- a/src/if_perl.xs +++ b/src/if_perl.xs @@ -695,7 +695,7 @@ perl_runtime_link_init(char *libname, in if ((hPerlLib = load_dll(libname)) == NULL) { if (verbose) - EMSG2(_("E370: Could not load library %s"), libname); + semsg(_("E370: Could not load library %s"), libname); return FAIL; } for (i = 0; perl_funcname_table[i].ptr; ++i) @@ -706,7 +706,7 @@ perl_runtime_link_init(char *libname, in close_dll(hPerlLib); hPerlLib = NULL; if (verbose) - EMSG2(_(e_loadfunc), perl_funcname_table[i].name); + semsg((const char *)_(e_loadfunc), perl_funcname_table[i].name); return FAIL; } } @@ -998,7 +998,7 @@ ex_perl(exarg_T *eap) #ifdef DYNAMIC_PERL if (!perl_enabled(TRUE)) { - EMSG(_(e_noperl)); + emsg(_(e_noperl)); vim_free(script); return; } @@ -1025,7 +1025,7 @@ ex_perl(exarg_T *eap) safe = perl_get_sv("VIM::safe", FALSE); # ifndef MAKE_TEST /* avoid a warning for unreachable code */ if (safe == NULL || !SvTRUE(safe)) - EMSG(_("E299: Perl evaluation forbidden in sandbox without the Safe module")); + emsg(_("E299: Perl evaluation forbidden in sandbox without the Safe module")); else # endif { @@ -1235,7 +1235,7 @@ perl_to_vim(SV *sv, typval_T *rettv) key = hv_iterkey(entry, &key_len); if (!key || !key_len || strlen(key) < (size_t)key_len) { - EMSG2("Malformed key Dictionary '%s'", key && *key ? key : "(empty)"); + semsg("Malformed key Dictionary '%s'", key && *key ? key : "(empty)"); break; } @@ -1286,7 +1286,7 @@ do_perleval(char_u *str, typval_T *rettv #ifdef DYNAMIC_PERL if (!perl_enabled(TRUE)) { - EMSG(_(e_noperl)); + emsg(_(e_noperl)); return; } #endif @@ -1304,7 +1304,7 @@ do_perleval(char_u *str, typval_T *rettv safe = get_sv("VIM::safe", FALSE); # ifndef MAKE_TEST /* avoid a warning for unreachable code */ if (safe == NULL || !SvTRUE(safe)) - EMSG(_("E299: Perl evaluation forbidden in sandbox without the Safe module")); + emsg(_("E299: Perl evaluation forbidden in sandbox without the Safe module")); else # endif { @@ -1356,7 +1356,7 @@ ex_perldo(exarg_T *eap) #ifdef DYNAMIC_PERL if (!perl_enabled(TRUE)) { - EMSG(_(e_noperl)); + emsg(_(e_noperl)); return; } #endif diff --git a/src/if_py_both.h b/src/if_py_both.h --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -536,7 +536,7 @@ PythonIO_Init_io(void) if (PyErr_Occurred()) { - EMSG(_("E264: Python: Error initialising I/O objects")); + emsg(_("E264: Python: Error initialising I/O objects")); return -1; } @@ -5664,7 +5664,7 @@ run_cmd(const char *cmd, void *arg UNUSE } else if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_SystemExit)) { - EMSG2(_(e_py_systemexit), "python"); + semsg(_(e_py_systemexit), "python"); PyErr_Clear(); } else @@ -5691,7 +5691,7 @@ run_do(const char *cmd, void *arg UNUSED if (u_save((linenr_T)RangeStart - 1, (linenr_T)RangeEnd + 1) != OK) { - EMSG(_("cannot save undo information")); + emsg(_("cannot save undo information")); return; } @@ -5709,7 +5709,7 @@ run_do(const char *cmd, void *arg UNUSED else if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_SystemExit)) { PyMem_Free(code); - EMSG2(_(e_py_systemexit), "python"); + semsg(_(e_py_systemexit), "python"); PyErr_Clear(); return; } @@ -5720,7 +5720,7 @@ run_do(const char *cmd, void *arg UNUSED if (status) { - EMSG(_("failed to run the code")); + emsg(_("failed to run the code")); return; } @@ -5810,20 +5810,20 @@ run_eval(const char *cmd, typval_T *rett { if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_SystemExit)) { - EMSG2(_(e_py_systemexit), "python"); + semsg(_(e_py_systemexit), "python"); PyErr_Clear(); } else { if (PyErr_Occurred() && !msg_silent) PyErr_PrintEx(0); - EMSG(_("E858: Eval did not return a valid python object")); + emsg(_("E858: Eval did not return a valid python object")); } } else { if (ConvertFromPyObject(run_ret, rettv) == -1) - EMSG(_("E859: Failed to convert returned python object to vim value")); + emsg(_("E859: Failed to convert returned python object to vim value")); Py_DECREF(run_ret); } PyErr_Clear(); @@ -6727,7 +6727,7 @@ init_sys_path(void) else { VimTryStart(); - EMSG(_("Failed to set path hook: sys.path_hooks is not a list\n" + emsg(_("Failed to set path hook: sys.path_hooks is not a list\n" "You should now do the following:\n" "- append vim.path_hook to sys.path_hooks\n" "- append vim.VIM_SPECIAL_PATH to sys.path\n")); @@ -6757,7 +6757,7 @@ init_sys_path(void) else { VimTryStart(); - EMSG(_("Failed to set path: sys.path is not a list\n" + emsg(_("Failed to set path: sys.path is not a list\n" "You should now append vim.VIM_SPECIAL_PATH to sys.path")); VimTryEnd(); /* Discard the error */ } diff --git a/src/if_python.c b/src/if_python.c --- a/src/if_python.c +++ b/src/if_python.c @@ -685,7 +685,7 @@ python_runtime_link_init(char *libname, if (python3_loaded()) { if (verbose) - EMSG(_("E836: This Vim cannot execute :python after using :py3")); + emsg(_("E836: This Vim cannot execute :python after using :py3")); return FAIL; } #endif @@ -696,7 +696,7 @@ python_runtime_link_init(char *libname, if (!hinstPython) { if (verbose) - EMSG2(_(e_loadlib), libname); + semsg(_(e_loadlib), libname); return FAIL; } @@ -708,7 +708,7 @@ python_runtime_link_init(char *libname, close_dll(hinstPython); hinstPython = 0; if (verbose) - EMSG2(_(e_loadfunc), python_funcname_table[i].name); + semsg(_(e_loadfunc), python_funcname_table[i].name); return FAIL; } } @@ -725,7 +725,7 @@ python_runtime_link_init(char *libname, close_dll(hinstPython); hinstPython = 0; if (verbose) - EMSG2(_(e_loadfunc), "PyUnicode_UCSX_*"); + semsg(_(e_loadfunc), "PyUnicode_UCSX_*"); return FAIL; } @@ -928,7 +928,7 @@ Python_Init(void) #ifdef DYNAMIC_PYTHON if (!python_enabled(TRUE)) { - EMSG(_("E263: Sorry, this command is disabled, the Python library could not be loaded.")); + emsg(_("E263: Sorry, this command is disabled, the Python library could not be loaded.")); goto fail; } #endif @@ -960,7 +960,7 @@ Python_Init(void) site = PyImport_ImportModule("site"); if (site == NULL) { - EMSG(_("E887: Sorry, this command is disabled, the Python's site module could not be loaded.")); + emsg(_("E887: Sorry, this command is disabled, the Python's site module could not be loaded.")); goto fail; } Py_DECREF(site); @@ -1035,7 +1035,7 @@ DoPyCommand(const char *cmd, rangeinitia #ifndef PY_CAN_RECURSE if (recursive) { - EMSG(_("E659: Cannot invoke Python recursively")); + emsg(_("E659: Cannot invoke Python recursively")); return; } ++recursive; diff --git a/src/if_python3.c b/src/if_python3.c --- a/src/if_python3.c +++ b/src/if_python3.c @@ -634,7 +634,7 @@ py3_runtime_link_init(char *libname, int if (python_loaded()) { if (verbose) - EMSG(_("E837: This Vim cannot execute :py3 after using :python")); + emsg(_("E837: This Vim cannot execute :py3 after using :python")); return FAIL; } # endif @@ -646,7 +646,7 @@ py3_runtime_link_init(char *libname, int if (!hinstPy3) { if (verbose) - EMSG2(_(e_loadlib), libname); + semsg(_(e_loadlib), libname); return FAIL; } @@ -658,7 +658,7 @@ py3_runtime_link_init(char *libname, int close_dll(hinstPy3); hinstPy3 = 0; if (verbose) - EMSG2(_(e_loadfunc), py3_funcname_table[i].name); + semsg(_(e_loadfunc), py3_funcname_table[i].name); return FAIL; } } @@ -693,7 +693,7 @@ py3_runtime_link_init(char *libname, int close_dll(hinstPy3); hinstPy3 = 0; if (verbose) - EMSG2(_(e_loadfunc), "PyUnicode_UCSX_*"); + semsg(_(e_loadfunc), "PyUnicode_UCSX_*"); return FAIL; } @@ -864,7 +864,7 @@ Python3_Init(void) #ifdef DYNAMIC_PYTHON3 if (!python3_enabled(TRUE)) { - EMSG(_("E263: Sorry, this command is disabled, the Python library could not be loaded.")); + emsg(_("E263: Sorry, this command is disabled, the Python library could not be loaded.")); goto fail; } #endif diff --git a/src/if_ruby.c b/src/if_ruby.c --- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -745,7 +745,7 @@ ruby_runtime_link_init(char *libname, in if (!hinstRuby) { if (verbose) - EMSG2(_(e_loadlib), libname); + semsg(_(e_loadlib), libname); return FAIL; } @@ -757,7 +757,7 @@ ruby_runtime_link_init(char *libname, in close_dll(hinstRuby); hinstRuby = NULL; if (verbose) - EMSG2(_(e_loadfunc), ruby_funcname_table[i].name); + semsg(_(e_loadfunc), ruby_funcname_table[i].name); return FAIL; } } @@ -885,7 +885,7 @@ void ex_rubydo(exarg_T *eap) { if (TYPE(line) != T_STRING) { - EMSG(_("E265: $_ must be an instance of String")); + emsg(_("E265: $_ must be an instance of String")); return; } ml_replace(i, (char_u *) StringValuePtr(line), 1); @@ -979,7 +979,7 @@ static int ensure_ruby_initialized(void) } else { - EMSG(_("E266: Sorry, this command is disabled, the Ruby library could not be loaded.")); + emsg(_("E266: Sorry, this command is disabled, the Ruby library could not be loaded.")); return 0; } #endif @@ -1013,19 +1013,19 @@ static void error_print(int state) switch (state) { case TAG_RETURN: - EMSG(_("E267: unexpected return")); + emsg(_("E267: unexpected return")); break; case TAG_NEXT: - EMSG(_("E268: unexpected next")); + emsg(_("E268: unexpected next")); break; case TAG_BREAK: - EMSG(_("E269: unexpected break")); + emsg(_("E269: unexpected break")); break; case TAG_REDO: - EMSG(_("E270: unexpected redo")); + emsg(_("E270: unexpected redo")); break; case TAG_RETRY: - EMSG(_("E271: retry outside of rescue clause")); + emsg(_("E271: retry outside of rescue clause")); break; case TAG_RAISE: case TAG_FATAL: @@ -1038,7 +1038,7 @@ static void error_print(int state) einfo = rb_obj_as_string(error); if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0) { - EMSG(_("E272: unhandled exception")); + emsg(_("E272: unhandled exception")); } else { @@ -1050,7 +1050,7 @@ static void error_print(int state) RSTRING_PTR(epath), RSTRING_PTR(einfo)); p = strchr(buff, '\n'); if (p) *p = '\0'; - EMSG(buff); + emsg(buff); } attr = syn_name2attr((char_u *)"Error"); @@ -1066,7 +1066,7 @@ static void error_print(int state) break; default: vim_snprintf(buff, BUFSIZ, _("E273: unknown longjmp status %d"), state); - EMSG(buff); + emsg(buff); break; } } diff --git a/src/if_tcl.c b/src/if_tcl.c --- a/src/if_tcl.c +++ b/src/if_tcl.c @@ -213,7 +213,7 @@ tcl_runtime_link_init(char *libname, int if (!(hTclLib = load_dll(libname))) { if (verbose) - EMSG2(_(e_loadlib), libname); + semsg(_(e_loadlib), libname); return FAIL; } for (i = 0; tcl_funcname_table[i].ptr; ++i) @@ -224,7 +224,7 @@ tcl_runtime_link_init(char *libname, int close_dll(hTclLib); hTclLib = NULL; if (verbose) - EMSG2(_(e_loadfunc), tcl_funcname_table[i].name); + semsg(_(e_loadfunc), tcl_funcname_table[i].name); return FAIL; } } @@ -1539,7 +1539,7 @@ tclsetdelcmd( reflist = reflist->next; } /* This should never happen. Famous last word? */ - EMSG(_("E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim.org")); + emsg(_("E280: TCL FATAL ERROR: reflist corrupt!? Please report this to vim-dev@vim.org")); Tcl_SetResult(interp, _("cannot register callback command: buffer/window reference not found"), TCL_STATIC); return TCL_ERROR; } @@ -1709,7 +1709,7 @@ tclinit(exarg_T *eap) #ifdef DYNAMIC_TCL if (!tcl_enabled(TRUE)) { - EMSG(_("E571: Sorry, this command is disabled: the Tcl library could not be loaded.")); + emsg(_("E571: Sorry, this command is disabled: the Tcl library could not be loaded.")); return FAIL; } #endif @@ -1817,11 +1817,11 @@ tclerrmsg(char *text) while ((next=strchr(text, '\n'))) { *next++ = '\0'; - EMSG(text); + emsg(text); text = next; } if (*text) - EMSG(text); + emsg(text); } static void diff --git a/src/if_xcmdsrv.c b/src/if_xcmdsrv.c --- a/src/if_xcmdsrv.c +++ b/src/if_xcmdsrv.c @@ -427,7 +427,7 @@ serverSendToVim( if (w == None) { if (!silent) - EMSG2(_(e_noserver), name); + semsg(_(e_noserver), name); return -1; } else if (loosename != NULL) @@ -467,7 +467,7 @@ serverSendToVim( vim_free(property); if (res < 0) { - EMSG(_("E248: Failed to send command to the destination program")); + emsg(_("E248: Failed to send command to the destination program")); return -1; } @@ -732,7 +732,7 @@ serverStrToWin(char_u *str) sscanf((char *)str, "0x%x", &id); if (id == None) - EMSG2(_("E573: Invalid server id used: %s"), str); + semsg(_("E573: Invalid server id used: %s"), str); return (Window)id; } @@ -1110,7 +1110,7 @@ GetRegProp( XFree(*regPropp); XDeleteProperty(dpy, RootWindow(dpy, 0), registryProperty); if (domsg) - EMSG(_("E251: VIM instance registry property is badly formed. Deleted!")); + emsg(_("E251: VIM instance registry property is badly formed. Deleted!")); return FAIL; } return OK; diff --git a/src/json.c b/src/json.c --- a/src/json.c +++ b/src/json.c @@ -232,7 +232,7 @@ json_encode_item(garray_T *gap, typval_T case VAR_JOB: case VAR_CHANNEL: /* no JSON equivalent TODO: better error */ - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return FAIL; case VAR_BLOB: @@ -739,7 +739,7 @@ json_decode_item(js_read_T *reader, typv retval = json_decode_string(reader, cur_item, *p); else { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); retval = FAIL; } break; @@ -747,7 +747,7 @@ json_decode_item(js_read_T *reader, typv case ',': /* comma: empty item */ if ((options & JSON_JS) == 0) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); retval = FAIL; break; } @@ -777,7 +777,7 @@ json_decode_item(js_read_T *reader, typv } if (!VIM_ISDIGIT(*sp)) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); retval = FAIL; break; } @@ -915,7 +915,7 @@ json_decode_item(js_read_T *reader, typv if (top_item->jd_key == NULL) { clear_tv(cur_item); - EMSG(_(e_invarg)); + emsg(_(e_invarg)); retval = FAIL; goto theend; } @@ -953,7 +953,7 @@ item_end: retval = MAYBE; else { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); retval = FAIL; } goto theend; @@ -971,7 +971,7 @@ item_end: retval = MAYBE; else { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); retval = FAIL; } goto theend; @@ -988,7 +988,7 @@ item_end: && dict_find(top_item->jd_tv.vval.v_dict, top_item->jd_key, -1) != NULL) { - EMSG2(_("E938: Duplicate key in JSON: \"%s\""), + semsg(_("E938: Duplicate key in JSON: \"%s\""), top_item->jd_key); clear_tv(&top_item->jd_key_tv); clear_tv(cur_item); @@ -1027,7 +1027,7 @@ item_end: retval = MAYBE; else { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); retval = FAIL; } goto theend; @@ -1046,7 +1046,7 @@ item_end: res->v_type = VAR_SPECIAL; res->vval.v_number = VVAL_NONE; } - EMSG(_(e_invarg)); + emsg(_(e_invarg)); theend: ga_clear(&stack); @@ -1070,13 +1070,13 @@ json_decode_all(js_read_T *reader, typva if (ret != OK) { if (ret == MAYBE) - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return FAIL; } json_skip_white(reader); if (reader->js_buf[reader->js_used] != NUL) { - EMSG(_(e_trailing)); + emsg(_(e_trailing)); return FAIL; } return OK; diff --git a/src/list.c b/src/list.c --- a/src/list.c +++ b/src/list.c @@ -417,7 +417,7 @@ list_find_str(list_T *l, long idx) li = list_find(l, idx - 1); if (li == NULL) { - EMSGN(_(e_listidx), idx); + semsg(_(e_listidx), idx); return NULL; } return tv_get_string(&li->li_tv); @@ -914,7 +914,7 @@ get_list_tv(char_u **arg, typval_T *rett break; if (**arg != ',') { - EMSG2(_("E696: Missing comma in List: %s"), *arg); + semsg(_("E696: Missing comma in List: %s"), *arg); goto failret; } *arg = skipwhite(*arg + 1); @@ -922,7 +922,7 @@ get_list_tv(char_u **arg, typval_T *rett if (**arg != ']') { - EMSG2(_("E697: Missing end of List ']': %s"), *arg); + semsg(_("E697: Missing end of List ']': %s"), *arg); failret: if (evaluate) list_free(l); @@ -969,7 +969,7 @@ write_list(FILE *fd, list_T *list, int b } if (ret == FAIL) { - EMSG(_(e_write)); + emsg(_(e_write)); break; } } diff --git a/src/main.c b/src/main.c --- a/src/main.c +++ b/src/main.c @@ -945,7 +945,7 @@ common_init(mparm_T *paramp) /* * Allocate space for the generic buffers (needed for set_init_1() and - * EMSG2()). + * emsg()). */ if ((IObuff = alloc(IOSIZE)) == NULL || (NameBuff = alloc(MAXPATHL)) == NULL) @@ -3020,7 +3020,7 @@ source_startup_scripts(mparm_T *parmp) else { if (do_source(parmp->use_vimrc, FALSE, DOSO_NONE) != OK) - EMSG2(_("E282: Cannot read from \"%s\""), parmp->use_vimrc); + semsg(_("E282: Cannot read from \"%s\""), parmp->use_vimrc); } } else if (!silent_mode) diff --git a/src/mark.c b/src/mark.c --- a/src/mark.c +++ b/src/mark.c @@ -606,7 +606,7 @@ check_mark(pos_T *pos) { if (pos == NULL) { - EMSG(_(e_umark)); + emsg(_(e_umark)); return FAIL; } if (pos->lnum <= 0) @@ -614,12 +614,12 @@ check_mark(pos_T *pos) /* lnum is negative if mark is in another file can can't get that * file, error message already give then. */ if (pos->lnum == 0) - EMSG(_(e_marknotset)); + emsg(_(e_marknotset)); return FAIL; } if (pos->lnum > curbuf->b_ml.ml_line_count) { - EMSG(_(e_markinval)); + emsg(_(e_markinval)); return FAIL; } return OK; @@ -763,7 +763,7 @@ show_one_mark( if (arg == NULL) MSG(_("No marks set")); else - EMSG2(_("E283: No marks matching \"%s\""), arg); + semsg(_("E283: No marks matching \"%s\""), arg); } } /* don't output anything if 'q' typed at --more-- prompt */ @@ -815,9 +815,9 @@ ex_delmarks(exarg_T *eap) /* clear all marks */ clrallmarks(curbuf); else if (eap->forceit) - EMSG(_(e_invarg)); + emsg(_(e_invarg)); else if (*eap->arg == NUL) - EMSG(_(e_argreq)); + emsg(_(e_argreq)); else { /* clear specified marks only */ @@ -837,7 +837,7 @@ ex_delmarks(exarg_T *eap) : ASCII_ISUPPER(p[2]))) || to < from) { - EMSG2(_(e_invarg2), p); + semsg(_(e_invarg2), p); return; } p += 2; @@ -875,7 +875,7 @@ ex_delmarks(exarg_T *eap) case '<': curbuf->b_visual.vi_start.lnum = 0; break; case '>': curbuf->b_visual.vi_end.lnum = 0; break; case ' ': break; - default: EMSG2(_(e_invarg2), p); + default: semsg(_(e_invarg2), p); return; } } diff --git a/src/mbyte.c b/src/mbyte.c --- a/src/mbyte.c +++ b/src/mbyte.c @@ -199,7 +199,7 @@ xim_log(char *s, ...) fd = mch_fopen("xim.log", "w"); if (fd == NULL) { - EMSG("Cannot open xim.log"); + emsg("Cannot open xim.log"); fd = (FILE *)-1; return; } @@ -509,7 +509,7 @@ enc_canon_props(char_u *name) * When there is something wrong: Returns an error message and doesn't change * anything. */ - char_u * + char * mb_init(void) { int i; @@ -4749,7 +4749,7 @@ iconv_enabled(int verbose) if (verbose && p_verbose > 0) { verbose_enter(); - EMSG2(_(e_loadlib), + semsg(_(e_loadlib), hIconvDLL == 0 ? DYNAMIC_ICONV_DLL : DYNAMIC_MSVCRT_DLL); verbose_leave(); } @@ -4771,7 +4771,7 @@ iconv_enabled(int verbose) if (verbose && p_verbose > 0) { verbose_enter(); - EMSG2(_(e_loadfunc), "for libiconv"); + semsg(_(e_loadfunc), "for libiconv"); verbose_leave(); } return FALSE; @@ -6028,7 +6028,7 @@ xim_set_preedit(void) XNLineSpace, line_space, NULL); if (XSetICValues(xic, XNPreeditAttributes, attr_list, NULL)) - EMSG(_("E284: Cannot set IC values")); + emsg(_("E284: Cannot set IC values")); XFree(attr_list); } } @@ -6187,7 +6187,7 @@ xim_real_init(Window x11_window, Display if (p_verbose > 0) { verbose_enter(); - EMSG(_("E286: Failed to open input method")); + emsg(_("E286: Failed to open input method")); verbose_leave(); } return FALSE; @@ -6200,13 +6200,13 @@ xim_real_init(Window x11_window, Display destroy_cb.callback = xim_destroy_cb; destroy_cb.client_data = NULL; if (XSetIMValues(xim, XNDestroyCallback, &destroy_cb, NULL)) - EMSG(_("E287: Warning: Could not set destroy callback to IM")); + emsg(_("E287: Warning: Could not set destroy callback to IM")); } # endif if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL) || !xim_styles) { - EMSG(_("E288: input method doesn't support any style")); + emsg(_("E288: input method doesn't support any style")); XCloseIM(xim); return FALSE; } @@ -6265,7 +6265,7 @@ xim_real_init(Window x11_window, Display if (p_verbose > 0) { verbose_enter(); - EMSG(_("E289: input method doesn't support my preedit type")); + emsg(_("E289: input method doesn't support my preedit type")); verbose_leave(); } XCloseIM(xim); @@ -6329,7 +6329,7 @@ xim_real_init(Window x11_window, Display else { if (!is_not_a_term()) - EMSG(_(e_xim)); + emsg(_(e_xim)); XCloseIM(xim); return FALSE; } diff --git a/src/memfile.c b/src/memfile.c --- a/src/memfile.c +++ b/src/memfile.c @@ -245,7 +245,7 @@ mf_close(memfile_T *mfp, int del_file) if (mfp->mf_fd >= 0) { if (close(mfp->mf_fd) < 0) - EMSG(_(e_swapclose)); + emsg(_(e_swapclose)); } if (del_file && mfp->mf_fname != NULL) mch_remove(mfp->mf_fname); @@ -291,7 +291,7 @@ mf_close_file( } if (close(mfp->mf_fd) < 0) /* close the file */ - EMSG(_(e_swapclose)); + emsg(_(e_swapclose)); mfp->mf_fd = -1; if (mfp->mf_fname != NULL) @@ -480,7 +480,7 @@ mf_put( flags = hp->bh_flags; if ((flags & BH_LOCKED) == 0) - IEMSG(_("E293: block was not locked")); + iemsg(_("E293: block was not locked")); flags &= ~BH_LOCKED; if (dirty) { @@ -1040,7 +1040,7 @@ mf_write(memfile_T *mfp, bhdr_T *hp) * space becomes available. */ if (!did_swapwrite_msg) - EMSG(_("E297: Write error in swap file")); + emsg(_("E297: Write error in swap file")); did_swapwrite_msg = TRUE; return FAIL; } @@ -1256,7 +1256,7 @@ mf_do_open( if ((flags & O_CREAT) && mch_lstat((char *)mfp->mf_fname, &sb) >= 0) { mfp->mf_fd = -1; - EMSG(_("E300: Swap file already exists (symlink attack?)")); + emsg(_("E300: Swap file already exists (symlink attack?)")); } else #endif diff --git a/src/memline.c b/src/memline.c --- a/src/memline.c +++ b/src/memline.c @@ -8,7 +8,7 @@ */ /* for debugging */ -/* #define CHECK(c, s) do { if (c) EMSG(s); } while (0) */ +/* #define CHECK(c, s) do { if (c) emsg((s)); } while (0) */ #define CHECK(c, s) do { /**/ } while (0) /* @@ -328,7 +328,7 @@ ml_open(buf_T *buf) goto error; if (hp->bh_bnum != 0) { - IEMSG(_("E298: Didn't get block nr 0?")); + iemsg(_("E298: Didn't get block nr 0?")); goto error; } b0p = (ZERO_BL *)(hp->bh_data); @@ -378,7 +378,7 @@ ml_open(buf_T *buf) goto error; if (hp->bh_bnum != 1) { - IEMSG(_("E298: Didn't get block nr 1?")); + iemsg(_("E298: Didn't get block nr 1?")); goto error; } pp = (PTR_BL *)(hp->bh_data); @@ -396,7 +396,7 @@ ml_open(buf_T *buf) goto error; if (hp->bh_bnum != 2) { - IEMSG(_("E298: Didn't get block nr 2?")); + iemsg(_("E298: Didn't get block nr 2?")); goto error; } @@ -610,7 +610,7 @@ ml_set_crypt_key( mf_put(mfp, hp, FALSE, FALSE); /* release previous block */ if (error > 0) - EMSG(_("E843: Error while updating swap file crypt")); + emsg(_("E843: Error while updating swap file crypt")); } mfp->mf_old_key = NULL; @@ -708,7 +708,7 @@ ml_setname(buf_T *buf) if (mfp->mf_fd < 0) { /* could not (re)open the swap file, what can we do???? */ - EMSG(_("E301: Oops, lost the swap file!!!")); + emsg(_("E301: Oops, lost the swap file!!!")); return; } #ifdef HAVE_FD_CLOEXEC @@ -720,7 +720,7 @@ ml_setname(buf_T *buf) #endif } if (!success) - EMSG(_("E302: Could not rename swap file")); + emsg(_("E302: Could not rename swap file")); } /* @@ -811,7 +811,7 @@ ml_open_file(buf_T *buf) { need_wait_return = TRUE; /* call wait_return later */ ++no_wait_return; - (void)EMSG2(_("E303: Unable to open swap file for \"%s\", recovery impossible"), + (void)semsg(_("E303: Unable to open swap file for \"%s\", recovery impossible"), buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname); --no_wait_return; } @@ -946,7 +946,7 @@ ml_upd_block0(buf_T *buf, upd_block0_T w b0p = (ZERO_BL *)(hp->bh_data); if (ml_check_b0_id(b0p) == FAIL) - IEMSG(_("E304: ml_upd_block0(): Didn't get block 0??")); + iemsg(_("E304: ml_upd_block0(): Didn't get block 0??")); else { if (what == UB_FNAME) @@ -1164,7 +1164,7 @@ ml_recover(void) len = recover_names(fname, FALSE, 0, NULL); if (len == 0) /* no swap files found */ { - EMSG2(_("E305: No swap file found for %s"), fname); + semsg(_("E305: No swap file found for %s"), fname); goto theend; } if (len == 1) /* one swap file found, use it */ @@ -1221,7 +1221,7 @@ ml_recover(void) if (mfp == NULL || mfp->mf_fd < 0) { if (fname_used != NULL) - EMSG2(_("E306: Cannot open %s"), fname_used); + semsg(_("E306: Cannot open %s"), fname_used); goto theend; } buf->b_ml.ml_mfp = mfp; @@ -1263,7 +1263,7 @@ ml_recover(void) } if (ml_check_b0_id(b0p) == FAIL) { - EMSG2(_("E307: %s does not look like a Vim swap file"), mfp->mf_fname); + semsg(_("E307: %s does not look like a Vim swap file"), mfp->mf_fname); goto theend; } if (b0_magic_wrong(b0p)) @@ -1297,7 +1297,7 @@ ml_recover(void) #else if (b0p->b0_id[1] != BLOCK0_ID1) { - EMSG2(_("E833: %s is encrypted and this version of Vim does not support encryption"), mfp->mf_fname); + semsg(_("E833: %s is encrypted and this version of Vim does not support encryption"), mfp->mf_fname); goto theend; } #endif @@ -1347,13 +1347,13 @@ ml_recover(void) } home_replace(NULL, mfp->mf_fname, NameBuff, MAXPATHL, TRUE); - smsg((char_u *)_("Using swap file \"%s\""), NameBuff); + smsg(_("Using swap file \"%s\""), NameBuff); if (buf_spname(curbuf) != NULL) vim_strncpy(NameBuff, buf_spname(curbuf), MAXPATHL - 1); else home_replace(NULL, curbuf->b_ffname, NameBuff, MAXPATHL, TRUE); - smsg((char_u *)_("Original file \"%s\""), NameBuff); + smsg(_("Original file \"%s\""), NameBuff); msg_putchar('\n'); /* @@ -1366,7 +1366,7 @@ ml_recover(void) && org_stat.st_mtime > swp_stat.st_mtime) || org_stat.st_mtime != mtime)) { - EMSG(_("E308: Warning: Original file may have been changed")); + emsg(_("E308: Warning: Original file may have been changed")); } out_flush(); @@ -1412,14 +1412,14 @@ ml_recover(void) * without a key, will probably get garbage text. */ if (*curbuf->b_p_key != NUL) { - smsg((char_u *)_("Swap file is encrypted: \"%s\""), fname_used); + smsg(_("Swap file is encrypted: \"%s\""), fname_used); MSG_PUTS(_("\nIf you entered a new crypt key but did not write the text file,")); MSG_PUTS(_("\nenter the new crypt key.")); MSG_PUTS(_("\nIf you wrote the text file after changing the crypt key press enter")); MSG_PUTS(_("\nto use the same key for text file and swap file")); } else - smsg((char_u *)_(need_key_msg), fname_used); + smsg(_(need_key_msg), fname_used); buf->b_p_key = crypt_get_key(FALSE, FALSE); if (buf->b_p_key == NULL) buf->b_p_key = curbuf->b_p_key; @@ -1471,7 +1471,7 @@ ml_recover(void) { if (bnum == 1) { - EMSG2(_("E309: Unable to read block 1 from %s"), mfp->mf_fname); + semsg(_("E309: Unable to read block 1 from %s"), mfp->mf_fname); goto theend; } ++error; @@ -1557,7 +1557,7 @@ ml_recover(void) { if (bnum == 1) { - EMSG2(_("E310: Block 1 ID wrong (%s not a .swp file?)"), + semsg(_("E310: Block 1 ID wrong (%s not a .swp file?)"), mfp->mf_fname); goto theend; } @@ -1677,12 +1677,12 @@ ml_recover(void) recoverymode = FALSE; if (got_int) - EMSG(_("E311: Recovery Interrupted")); + emsg(_("E311: Recovery Interrupted")); else if (error) { ++no_wait_return; MSG(">>>>>>>>>>>>>"); - EMSG(_("E312: Errors detected while recovering; look for lines starting with ???")); + emsg(_("E312: Errors detected while recovering; look for lines starting with ???")); --no_wait_return; MSG(_("See \":help E312\" for more information.")); MSG(">>>>>>>>>>>>>"); @@ -2361,7 +2361,7 @@ ml_preserve(buf_T *buf, int message) if (mfp == NULL || mfp->mf_fname == NULL) { if (message) - EMSG(_("E313: Cannot preserve, there is no swap file")); + emsg(_("E313: Cannot preserve, there is no swap file")); return; } @@ -2416,7 +2416,7 @@ theend: if (status == OK) MSG(_("File preserved")); else - EMSG(_("E314: Preserve failed")); + emsg(_("E314: Preserve failed")); } } @@ -2490,7 +2490,7 @@ ml_get_buf( /* Avoid giving this message for a recursive call, may happen when * the GUI redraws part of the text. */ ++recursive; - IEMSGN(_("E315: ml_get: invalid lnum: %ld"), lnum); + siemsg(_("E315: ml_get: invalid lnum: %ld"), lnum); --recursive; } errorret: @@ -2529,7 +2529,7 @@ errorret: /* Avoid giving this message for a recursive call, may happen * when the GUI redraws part of the text. */ ++recursive; - IEMSGN(_("E316: ml_get: cannot find line %ld"), lnum); + siemsg(_("E316: ml_get: cannot find line %ld"), lnum); --recursive; } goto errorret; @@ -3026,7 +3026,7 @@ ml_append_int( pp = (PTR_BL *)(hp->bh_data); /* must be pointer block */ if (pp->pb_id != PTR_ID) { - IEMSG(_("E317: pointer block id wrong 3")); + iemsg(_("E317: pointer block id wrong 3")); mf_put(mfp, hp, FALSE, FALSE); goto theend; } @@ -3168,7 +3168,7 @@ ml_append_int( */ if (stack_idx < 0) { - IEMSG(_("E318: Updated too many blocks?")); + iemsg(_("E318: Updated too many blocks?")); buf->b_ml.ml_stack_top = 0; /* invalidate stack */ } } @@ -3544,7 +3544,7 @@ ml_delete_int(buf_T *buf, linenr_T lnum, pp = (PTR_BL *)(hp->bh_data); /* must be pointer block */ if (pp->pb_id != PTR_ID) { - IEMSG(_("E317: pointer block id wrong 4")); + iemsg(_("E317: pointer block id wrong 4")); mf_put(mfp, hp, FALSE, FALSE); goto theend; } @@ -3770,7 +3770,7 @@ ml_flush_line(buf_T *buf) hp = ml_find_line(buf, lnum, ML_FIND); if (hp == NULL) - IEMSGN(_("E320: Cannot find line %ld"), lnum); + siemsg(_("E320: Cannot find line %ld"), lnum); else { dp = (DATA_BL *)(hp->bh_data); @@ -4012,7 +4012,7 @@ ml_find_line(buf_T *buf, linenr_T lnum, pp = (PTR_BL *)(dp); /* must be pointer block */ if (pp->pb_id != PTR_ID) { - IEMSG(_("E317: pointer block id wrong")); + iemsg(_("E317: pointer block id wrong")); goto error_block; } @@ -4057,11 +4057,11 @@ ml_find_line(buf_T *buf, linenr_T lnum, if (idx >= (int)pp->pb_count) /* past the end: something wrong! */ { if (lnum > buf->b_ml.ml_line_count) - IEMSGN(_("E322: line number out of range: %ld past the end"), + siemsg(_("E322: line number out of range: %ld past the end"), lnum - buf->b_ml.ml_line_count); else - IEMSGN(_("E323: line count wrong in block %ld"), bnum); + siemsg(_("E323: line count wrong in block %ld"), bnum); goto error_block; } if (action == ML_DELETE) @@ -4155,7 +4155,7 @@ ml_lineadd(buf_T *buf, int count) if (pp->pb_id != PTR_ID) { mf_put(mfp, hp, FALSE, FALSE); - IEMSG(_("E317: pointer block id wrong 2")); + iemsg(_("E317: pointer block id wrong 2")); break; } pp->pb_pointer[ip->ip_index].pe_line_count += count; @@ -4190,7 +4190,7 @@ resolve_symlink(char_u *fname, char_u *b /* Limit symlink depth to 100, catch recursive loops. */ if (++depth == 100) { - EMSG2(_("E773: Symlink loop for \"%s\""), fname); + semsg(_("E773: Symlink loop for \"%s\""), fname); return FAIL; } @@ -4372,7 +4372,7 @@ attention_message( char *p; ++no_wait_return; - (void)EMSG(_("E325: ATTENTION")); + (void)emsg(_("E325: ATTENTION")); MSG_PUTS(_("\nFound a swap file by the name \"")); msg_home_replace(fname); MSG_PUTS("\"\n"); @@ -4915,7 +4915,7 @@ findswapname( { if (fname[n - 2] == 'a') /* ".saa": tried enough, give up */ { - EMSG(_("E326: Too many swap files found")); + emsg(_("E326: Too many swap files found")); VIM_CLEAR(fname); break; } diff --git a/src/menu.c b/src/menu.c --- a/src/menu.c +++ b/src/menu.c @@ -274,7 +274,7 @@ ex_menu( menu_path = arg; if (*menu_path == '.') { - EMSG2(_(e_invarg2), menu_path); + semsg(_(e_invarg2), menu_path); goto theend; } @@ -290,7 +290,7 @@ ex_menu( } else if (*map_to != NUL && (unmenu || enable != MAYBE)) { - EMSG(_(e_trailing)); + emsg(_(e_trailing)); goto theend; } #if defined(FEAT_GUI) && !(defined(FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON)) @@ -515,7 +515,7 @@ add_menu_path( if (*dname == NUL) { /* Only a mnemonic or accelerator is not valid. */ - EMSG(_("E792: Empty menu name")); + emsg(_("E792: Empty menu name")); goto erret; } @@ -533,7 +533,7 @@ add_menu_path( if (*next_name == NUL && menu->children != NULL) { if (!sys_menu) - EMSG(_("E330: Menu path must not lead to a sub-menu")); + emsg(_("E330: Menu path must not lead to a sub-menu")); goto erret; } if (*next_name != NUL && menu->children == NULL @@ -543,7 +543,7 @@ add_menu_path( ) { if (!sys_menu) - EMSG(_(e_notsubmenu)); + emsg(_(e_notsubmenu)); goto erret; } break; @@ -572,13 +572,13 @@ add_menu_path( { if (*next_name == NUL && parent == NULL) { - EMSG(_("E331: Must not add menu items directly to menu bar")); + emsg(_("E331: Must not add menu items directly to menu bar")); goto erret; } if (menu_is_separator(dname) && *next_name != NUL) { - EMSG(_("E332: Separator cannot be part of a menu path")); + emsg(_("E332: Separator cannot be part of a menu path")); goto erret; } @@ -867,7 +867,7 @@ menu_nable_recurse( { if (menu->children == NULL) { - EMSG(_(e_notsubmenu)); + emsg(_(e_notsubmenu)); return FAIL; } if (menu_nable_recurse(menu->children, p, modes, enable) @@ -892,7 +892,7 @@ menu_nable_recurse( } if (*name != NUL && *name != '*' && menu == NULL) { - EMSG2(_(e_nomenu), name); + semsg(_(e_nomenu), name); return FAIL; } @@ -933,7 +933,7 @@ remove_menu( if (*p != NUL && menu->children == NULL) { if (!silent) - EMSG(_(e_notsubmenu)); + emsg(_(e_notsubmenu)); return FAIL; } if ((menu->modes & modes) != 0x0) @@ -955,7 +955,7 @@ remove_menu( else if (*name != NUL) { if (!silent) - EMSG(_(e_menuothermode)); + emsg(_(e_menuothermode)); return FAIL; } @@ -985,7 +985,7 @@ remove_menu( if (menu == NULL) { if (!silent) - EMSG2(_(e_nomenu), name); + semsg(_(e_nomenu), name); return FAIL; } @@ -1123,13 +1123,13 @@ show_menus(char_u *path_name, int modes) /* Found menu */ if (*p != NUL && menu->children == NULL) { - EMSG(_(e_notsubmenu)); + emsg(_(e_notsubmenu)); vim_free(path_name); return FAIL; } else if ((menu->modes & modes) == 0x0) { - EMSG(_(e_menuothermode)); + emsg(_(e_menuothermode)); vim_free(path_name); return FAIL; } @@ -1139,7 +1139,7 @@ show_menus(char_u *path_name, int modes) } if (menu == NULL) { - EMSG2(_(e_nomenu), name); + semsg(_(e_nomenu), name); vim_free(path_name); return FAIL; } @@ -2400,7 +2400,7 @@ execute_menu(exarg_T *eap, vimmenu_T *me default: mode = (char_u *)"Normal"; } - EMSG2(_("E335: Menu not defined for %s mode"), mode); + semsg(_("E335: Menu not defined for %s mode"), mode); } } @@ -2430,7 +2430,7 @@ ex_emenu(exarg_T *eap) case 't': mode_idx = MENU_INDEX_TERMINAL; break; case 'i': mode_idx = MENU_INDEX_INSERT; break; case 'c': mode_idx = MENU_INDEX_CMDLINE; break; - default: EMSG2(_(e_invarg2), arg); + default: semsg(_(e_invarg2), arg); return; } arg = skipwhite(arg + 2); @@ -2453,13 +2453,13 @@ ex_emenu(exarg_T *eap) { if (*p == NUL && menu->children != NULL) { - EMSG(_("E333: Menu path must lead to a menu item")); + emsg(_("E333: Menu path must lead to a menu item")); gave_emsg = TRUE; menu = NULL; } else if (*p != NUL && menu->children == NULL) { - EMSG(_(e_notsubmenu)); + emsg(_(e_notsubmenu)); menu = NULL; } break; @@ -2475,7 +2475,7 @@ ex_emenu(exarg_T *eap) if (menu == NULL) { if (!gave_emsg) - EMSG2(_("E334: Menu not found: %s"), arg); + semsg(_("E334: Menu not found: %s"), arg); return; } @@ -2567,9 +2567,9 @@ gui_find_menu(char_u *path_name) { /* found a menu item instead of a sub-menu */ if (*p == NUL) - EMSG(_("E336: Menu path must lead to a sub-menu")); + emsg(_("E336: Menu path must lead to a sub-menu")); else - EMSG(_(e_notsubmenu)); + emsg(_(e_notsubmenu)); menu = NULL; goto theend; } @@ -2588,7 +2588,7 @@ gui_find_menu(char_u *path_name) } if (menu == NULL) - EMSG(_("E337: Menu not found - check menu names")); + emsg(_("E337: Menu not found - check menu names")); theend: vim_free(saved_name); return menu; @@ -2654,7 +2654,7 @@ ex_menutranslate(exarg_T *eap UNUSED) *arg = NUL; arg = menu_skip_part(to); if (arg == to) - EMSG(_(e_invarg)); + emsg(_(e_invarg)); else { if (ga_grow(&menutrans_ga, 1) == OK) diff --git a/src/message.c b/src/message.c --- a/src/message.c +++ b/src/message.c @@ -358,23 +358,23 @@ trunc_string( /* * Automatic prototype generation does not understand this function. - * Note: Caller of smgs() and smsg_attr() must check the resulting string is + * Note: Caller of smsg() and smsg_attr() must check the resulting string is * shorter than IOSIZE!!! */ #ifndef PROTO -int vim_snprintf(char *str, size_t str_m, char *fmt, ...); +int vim_snprintf(char *str, size_t str_m, const char *fmt, ...); int # ifdef __BORLANDC__ _RTLENTRYF # endif -smsg(char_u *s, ...) +smsg(const char *s, ...) { va_list arglist; va_start(arglist, s); - vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist); + vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist); va_end(arglist); return msg(IObuff); } @@ -383,12 +383,12 @@ smsg(char_u *s, ...) # ifdef __BORLANDC__ _RTLENTRYF # endif -smsg_attr(int attr, char_u *s, ...) +smsg_attr(int attr, const char *s, ...) { va_list arglist; va_start(arglist, s); - vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist); + vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist); va_end(arglist); return msg_attr(IObuff, attr); } @@ -397,12 +397,12 @@ smsg_attr(int attr, char_u *s, ...) # ifdef __BORLANDC__ _RTLENTRYF # endif -smsg_attr_keep(int attr, char_u *s, ...) +smsg_attr_keep(int attr, const char *s, ...) { va_list arglist; va_start(arglist, s); - vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist); + vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist); va_end(arglist); return msg_attr_keep(IObuff, attr, TRUE); } @@ -582,21 +582,22 @@ do_perror(char *msg) { perror(msg); ++emsg_silent; - emsg((char_u *)msg); + emsg(msg); --emsg_silent; } #endif /* - * emsg() - display an error message + * emsg_core() - display an error message * * Rings the bell, if appropriate, and calls message() to do the real work * When terminal not initialized (yet) mch_errmsg(..) is used. * - * return TRUE if wait_return not called + * Return TRUE if wait_return not called. + * Note: caller must check 'emsg_not_now()' before calling this. */ - int -emsg(char_u *s) + static int +emsg_core(char_u *s) { int attr; char_u *p; @@ -606,10 +607,6 @@ emsg(char_u *s) int severe; #endif - /* Skip this if not giving error messages at the moment. */ - if (emsg_not_now()) - return TRUE; - #ifdef FEAT_EVAL /* When testing some errors are turned into a normal message. */ if (ignore_error(s)) @@ -727,40 +724,36 @@ emsg(char_u *s) return r; } - /* - * Print an error message with one "%s" and one string argument. + * Print an error message. */ int -emsg2(char_u *s, char_u *a1) +emsg(char *s) { - return emsg3(s, a1, NULL); + /* Skip this if not giving error messages at the moment. */ + if (!emsg_not_now()) + return emsg_core((char_u *)s); + return TRUE; /* no error messages at the moment */ } /* - * Print an error message with one or two "%s" and one or two string arguments. - * This is not in message.c to avoid a warning for prototypes. + * Print an error message with format string and variable arguments. + * Note: caller must not pass 'IObuff' as 1st argument. */ int -emsg3(char_u *s, char_u *a1, char_u *a2) +semsg(const char *s, ...) { - if (emsg_not_now()) - return TRUE; /* no error messages at the moment */ - vim_snprintf((char *)IObuff, IOSIZE, (char *)s, a1, a2); - return emsg(IObuff); -} - -/* - * Print an error message with one "%ld" and one long int argument. - * This is not in message.c to avoid a warning for prototypes. - */ - int -emsgn(char_u *s, long n) -{ - if (emsg_not_now()) - return TRUE; /* no error messages at the moment */ - vim_snprintf((char *)IObuff, IOSIZE, (char *)s, n); - return emsg(IObuff); + /* Skip this if not giving error messages at the moment. */ + if (!emsg_not_now()) + { + va_list ap; + + va_start(ap, s); + vim_vsnprintf((char *)IObuff, IOSIZE, s, ap); + va_end(ap); + return emsg_core(IObuff); + } + return TRUE; /* no error messages at the moment */ } /* @@ -769,38 +762,33 @@ emsgn(char_u *s, long n) * detected when fuzzing vim. */ void -iemsg(char_u *s) +iemsg(char *s) { - emsg(s); -#ifdef ABORT_ON_INTERNAL_ERROR - abort(); -#endif -} - - -/* - * Same as emsg2(...) but abort on error when ABORT_ON_INTERNAL_ERROR is - * defined. It is used for internal errors only, so that they can be - * detected when fuzzing vim. - */ - void -iemsg2(char_u *s, char_u *a1) -{ - emsg2(s, a1); + if (!emsg_not_now()) + emsg_core((char_u *)s); #ifdef ABORT_ON_INTERNAL_ERROR abort(); #endif } /* - * Same as emsgn(...) but abort on error when ABORT_ON_INTERNAL_ERROR is + * Same as semsg(...) but abort on error when ABORT_ON_INTERNAL_ERROR is * defined. It is used for internal errors only, so that they can be * detected when fuzzing vim. + * Note: caller must not pass 'IObuff' as 1st argument. */ void -iemsgn(char_u *s, long n) +siemsg(const char *s, ...) { - emsgn(s, n); + if (!emsg_not_now()) + { + va_list ap; + + va_start(ap, s); + vim_vsnprintf((char *)IObuff, IOSIZE, s, ap); + va_end(ap); + emsg_core(IObuff); + } #ifdef ABORT_ON_INTERNAL_ERROR abort(); #endif @@ -812,7 +800,7 @@ iemsgn(char_u *s, long n) void internal_error(char *where) { - IEMSG2(_(e_intern2), where); + siemsg(_(e_intern2), where); } /* emsg3() and emsgn() are in misc2.c to avoid warnings for the prototypes. */ @@ -820,7 +808,7 @@ internal_error(char *where) void emsg_invreg(int name) { - EMSG2(_("E354: Invalid register name: '%s'"), transchar(name)); + semsg(_("E354: Invalid register name: '%s'"), transchar(name)); } /* @@ -969,7 +957,7 @@ ex_messages(exarg_T *eap) if (*eap->arg != NUL) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } @@ -3473,7 +3461,7 @@ verbose_open(void) verbose_fd = mch_fopen((char *)p_vfile, "a"); if (verbose_fd == NULL) { - EMSG2(_(e_notopen), p_vfile); + semsg(_(e_notopen), p_vfile); return FAIL; } } @@ -4092,7 +4080,7 @@ do_browse( # endif { /* TODO: non-GUI file selector here */ - EMSG(_("E338: Sorry, no file browser in console mode")); + emsg(_("E338: Sorry, no file browser in console mode")); fname = NULL; } @@ -4136,7 +4124,7 @@ tv_nr(typval_T *tvs, int *idxp) int err = FALSE; if (tvs[idx].v_type == VAR_UNKNOWN) - EMSG(_(e_printf)); + emsg(_(e_printf)); else { ++*idxp; @@ -4163,7 +4151,7 @@ tv_str(typval_T *tvs, int *idxp, char_u static char_u numbuf[NUMBUFLEN]; if (tvs[idx].v_type == VAR_UNKNOWN) - EMSG(_(e_printf)); + emsg(_(e_printf)); else { ++*idxp; @@ -4186,7 +4174,7 @@ tv_float(typval_T *tvs, int *idxp) double f = 0; if (tvs[idx].v_type == VAR_UNKNOWN) - EMSG(_(e_printf)); + emsg(_(e_printf)); else { ++*idxp; @@ -4195,7 +4183,7 @@ tv_float(typval_T *tvs, int *idxp) else if (tvs[idx].v_type == VAR_NUMBER) f = (double)tvs[idx].vval.v_number; else - EMSG(_("E807: Expected Float argument for printf()")); + emsg(_("E807: Expected Float argument for printf()")); } return f; } @@ -4274,7 +4262,7 @@ infinity_str(int positive, /* Like vim_vsnprintf() but append to the string. */ int -vim_snprintf_add(char *str, size_t str_m, char *fmt, ...) +vim_snprintf_add(char *str, size_t str_m, const char *fmt, ...) { va_list ap; int str_l; @@ -4292,7 +4280,7 @@ vim_snprintf_add(char *str, size_t str_m } int -vim_snprintf(char *str, size_t str_m, char *fmt, ...) +vim_snprintf(char *str, size_t str_m, const char *fmt, ...) { va_list ap; int str_l; @@ -4307,7 +4295,7 @@ vim_snprintf(char *str, size_t str_m, ch vim_vsnprintf( char *str, size_t str_m, - char *fmt, + const char *fmt, va_list ap) { return vim_vsnprintf_typval(str, str_m, fmt, ap, NULL); @@ -4317,12 +4305,12 @@ vim_vsnprintf( vim_vsnprintf_typval( char *str, size_t str_m, - char *fmt, + const char *fmt, va_list ap, typval_T *tvs) { size_t str_l = 0; - char *p = fmt; + const char *p = fmt; int arg_idx = 1; if (p == NULL) @@ -4370,7 +4358,7 @@ vim_vsnprintf_typval( char tmp[TMP_LEN]; /* string address in case of string argument */ - char *str_arg; + const char *str_arg = NULL; /* natural field width of arg without padding and sign */ size_t str_arg_l; @@ -4394,7 +4382,6 @@ vim_vsnprintf_typval( char_u *tofree = NULL; - str_arg = NULL; p++; /* skip '%' */ /* parse flags */ @@ -5239,7 +5226,7 @@ vim_vsnprintf_typval( } if (tvs != NULL && tvs[arg_idx - 1].v_type != VAR_UNKNOWN) - EMSG(_("E767: Too many arguments to printf()")); + emsg(_("E767: Too many arguments to printf()")); /* Return the number of characters formatted (excluding trailing nul * character), that is, the number of characters that would have been diff --git a/src/misc1.c b/src/misc1.c --- a/src/misc1.c +++ b/src/misc1.c @@ -2658,7 +2658,7 @@ del_bytes( /* If "count" is negative the caller must be doing something wrong. */ if (count < 1) { - IEMSGN("E950: Invalid count for del_bytes(): %ld", count); + siemsg("E950: Invalid count for del_bytes(): %ld", count); return FAIL; } @@ -3521,7 +3521,7 @@ ask_yesno(char_u *str, int direct) while (r != 'y' && r != 'n') { /* same highlighting as for wait_return */ - smsg_attr(HL_ATTR(HLF_R), (char_u *)"%s (y/n)?", str); + smsg_attr(HL_ATTR(HLF_R), "%s (y/n)?", str); if (direct) r = get_keystroke(); else @@ -4060,7 +4060,7 @@ init_homedir(void) if (!mch_chdir((char *)var) && mch_dirname(IObuff, IOSIZE) == OK) var = IObuff; if (mch_chdir((char *)NameBuff) != 0) - EMSG(_(e_prev_dir)); + emsg(_(e_prev_dir)); } #endif homedir = vim_strsave(var); @@ -9942,7 +9942,7 @@ expand_wildcards_eval( int ret = FAIL; char_u *eval_pat = NULL; char_u *exp_pat = *pat; - char_u *ignored_msg; + char *ignored_msg; int usedlen; if (*exp_pat == '%' || *exp_pat == '#' || *exp_pat == '<') @@ -11434,7 +11434,7 @@ get_cmd_output( /* get a name for the temp file */ if ((tempname = vim_tempname('o', FALSE)) == NULL) { - EMSG(_(e_notmp)); + emsg(_(e_notmp)); return NULL; } @@ -11465,7 +11465,7 @@ get_cmd_output( if (fd == NULL) { - EMSG2(_(e_notopen), tempname); + semsg(_(e_notopen), tempname); goto done; } @@ -11485,7 +11485,7 @@ get_cmd_output( #endif if (i != len) { - EMSG2(_(e_notread), tempname); + semsg(_(e_notread), tempname); VIM_CLEAR(buffer); } else if (ret_len == NULL) diff --git a/src/misc2.c b/src/misc2.c --- a/src/misc2.c +++ b/src/misc2.c @@ -920,7 +920,7 @@ alloc_check(unsigned size) { /* Don't hide this message */ emsg_silent = 0; - EMSG(_("E340: Line is becoming too long")); + emsg(_("E340: Line is becoming too long")); return NULL; } #endif @@ -960,7 +960,7 @@ lalloc(long_u size, int message) { /* Don't hide this message */ emsg_silent = 0; - IEMSGN(_("E341: Internal error: lalloc(%ld, )"), size); + siemsg(_("E341: Internal error: lalloc(%ld, )"), size); return NULL; } @@ -1079,7 +1079,7 @@ do_outofmem_msg(long_u size) * message fails, e.g. when setting v:errmsg. */ did_outofmem_msg = TRUE; - EMSGN(_("E342: Out of memory! (allocating %lu bytes)"), size); + semsg(_("E342: Out of memory! (allocating %lu bytes)"), size); } } @@ -3272,7 +3272,7 @@ call_shell(char_u *cmd, int opt) if (p_verbose > 3) { verbose_enter(); - smsg((char_u *)_("Calling shell to execute: \"%s\""), + smsg(_("Calling shell to execute: \"%s\""), cmd == NULL ? p_sh : cmd); out_char('\n'); cursor_on(); @@ -3286,7 +3286,7 @@ call_shell(char_u *cmd, int opt) if (*p_sh == NUL) { - EMSG(_(e_shellempty)); + emsg(_(e_shellempty)); retval = -1; } else @@ -3538,7 +3538,7 @@ static char * mshape_names[] = * ("what" is SHAPE_MOUSE). * Returns error message for an illegal option, NULL otherwise. */ - char_u * + char * parse_shape_opt(int what) { char_u *modep; @@ -3574,9 +3574,9 @@ parse_shape_opt(int what) commap = vim_strchr(modep, ','); if (colonp == NULL || (commap != NULL && commap < colonp)) - return (char_u *)N_("E545: Missing colon"); + return N_("E545: Missing colon"); if (colonp == modep) - return (char_u *)N_("E546: Illegal mode"); + return N_("E546: Illegal mode"); /* * Repeat for all mode's before the colon. @@ -3602,7 +3602,7 @@ parse_shape_opt(int what) break; if (idx == SHAPE_IDX_COUNT || (shape_table[idx].used_for & what) == 0) - return (char_u *)N_("E546: Illegal mode"); + return N_("E546: Illegal mode"); if (len == 2 && modep[0] == 'v' && modep[1] == 'e') found_ve = TRUE; } @@ -3641,7 +3641,7 @@ parse_shape_opt(int what) if (mshape_names[i] == NULL) { if (!VIM_ISDIGIT(*p)) - return (char_u *)N_("E547: Illegal mouseshape"); + return N_("E547: Illegal mouseshape"); if (round == 2) shape_table[idx].mshape = getdigits(&p) + MSHAPE_NUMBERED; @@ -3681,12 +3681,12 @@ parse_shape_opt(int what) { p += len; if (!VIM_ISDIGIT(*p)) - return (char_u *)N_("E548: digit expected"); + return N_("E548: digit expected"); n = getdigits(&p); if (len == 3) /* "ver" or "hor" */ { if (n == 0) - return (char_u *)N_("E549: Illegal percentage"); + return N_("E549: Illegal percentage"); if (round == 2) { if (TOLOWER_ASC(i) == 'v') @@ -4385,7 +4385,7 @@ vim_findfile_init( { if (len + 5 >= MAXPATHL) { - EMSG(_(e_pathtoolong)); + emsg(_(e_pathtoolong)); break; } if (STRNCMP(wc_part, "**", 2) == 0) @@ -4404,7 +4404,7 @@ vim_findfile_init( wc_part = (char_u *)errpt; if (*wc_part != NUL && !vim_ispathsep(*wc_part)) { - EMSG2(_("E343: Invalid path: '**[number]' must be at the end of the path or be followed by '%s'."), PATHSEPSTR); + semsg(_("E343: Invalid path: '**[number]' must be at the end of the path or be followed by '%s'."), PATHSEPSTR); goto error_return; } } @@ -4436,7 +4436,7 @@ vim_findfile_init( if (STRLEN(search_ctx->ffsc_start_dir) + STRLEN(search_ctx->ffsc_fix_path) + 3 >= MAXPATHL) { - EMSG(_(e_pathtoolong)); + emsg(_(e_pathtoolong)); goto error_return; } STRCPY(ff_expand_buffer, search_ctx->ffsc_start_dir); @@ -4667,7 +4667,7 @@ vim_findfile(void *search_ctx_arg) if (p_verbose >= 5) { verbose_enter_scroll(); - smsg((char_u *)"Already Searched: %s (%s)", + smsg("Already Searched: %s (%s)", stackp->ffs_fix_path, stackp->ffs_wc_path); /* don't overwrite this either */ msg_puts((char_u *)"\n"); @@ -4681,7 +4681,7 @@ vim_findfile(void *search_ctx_arg) else if (p_verbose >= 5) { verbose_enter_scroll(); - smsg((char_u *)"Searching: %s (%s)", + smsg("Searching: %s (%s)", stackp->ffs_fix_path, stackp->ffs_wc_path); /* don't overwrite this either */ msg_puts((char_u *)"\n"); @@ -4900,7 +4900,7 @@ vim_findfile(void *search_ctx_arg) if (p_verbose >= 5) { verbose_enter_scroll(); - smsg((char_u *)"Already: %s", + smsg("Already: %s", file_path); /* don't overwrite this either */ msg_puts((char_u *)"\n"); @@ -4928,7 +4928,7 @@ vim_findfile(void *search_ctx_arg) if (p_verbose >= 5) { verbose_enter_scroll(); - smsg((char_u *)"HIT: %s", file_path); + smsg("HIT: %s", file_path); /* don't overwrite this either */ msg_puts((char_u *)"\n"); verbose_leave_scroll(); @@ -5128,7 +5128,7 @@ ff_get_visited_list( if (p_verbose >= 5) { verbose_enter_scroll(); - smsg((char_u *)"ff_get_visited_list: FOUND list for %s", + smsg("ff_get_visited_list: FOUND list for %s", filename); /* don't overwrite this either */ msg_puts((char_u *)"\n"); @@ -5145,7 +5145,7 @@ ff_get_visited_list( if (p_verbose >= 5) { verbose_enter_scroll(); - smsg((char_u *)"ff_get_visited_list: new list for %s", filename); + smsg("ff_get_visited_list: new list for %s", filename); /* don't overwrite this either */ msg_puts((char_u *)"\n"); verbose_leave_scroll(); @@ -5766,19 +5766,19 @@ find_file_in_path_option( if (first == TRUE) { if (find_what == FINDFILE_DIR) - EMSG2(_("E344: Can't find directory \"%s\" in cdpath"), + semsg(_("E344: Can't find directory \"%s\" in cdpath"), ff_file_to_find); else - EMSG2(_("E345: Can't find file \"%s\" in path"), + semsg(_("E345: Can't find file \"%s\" in path"), ff_file_to_find); } else { if (find_what == FINDFILE_DIR) - EMSG2(_("E346: No more directory \"%s\" found in cdpath"), + semsg(_("E346: No more directory \"%s\" found in cdpath"), ff_file_to_find); else - EMSG2(_("E347: No more file \"%s\" found in path"), + semsg(_("E347: No more file \"%s\" found in path"), ff_file_to_find); } } diff --git a/src/netbeans.c b/src/netbeans.c --- a/src/netbeans.c +++ b/src/netbeans.c @@ -257,7 +257,7 @@ getConnInfo(char *file, char **host, cha { nbdebug(("Wrong access mode for NetBeans connection info file: \"%s\"\n", file)); - EMSG2(_("E668: Wrong access mode for NetBeans connection info file: \"%s\""), + semsg(_("E668: Wrong access mode for NetBeans connection info file: \"%s\""), file); return FAIL; } @@ -477,7 +477,7 @@ nb_parse_cmd(char_u *cmd) if (*verb != ':') { nbdebug((" missing colon: %s\n", cmd)); - EMSG2("E627: missing colon: %s", cmd); + semsg("E627: missing colon: %s", cmd); return; } ++verb; /* skip colon */ @@ -501,7 +501,7 @@ nb_parse_cmd(char_u *cmd) if (isfunc < 0) { nbdebug((" missing ! or / in: %s\n", cmd)); - EMSG2("E628: missing ! or / in: %s", cmd); + semsg("E628: missing ! or / in: %s", cmd); return; } @@ -518,7 +518,7 @@ nb_parse_cmd(char_u *cmd) * so I'm disabling it except for debugging. */ nbdebug(("nb_parse_cmd: Command error for \"%s\"\n", cmd)); - EMSG("E629: bad return from nb_do_cmd"); + emsg("E629: bad return from nb_do_cmd"); #endif } } @@ -1032,7 +1032,7 @@ nb_do_cmd( if (buf == NULL || buf->bufp == NULL) { nbdebug((" Invalid buffer identifier in getAnno\n")); - EMSG("E652: Invalid buffer identifier in getAnno"); + emsg("E652: Invalid buffer identifier in getAnno"); retval = FAIL; } else @@ -1055,7 +1055,7 @@ nb_do_cmd( if (buf == NULL || buf->bufp == NULL) { nbdebug((" invalid buffer identifier in getLength\n")); - EMSG("E632: invalid buffer identifier in getLength"); + emsg("E632: invalid buffer identifier in getLength"); retval = FAIL; } else @@ -1077,7 +1077,7 @@ nb_do_cmd( if (buf == NULL || buf->bufp == NULL) { nbdebug((" invalid buffer identifier in getText\n")); - EMSG("E633: invalid buffer identifier in getText"); + emsg("E633: invalid buffer identifier in getText"); retval = FAIL; } else @@ -1141,7 +1141,7 @@ nb_do_cmd( if (buf == NULL || buf->bufp == NULL) { nbdebug((" invalid buffer identifier in remove\n")); - EMSG("E634: invalid buffer identifier in remove"); + emsg("E634: invalid buffer identifier in remove"); retval = FAIL; } else @@ -1311,7 +1311,7 @@ nb_do_cmd( if (buf == NULL || buf->bufp == NULL) { nbdebug((" invalid buffer identifier in insert\n")); - EMSG("E635: invalid buffer identifier in insert"); + emsg("E635: invalid buffer identifier in insert"); retval = FAIL; } else if (args != NULL) @@ -1471,7 +1471,7 @@ nb_do_cmd( if (buf == NULL) { nbdebug((" invalid buffer identifier in create\n")); - EMSG("E636: invalid buffer identifier in create"); + emsg("E636: invalid buffer identifier in create"); return FAIL; } VIM_CLEAR(buf->displayname); @@ -1521,7 +1521,7 @@ nb_do_cmd( if (buf == NULL) { nbdebug((" invalid buffer identifier in startDocumentListen\n")); - EMSG("E637: invalid buffer identifier in startDocumentListen"); + emsg("E637: invalid buffer identifier in startDocumentListen"); return FAIL; } buf->fireChanges = 1; @@ -1532,7 +1532,7 @@ nb_do_cmd( if (buf == NULL) { nbdebug((" invalid buffer identifier in stopDocumentListen\n")); - EMSG("E638: invalid buffer identifier in stopDocumentListen"); + emsg("E638: invalid buffer identifier in stopDocumentListen"); return FAIL; } buf->fireChanges = 0; @@ -1541,7 +1541,7 @@ nb_do_cmd( if (!buf->bufp->b_netbeans_file) { nbdebug(("E658: NetBeans connection lost for buffer %ld\n", buf->bufp->b_fnum)); - EMSGN(_("E658: NetBeans connection lost for buffer %ld"), + semsg(_("E658: NetBeans connection lost for buffer %ld"), buf->bufp->b_fnum); } else @@ -1561,7 +1561,7 @@ nb_do_cmd( if (buf == NULL) { nbdebug((" invalid buffer identifier in setTitle\n")); - EMSG("E639: invalid buffer identifier in setTitle"); + emsg("E639: invalid buffer identifier in setTitle"); return FAIL; } vim_free(buf->displayname); @@ -1573,7 +1573,7 @@ nb_do_cmd( if (buf == NULL || buf->bufp == NULL) { nbdebug((" invalid buffer identifier in initDone\n")); - EMSG("E640: invalid buffer identifier in initDone"); + emsg("E640: invalid buffer identifier in initDone"); return FAIL; } do_update = 1; @@ -1594,7 +1594,7 @@ nb_do_cmd( if (buf == NULL) { nbdebug((" invalid buffer identifier in setBufferNumber\n")); - EMSG("E641: invalid buffer identifier in setBufferNumber"); + emsg("E641: invalid buffer identifier in setBufferNumber"); return FAIL; } path = (char_u *)nb_unquote(args, NULL); @@ -1605,7 +1605,7 @@ nb_do_cmd( if (bufp == NULL) { nbdebug((" File %s not found in setBufferNumber\n", args)); - EMSG2("E642: File %s not found in setBufferNumber", args); + semsg("E642: File %s not found in setBufferNumber", args); return FAIL; } buf->bufp = bufp; @@ -1630,7 +1630,7 @@ nb_do_cmd( if (buf == NULL) { nbdebug((" invalid buffer identifier in setFullName\n")); - EMSG("E643: invalid buffer identifier in setFullName"); + emsg("E643: invalid buffer identifier in setFullName"); return FAIL; } vim_free(buf->displayname); @@ -1653,7 +1653,7 @@ nb_do_cmd( if (buf == NULL) { nbdebug((" invalid buffer identifier in editFile\n")); - EMSG("E644: invalid buffer identifier in editFile"); + emsg("E644: invalid buffer identifier in editFile"); return FAIL; } /* Edit a file: like create + setFullName + read the file. */ @@ -1681,7 +1681,7 @@ nb_do_cmd( /* This message was commented out, probably because it can * happen when shutting down. */ if (p_verbose > 0) - EMSG("E645: invalid buffer identifier in setVisible"); + emsg("E645: invalid buffer identifier in setVisible"); return FAIL; } if (streq((char *)args, "T") && buf->bufp != curbuf) @@ -1721,7 +1721,7 @@ nb_do_cmd( /* This message was commented out, probably because it can * happen when shutting down. */ if (p_verbose > 0) - EMSG("E646: invalid buffer identifier in setModified"); + emsg("E646: invalid buffer identifier in setModified"); return FAIL; } prev_b_changed = buf->bufp->b_changed; @@ -1803,7 +1803,7 @@ nb_do_cmd( if (buf == NULL || buf->bufp == NULL) { nbdebug((" invalid buffer identifier in setDot\n")); - EMSG("E647: invalid buffer identifier in setDot"); + emsg("E647: invalid buffer identifier in setDot"); return FAIL; } @@ -1856,7 +1856,7 @@ nb_do_cmd( if (buf == NULL) { nbdebug((" invalid buffer identifier in close\n")); - EMSG("E648: invalid buffer identifier in close"); + emsg("E648: invalid buffer identifier in close"); return FAIL; } @@ -1870,7 +1870,7 @@ nb_do_cmd( /* This message was commented out, probably because it can * happen when shutting down. */ if (p_verbose > 0) - EMSG("E649: invalid buffer identifier in close"); + emsg("E649: invalid buffer identifier in close"); } nbdebug((" CLOSE %d: %s\n", bufno, name)); #ifdef FEAT_GUI @@ -1909,7 +1909,7 @@ nb_do_cmd( if (buf == NULL) { nbdebug((" invalid buffer identifier in defineAnnoType\n")); - EMSG("E650: invalid buffer identifier in defineAnnoType"); + emsg("E650: invalid buffer identifier in defineAnnoType"); return FAIL; } @@ -1937,7 +1937,7 @@ nb_do_cmd( bg = vim_strsave(p); if (STRLEN(fg) > MAX_COLOR_LENGTH || STRLEN(bg) > MAX_COLOR_LENGTH) { - EMSG("E532: highlighting color name too long in defineAnnoType"); + emsg("E532: highlighting color name too long in defineAnnoType"); vim_free(typeName); parse_error = TRUE; } @@ -1968,7 +1968,7 @@ nb_do_cmd( if (buf == NULL || buf->bufp == NULL) { nbdebug((" invalid buffer identifier in addAnno\n")); - EMSG("E651: invalid buffer identifier in addAnno"); + emsg("E651: invalid buffer identifier in addAnno"); return FAIL; } @@ -2352,7 +2352,7 @@ ex_nbstart( && !defined(FEAT_GUI_W32) if (gui.in_use) { - EMSG(_("E838: netbeans is not supported with this GUI")); + emsg(_("E838: netbeans is not supported with this GUI")); return; } # endif @@ -2517,7 +2517,7 @@ netbeans_open(char *params, int doabort) if (NETBEANS_OPEN) { - EMSG(_("E511: netbeans already connected")); + emsg(_("E511: netbeans already connected")); return; } @@ -3482,10 +3482,10 @@ print_save_msg(nbbuf_T *buf, off_T nchar } else { - char_u msgbuf[IOSIZE]; - - vim_snprintf((char *)msgbuf, IOSIZE, - _("E505: %s is read-only (add ! to override)"), IObuff); + char msgbuf[IOSIZE]; + + vim_snprintf(msgbuf, IOSIZE, + _("E505: %s is read-only (add ! to override)"), IObuff); nbdebug((" %s\n", msgbuf)); emsg(msgbuf); } diff --git a/src/normal.c b/src/normal.c --- a/src/normal.c +++ b/src/normal.c @@ -2211,7 +2211,7 @@ op_function(oparg_T *oap UNUSED) # endif if (*p_opfunc == NUL) - EMSG(_("E774: 'operatorfunc' is empty")); + emsg(_("E774: 'operatorfunc' is empty")); else { /* Set '[ and '] marks to text to be operated on. */ @@ -2243,7 +2243,7 @@ op_function(oparg_T *oap UNUSED) # endif } #else - EMSG(_("E775: Eval feature not available")); + emsg(_("E775: Eval feature not available")); #endif } @@ -3542,9 +3542,9 @@ find_ident_at_pos( * didn't find an identifier or string */ if (find_type & FIND_STRING) - EMSG(_("E348: No string under cursor")); + emsg(_("E348: No string under cursor")); else - EMSG(_(e_noident)); + emsg(_(e_noident)); return 0; } ptr += col; @@ -5016,7 +5016,7 @@ dozet: deleteFold((linenr_T)1, curbuf->b_ml.ml_line_count, TRUE, FALSE); else - EMSG(_("E352: Cannot erase folds with current 'foldmethod'")); + emsg(_("E352: Cannot erase folds with current 'foldmethod'")); break; /* "zn": fold none: reset 'foldenable' */ @@ -5616,7 +5616,7 @@ nv_ident(cmdarg_T *cap) || STRCMP(kp, ":help") == 0); if (kp_help && *skipwhite(ptr) == NUL) { - EMSG(_(e_noident)); /* found white space only */ + emsg(_(e_noident)); /* found white space only */ return; } kp_ex = (*kp == ':'); @@ -5667,7 +5667,7 @@ nv_ident(cmdarg_T *cap) } if (n == 0) { - EMSG(_(e_noident)); /* found dashes only */ + emsg(_(e_noident)); /* found dashes only */ vim_free(buf); return; } @@ -7275,7 +7275,7 @@ nv_Replace(cmdarg_T *cap) else if (!checkclearopq(cap->oap)) { if (!curbuf->b_p_ma) - EMSG(_(e_modifiable)); + emsg(_(e_modifiable)); else { #ifdef FEAT_VIRTUALEDIT @@ -7302,7 +7302,7 @@ nv_vreplace(cmdarg_T *cap) else if (!checkclearopq(cap->oap)) { if (!curbuf->b_p_ma) - EMSG(_(e_modifiable)); + emsg(_(e_modifiable)); else { if (cap->extra_char == Ctrl_V) /* get another character */ @@ -7629,11 +7629,11 @@ nv_pcmark(cmdarg_T *cap) else if (cap->cmdchar == 'g') { if (curbuf->b_changelistlen == 0) - EMSG(_("E664: changelist is empty")); + emsg(_("E664: changelist is empty")); else if (cap->count1 < 0) - EMSG(_("E662: At start of changelist")); + emsg(_("E662: At start of changelist")); else - EMSG(_("E663: At end of changelist")); + emsg(_("E663: At end of changelist")); } else clearopbeep(cap->oap); @@ -8514,14 +8514,14 @@ n_opencmd(cmdarg_T *cap) if (curwin->w_p_cole > 0 && oldline != curwin->w_cursor.lnum) redrawWinline(curwin, oldline); #endif - /* When '#' is in 'cpoptions' ignore the count. */ - if (vim_strchr(p_cpo, CPO_HASH) != NULL) - cap->count1 = 1; #ifdef FEAT_SYN_HL if (curwin->w_p_cul) /* force redraw of cursorline */ curwin->w_valid &= ~VALID_CROW; #endif + /* When '#' is in 'cpoptions' ignore the count. */ + if (vim_strchr(p_cpo, CPO_HASH) != NULL) + cap->count1 = 1; invoke_edit(cap, FALSE, cap->cmdchar, TRUE); } } @@ -9107,7 +9107,7 @@ nv_edit(cmdarg_T *cap) else if (!curbuf->b_p_ma && !p_im) { /* Only give this error when 'insertmode' is off. */ - EMSG(_(e_modifiable)); + emsg(_(e_modifiable)); clearop(cap->oap); if (cap->cmdchar == K_PS) /* drop the pasted text */ diff --git a/src/ops.c b/src/ops.c --- a/src/ops.c +++ b/src/ops.c @@ -712,7 +712,7 @@ op_reindent(oparg_T *oap, int (*how)(voi /* Don't even try when 'modifiable' is off. */ if (!curbuf->b_p_ma) { - EMSG(_(e_modifiable)); + emsg(_(e_modifiable)); return; } @@ -724,7 +724,7 @@ op_reindent(oparg_T *oap, int (*how)(voi if (i > 1 && (i % 50 == 0 || i == oap->line_count - 1) && oap->line_count > p_report) - smsg((char_u *)_("%ld lines to indent... "), i); + smsg(_("%ld lines to indent... "), i); /* * Be vi-compatible: For lisp indenting the first line is not @@ -770,7 +770,7 @@ op_reindent(oparg_T *oap, int (*how)(voi if (oap->line_count > p_report) { i = oap->line_count - (i + 1); - smsg((char_u *)NGETTEXT("%ld line indented ", + smsg(NGETTEXT("%ld line indented ", "%ld lines indented ", i), i); } /* set '[ and '] marks */ @@ -1218,7 +1218,7 @@ do_execreg( { if (execreg_lastc == NUL) { - EMSG(_("E748: No previously used register")); + emsg(_("E748: No previously used register")); return FAIL; } regname = execreg_lastc; @@ -1243,7 +1243,7 @@ do_execreg( { if (last_cmdline == NULL) { - EMSG(_(e_nolastcmd)); + emsg(_(e_nolastcmd)); return FAIL; } VIM_CLEAR(new_last_cmdline); /* don't keep the cmdline containing @: */ @@ -1277,7 +1277,7 @@ do_execreg( p = get_last_insert_save(); if (p == NULL) { - EMSG(_(e_noinstext)); + emsg(_(e_noinstext)); return FAIL; } retval = put_in_typebuf(p, FALSE, colon, silent); @@ -1535,13 +1535,13 @@ get_spec_reg( case ':': /* last command line */ if (last_cmdline == NULL && errmsg) - EMSG(_(e_nolastcmd)); + emsg(_(e_nolastcmd)); *argp = last_cmdline; return TRUE; case '/': /* last search-pattern */ if (last_search_pat() == NULL && errmsg) - EMSG(_(e_noprevre)); + emsg(_(e_noprevre)); *argp = last_search_pat(); return TRUE; @@ -1549,7 +1549,7 @@ get_spec_reg( *argp = get_last_insert_save(); *allocated = TRUE; if (*argp == NULL && errmsg) - EMSG(_(e_noinstext)); + emsg(_(e_noinstext)); return TRUE; #ifdef FEAT_SEARCHPATH @@ -1761,7 +1761,7 @@ op_delete(oparg_T *oap) if (!curbuf->b_p_ma) { - EMSG(_(e_modifiable)); + emsg(_(e_modifiable)); return FAIL; } @@ -1884,7 +1884,7 @@ op_delete(oparg_T *oap) msg_silent = msg_silent_save; if (n != 'y') { - EMSG(_(e_abort)); + emsg(_(e_abort)); return FAIL; } } @@ -2506,7 +2506,7 @@ op_tilde(oparg_T *oap) curbuf->b_op_end = oap->end; if (oap->line_count > p_report) - smsg((char_u *)NGETTEXT("%ld line changed", "%ld lines changed", + smsg(NGETTEXT("%ld line changed", "%ld lines changed", oap->line_count), oap->line_count); } @@ -3038,7 +3038,7 @@ free_yank(long n) * Overwrite this message with any next message. */ ++no_wait_return; - smsg((char_u *)_("freeing %ld lines"), i + 1); + smsg(_("freeing %ld lines"), i + 1); --no_wait_return; msg_didout = FALSE; msg_col = 0; @@ -3325,13 +3325,13 @@ op_yank(oparg_T *oap, int deleting, int update_topline_redraw(); if (oap->block_mode) { - smsg((char_u *)NGETTEXT("block of %ld line yanked%s", + smsg(NGETTEXT("block of %ld line yanked%s", "block of %ld lines yanked%s", yanklines), yanklines, namebuf); } else { - smsg((char_u *)NGETTEXT("%ld line yanked%s", + smsg(NGETTEXT("%ld line yanked%s", "%ld lines yanked%s", yanklines), yanklines, namebuf); } @@ -3649,7 +3649,7 @@ do_put( if (y_size == 0 || y_array == NULL) { - EMSG2(_("E353: Nothing in register %s"), + semsg(_("E353: Nothing in register %s"), regname == 0 ? (char_u *)"\"" : transchar(regname)); goto end; } @@ -5646,7 +5646,7 @@ op_addsub( curbuf->b_op_start = startpos; if (change_cnt > p_report) - smsg((char_u *)NGETTEXT("%ld line changed", "%ld lines changed", + smsg(NGETTEXT("%ld line changed", "%ld lines changed", change_cnt), change_cnt); } } @@ -6423,9 +6423,7 @@ write_viminfo_registers(FILE *fp) type = (char_u *)"BLOCK"; break; default: - sprintf((char *)IObuff, _("E574: Unknown register type %d"), - y_ptr->y_type); - emsg(IObuff); + semsg(_("E574: Unknown register type %d"), y_ptr->y_type); type = (char_u *)"LINE"; break; } @@ -7054,7 +7052,7 @@ write_reg_contents_lst( s = (char_u *)""; else if (strings[1] != NULL) { - EMSG(_("E883: search pattern and expression register may not " + emsg(_("E883: search pattern and expression register may not " "contain two or more lines")); return; } @@ -7110,7 +7108,7 @@ write_reg_contents_ex( buf = buflist_findnr(num); if (buf == NULL) - EMSGN(_(e_nobufnr), (long)num); + semsg(_(e_nobufnr), (long)num); } else buf = buflist_findnr(buflist_findpat(str, str + STRLEN(str), diff --git a/src/option.c b/src/option.c --- a/src/option.c +++ b/src/option.c @@ -3295,20 +3295,20 @@ static long_u *insecure_flag(int opt_idx # define insecure_flag(opt_idx, opt_flags) (&options[opt_idx].flags) #endif static void set_string_option_global(int opt_idx, char_u **varp); -static char_u *did_set_string_option(int opt_idx, char_u **varp, int new_value_alloced, char_u *oldval, char_u *errbuf, int opt_flags, int *value_checked); -static char_u *set_chars_option(char_u **varp); +static char *did_set_string_option(int opt_idx, char_u **varp, int new_value_alloced, char_u *oldval, char *errbuf, int opt_flags, int *value_checked); +static char *set_chars_option(char_u **varp); #ifdef FEAT_CLIPBOARD -static char_u *check_clipboard_option(void); +static char *check_clipboard_option(void); #endif #ifdef FEAT_SPELL -static char_u *did_set_spell_option(int is_spellfile); -static char_u *compile_cap_prog(synblock_T *synblock); +static char *did_set_spell_option(int is_spellfile); +static char *compile_cap_prog(synblock_T *synblock); #endif #ifdef FEAT_EVAL static void set_option_sctx_idx(int opt_idx, int opt_flags, sctx_T script_ctx); #endif -static char_u *set_bool_option(int opt_idx, char_u *varp, int value, int opt_flags); -static char_u *set_num_option(int opt_idx, char_u *varp, long value, char_u *errbuf, size_t errbuflen, int opt_flags); +static char *set_bool_option(int opt_idx, char_u *varp, int value, int opt_flags); +static char *set_num_option(int opt_idx, char_u *varp, long value, char *errbuf, size_t errbuflen, int opt_flags); static void check_redraw(long_u flags); static int findoption(char_u *); static int find_key_option(char_u *arg_arg, int has_lt); @@ -3708,11 +3708,7 @@ set_init_1(int clean_arg) } #if defined(MSWIN) || defined(MACOS_X) || defined(VMS) - if (STRCMP(p_enc, "latin1") == 0 -# ifdef FEAT_MBYTE - || enc_utf8 -# endif - ) + if (STRCMP(p_enc, "latin1") == 0 || enc_utf8) { /* Adjust the default for 'isprint' and 'iskeyword' to match * latin1. Also set the defaults for when 'nocompatible' is @@ -4393,8 +4389,8 @@ do_set( int opt_flags) { int opt_idx; - char_u *errmsg; - char_u errbuf[80]; + char *errmsg; + char errbuf[80]; char_u *startarg; int prefix; /* 1: nothing, 0: "no", 2: "inv" in front of name */ int nextchar; /* next non-white char after option name */ @@ -4546,7 +4542,7 @@ do_set( if (opt_idx == -1 && key == 0) /* found a mismatch: skip */ { - errmsg = (char_u *)N_("E518: Unknown option"); + errmsg = N_("E518: Unknown option"); goto skip; } @@ -4559,7 +4555,7 @@ do_set( if (vim_strchr((char_u *)"=:!&<", nextchar) == NULL && (!(options[opt_idx].flags & P_BOOL) || nextchar == '?')) - errmsg = (char_u *)N_("E519: Option not supported"); + errmsg = N_("E519: Option not supported"); goto skip; } @@ -4597,7 +4593,7 @@ do_set( { if (flags & (P_SECURE | P_NO_ML)) { - errmsg = (char_u *)_("E520: Not allowed in a modeline"); + errmsg = _("E520: Not allowed in a modeline"); goto skip; } #ifdef FEAT_DIFF @@ -4619,7 +4615,7 @@ do_set( /* Disallow changing some options in the sandbox */ if (sandbox != 0 && (flags & P_SECURE)) { - errmsg = (char_u *)_(e_sandbox); + errmsg = _(e_sandbox); goto skip; } #endif @@ -4693,7 +4689,7 @@ do_set( p = find_termcode(key_name); if (p == NULL) { - errmsg = (char_u *)N_("E846: Key code not set"); + errmsg = N_("E846: Key code not set"); goto skip; } else @@ -4822,7 +4818,7 @@ do_set( } else { - errmsg = (char_u *)N_("E521: Number required after ="); + errmsg = N_("E521: Number required after ="); goto skip; } @@ -4923,7 +4919,7 @@ do_set( { STRCPY(errbuf, ":help"); save_arg = arg; - arg = errbuf; + arg = (char_u *)errbuf; } /* * Convert 'backspace' number to string, for @@ -4975,7 +4971,7 @@ do_set( if (*errbuf != NUL) /* remove trailing , */ errbuf[STRLEN(errbuf) - 1] = NUL; save_arg = arg; - arg = errbuf; + arg = (char_u *)errbuf; } /* * Remove '>' before 'dir' and 'bdir', for @@ -5259,7 +5255,7 @@ do_set( if (nextchar == '&') { if (add_termcap_entry(key_name, TRUE) == FAIL) - errmsg = (char_u *)N_("E522: Not found in termcap"); + errmsg = N_("E522: Not found in termcap"); } else { @@ -5315,8 +5311,8 @@ skip: /* make sure all characters are printable */ trans_characters(IObuff, IOSIZE); - ++no_wait_return; /* wait_return done later */ - emsg(IObuff); /* show error highlighted */ + ++no_wait_return; // wait_return done later + emsg((char *)IObuff); // show error highlighted --no_wait_return; return FAIL; @@ -5371,11 +5367,11 @@ did_set_option( *p = *p & ~P_INSECURE; } - static char_u * -illegal_char(char_u *errbuf, int c) + static char * +illegal_char(char *errbuf, int c) { if (errbuf == NULL) - return (char_u *)""; + return ""; sprintf((char *)errbuf, _("E539: Illegal character <%s>"), (char *)transchar(c)); return errbuf; @@ -5403,7 +5399,7 @@ string_to_key(char_u *arg, int multi_byt * Check value of 'cedit' and set cedit_key. * Returns NULL if value is OK, error message otherwise. */ - static char_u * + static char * check_cedit(void) { int n; @@ -5945,8 +5941,8 @@ set_string_option_direct( idx = findoption(name); if (idx < 0) /* not found (should not happen) */ { - EMSG2(_(e_intern2), "set_string_option_direct()"); - IEMSG2(_("For option %s"), name); + semsg(_(e_intern2), "set_string_option_direct()"); + siemsg(_("For option %s"), name); return; } } @@ -6024,7 +6020,7 @@ set_string_option_global( * * Returns NULL on success or error message on error. */ - static char_u * + static char * set_string_option( int opt_idx, char_u *value, @@ -6037,7 +6033,7 @@ set_string_option( char_u *saved_oldval = NULL; char_u *saved_newval = NULL; #endif - char_u *r = NULL; + char *r = NULL; int value_checked = FALSE; if (options[opt_idx].var == NULL) /* don't set hidden option */ @@ -6100,18 +6096,18 @@ valid_filetype(char_u *val) * Handle string options that need some action to perform when changed. * Returns NULL for success, or an error message for an error. */ - static char_u * + static char * did_set_string_option( int opt_idx, // index in options[] table char_u **varp, // pointer to the option variable int new_value_alloced, // new value was allocated char_u *oldval, // previous value of the option - char_u *errbuf, // buffer for errors, or NULL + char *errbuf, // buffer for errors, or NULL int opt_flags, // OPT_LOCAL and/or OPT_GLOBAL int *value_checked) // value was checked to be save, no // need to set P_INSECURE { - char_u *errmsg = NULL; + char *errmsg = NULL; char_u *s, *p; int did_chartab = FALSE; char_u **gvarp; @@ -6155,15 +6151,15 @@ did_set_string_option( else if (varp == &T_NAME) { if (T_NAME[0] == NUL) - errmsg = (char_u *)N_("E529: Cannot set 'term' to empty string"); + errmsg = N_("E529: Cannot set 'term' to empty string"); #ifdef FEAT_GUI if (gui.in_use) - errmsg = (char_u *)N_("E530: Cannot change term in GUI"); + errmsg = N_("E530: Cannot change term in GUI"); else if (term_is_gui(T_NAME)) - errmsg = (char_u *)N_("E531: Use \":gui\" to start the GUI"); + errmsg = N_("E531: Use \":gui\" to start the GUI"); #endif else if (set_termname(T_NAME) == FAIL) - errmsg = (char_u *)N_("E522: Not found in termcap"); + errmsg = N_("E522: Not found in termcap"); else { /* Screen colors may have changed. */ @@ -6211,7 +6207,7 @@ did_set_string_option( { if (STRCMP(*p_bex == '.' ? p_bex + 1 : p_bex, *p_pm == '.' ? p_pm + 1 : p_pm) == 0) - errmsg = (char_u *)N_("E589: 'backupext' and 'patchmode' are equal"); + errmsg = N_("E589: 'backupext' and 'patchmode' are equal"); } #ifdef FEAT_LINEBREAK /* 'breakindentopt' */ @@ -6328,9 +6324,9 @@ did_set_string_option( if (check_opt_strings(p_ambw, p_ambw_values, FALSE) != OK) errmsg = e_invarg; else if (set_chars_option(&p_lcs) != NULL) - errmsg = (char_u *)_("E834: Conflicts with value of 'listchars'"); + errmsg = _("E834: Conflicts with value of 'listchars'"); else if (set_chars_option(&p_fcs) != NULL) - errmsg = (char_u *)_("E835: Conflicts with value of 'fillchars'"); + errmsg = _("E835: Conflicts with value of 'fillchars'"); } #endif @@ -6454,7 +6450,7 @@ did_set_string_option( { /* GTK+ 2 uses only a single encoding, and that is UTF-8. */ if (STRCMP(p_tenc, "utf-8") != 0) - errmsg = (char_u *)N_("E617: Cannot be changed in the GTK+ 2 GUI"); + errmsg = N_("E617: Cannot be changed in the GTK+ 2 GUI"); } # endif @@ -6475,7 +6471,7 @@ did_set_string_option( if (convert_setup(&input_conv, p_tenc, p_enc) == FAIL || convert_setup(&output_conv, p_enc, p_tenc) == FAIL) { - EMSG3(_("E950: Cannot convert between %s and %s"), + semsg(_("E950: Cannot convert between %s and %s"), p_tenc, p_enc); errmsg = e_invarg; } @@ -6748,9 +6744,9 @@ did_set_string_option( ++s; } if (*s++ == NUL) - errmsg = (char_u *)N_("E524: Missing colon"); + errmsg = N_("E524: Missing colon"); else if (*s == ',' || *s == NUL) - errmsg = (char_u *)N_("E525: Zero length string"); + errmsg = N_("E525: Zero length string"); if (errmsg != NULL) break; while (*s && *s != ',') @@ -6830,13 +6826,12 @@ did_set_string_option( { if (errbuf != NULL) { - sprintf((char *)errbuf, - _("E526: Missing number after <%s>"), + sprintf(errbuf, _("E526: Missing number after <%s>"), transchar_byte(*(s - 1))); errmsg = errbuf; } else - errmsg = (char_u *)""; + errmsg = ""; break; } } @@ -6845,14 +6840,14 @@ did_set_string_option( else if (*s) { if (errbuf != NULL) - errmsg = (char_u *)N_("E527: Missing comma"); + errmsg = N_("E527: Missing comma"); else - errmsg = (char_u *)""; + errmsg = ""; break; } } if (*p_viminfo && errmsg == NULL && get_viminfo_parameter('\'') < 0) - errmsg = (char_u *)N_("E528: Must specify a ' value"); + errmsg = N_("E528: Must specify a ' value"); } #endif /* FEAT_VIMINFO */ @@ -6917,7 +6912,7 @@ did_set_string_option( for (s = p_sbr; *s; ) { if (ptr2cells(s) != 1) - errmsg = (char_u *)N_("E595: contains unprintable or wide character"); + errmsg = N_("E595: contains unprintable or wide character"); MB_PTR_ADV(s); } } @@ -6961,7 +6956,7 @@ did_set_string_option( } else # endif - errmsg = (char_u *)N_("E596: Invalid font(s)"); + errmsg = N_("E596: Invalid font(s)"); } } redraw_gui_only = TRUE; @@ -6980,9 +6975,9 @@ did_set_string_option( else if (varp == &p_guifontwide) { if (STRCMP(p_guifontwide, "*") == 0) - errmsg = (char_u *)N_("E533: can't select wide font"); + errmsg = N_("E533: can't select wide font"); else if (gui_get_wide_font() == FAIL) - errmsg = (char_u *)N_("E534: Invalid wide font"); + errmsg = N_("E534: Invalid wide font"); redraw_gui_only = TRUE; } # endif @@ -7285,7 +7280,7 @@ did_set_string_option( errmsg = errbuf; } else - errmsg = (char_u *)""; + errmsg = ""; break; } } @@ -7445,7 +7440,7 @@ did_set_string_option( { p = vim_strchr(*varp, ','); if (p == NULL) - errmsg = (char_u *)N_("E536: comma required"); + errmsg = N_("E536: comma required"); else if (p == *varp || p[1] == NUL) errmsg = e_invarg; else if (foldmethodIsMarker(curwin)) @@ -7455,7 +7450,7 @@ did_set_string_option( else if (gvarp == &p_cms) { if (**varp != NUL && strstr((char *)*varp, "%s") == NULL) - errmsg = (char_u *)N_("E537: 'commentstring' must be empty or contain %s"); + errmsg = N_("E537: 'commentstring' must be empty or contain %s"); } /* 'foldopen' */ else if (varp == &p_fdo) @@ -7878,7 +7873,7 @@ int_cmp(const void *a, const void *b) * Handle setting 'colorcolumn' or 'textwidth' in window "wp". * Returns error message, NULL if it's OK. */ - char_u * + char * check_colorcolumn(win_T *wp) { char_u *s; @@ -7949,7 +7944,7 @@ skip: * Handle setting 'listchars' or 'fillchars'. * Returns error message, NULL if it's OK. */ - static char_u * + static char * set_chars_option(char_u **varp) { int round, i, len, entries; @@ -8075,12 +8070,12 @@ set_chars_option(char_u **varp) * Check validity of options with the 'statusline' format. * Return error message or NULL. */ - char_u * + char * check_stl_option(char_u *s) { int itemcnt = 0; int groupdepth = 0; - static char_u errbuf[80]; + static char errbuf[80]; while (*s && itemcnt < STL_MAX_ITEM) { @@ -8131,13 +8126,13 @@ check_stl_option(char_u *s) while (*s != '}' && *s) s++; if (*s != '}') - return (char_u *)N_("E540: Unclosed expression sequence"); + return N_("E540: Unclosed expression sequence"); } } if (itemcnt >= STL_MAX_ITEM) - return (char_u *)N_("E541: too many items"); + return N_("E541: too many items"); if (groupdepth != 0) - return (char_u *)N_("E542: unbalanced groups"); + return N_("E542: unbalanced groups"); return NULL; } #endif @@ -8145,8 +8140,9 @@ check_stl_option(char_u *s) #ifdef FEAT_CLIPBOARD /* * Extract the items in the 'clipboard' option and set global values. - */ - static char_u * + * Return an error message or NULL for success. + */ + static char * check_clipboard_option(void) { int new_unnamed = 0; @@ -8155,7 +8151,7 @@ check_clipboard_option(void) int new_autoselectml = FALSE; int new_html = FALSE; regprog_T *new_exclude_prog = NULL; - char_u *errmsg = NULL; + char *errmsg = NULL; char_u *p; for (p = p_cb; *p != NUL; ) @@ -8235,10 +8231,14 @@ check_clipboard_option(void) #endif #ifdef FEAT_SPELL - static char_u * +/* + * Handle side effects of setting 'spell'. + * Return an error message or NULL for success. + */ + static char * did_set_spell_option(int is_spellfile) { - char_u *errmsg = NULL; + char *errmsg = NULL; win_T *wp; int l; @@ -8266,7 +8266,7 @@ did_set_spell_option(int is_spellfile) * Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'. * Return error message when failed, NULL when OK. */ - static char_u * + static char * compile_cap_prog(synblock_T *synblock) { regprog_T *rp = synblock->b_cap_prog; @@ -8353,7 +8353,7 @@ set_term_option_sctx_idx(char *name, int * Set the value of a boolean option, and take care of side effects. * Returns NULL for success, or an error message for an error. */ - static char_u * + static char * set_bool_option( int opt_idx, /* index in options[] table */ char_u *varp, /* pointer to the option variable */ @@ -8471,7 +8471,7 @@ set_bool_option( && curbuf->b_term != NULL && !term_is_finished(curbuf)))) { curbuf->b_p_ma = FALSE; - return (char_u *)N_("E946: Cannot make a terminal with running job modifiable"); + return N_("E946: Cannot make a terminal with running job modifiable"); } # endif # ifdef FEAT_TITLE @@ -8607,7 +8607,7 @@ set_bool_option( if (win->w_p_pvw && win != curwin) { curwin->w_p_pvw = FALSE; - return (char_u *)N_("E590: A preview window already exists"); + return N_("E590: A preview window already exists"); } } } @@ -8765,9 +8765,10 @@ set_bool_option( { if (curwin->w_p_spell) { - char_u *errmsg = did_set_spelllang(curwin); + char *errmsg = did_set_spelllang(curwin); + if (errmsg != NULL) - EMSG(_(errmsg)); + emsg(_(errmsg)); } } #endif @@ -8989,17 +8990,17 @@ set_bool_option( * Set the value of a number option, and take care of side effects. * Returns NULL for success, or an error message for an error. */ - static char_u * + static char * set_num_option( int opt_idx, /* index in options[] table */ char_u *varp, /* pointer to the option variable */ long value, /* new value */ - char_u *errbuf, /* buffer for error messages */ + char *errbuf, /* buffer for error messages */ size_t errbuflen, /* length of "errbuf" */ int opt_flags) /* OPT_LOCAL, OPT_GLOBAL and OPT_MODELINE */ { - char_u *errmsg = NULL; + char *errmsg = NULL; long old_value = *(long *)varp; long old_Rows = Rows; /* remember old Rows */ long old_Columns = Columns; /* remember old Columns */ @@ -9937,7 +9938,7 @@ option_iter_next(void **option, int opt_ * * Returns NULL on success or error message on error. */ - char_u * + char * set_option_value( char_u *name, long number, @@ -9975,7 +9976,7 @@ set_option_value( return NULL; } - EMSG2(_("E355: Unknown option: %s"), name); + semsg(_("E355: Unknown option: %s"), name); } else { @@ -9984,7 +9985,7 @@ set_option_value( /* Disallow changing some options in the sandbox */ if (sandbox > 0 && (flags & P_SECURE)) { - EMSG(_(e_sandbox)); + emsg(_(e_sandbox)); return NULL; } #endif @@ -10008,7 +10009,7 @@ set_option_value( /* There's another character after zeros or the string * is empty. In both cases, we are trying to set a * num option using a string. */ - EMSG3(_("E521: Number required: &%s = '%s'"), + semsg(_("E521: Number required: &%s = '%s'"), name, string); return NULL; /* do nothing as we hit an error */ @@ -11086,7 +11087,7 @@ get_varp(struct vimoption *p) case PV_VSTS: return (char_u *)&(curbuf->b_p_vsts); case PV_VTS: return (char_u *)&(curbuf->b_p_vts); #endif - default: IEMSG(_("E356: get_varp ERROR")); + default: iemsg(_("E356: get_varp ERROR")); } /* always return a valid pointer to avoid a crash! */ return (char_u *)&(curbuf->b_p_wm); @@ -12283,7 +12284,7 @@ langmap_set(void) } if (to == NUL) { - EMSG2(_("E357: 'langmap': Matching character missing for %s"), + semsg(_("E357: 'langmap': Matching character missing for %s"), transchar(from)); return; } @@ -12307,7 +12308,7 @@ langmap_set(void) { if (p[0] != ',') { - EMSG2(_("E358: 'langmap': Extra characters after semicolon: %s"), p); + semsg(_("E358: 'langmap': Extra characters after semicolon: %s"), p); return; } ++p; @@ -12877,9 +12878,9 @@ tabstop_set(char_u *var, int **array) if (strtol((char *)cp, (char **)&end, 10) <= 0) { if (cp != end) - EMSG(_(e_positive)); + emsg(_(e_positive)); else - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return FALSE; } } @@ -12891,7 +12892,7 @@ tabstop_set(char_u *var, int **array) ++valcount; continue; } - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return FALSE; } diff --git a/src/os_amiga.c b/src/os_amiga.c --- a/src/os_amiga.c +++ b/src/os_amiga.c @@ -963,7 +963,7 @@ mch_settmode(int tmode) int mch_screenmode(char_u *arg) { - EMSG(_(e_screenmode)); + emsg(_(e_screenmode)); return FAIL; } @@ -1189,7 +1189,7 @@ mch_call_shell( if (close_win) { /* if Vim opened a window: Executing a shell may cause crashes */ - EMSG(_("E360: Cannot execute shell with -f option")); + emsg(_("E360: Cannot execute shell with -f option")); return -1; } @@ -1517,11 +1517,11 @@ mch_expandpath( matches = gap->ga_len - start_len; if (Result == ERROR_BUFFER_OVERFLOW) - EMSG(_("ANCHOR_BUF_SIZE too small.")); + emsg(_("ANCHOR_BUF_SIZE too small.")); else if (matches == 0 && Result != ERROR_OBJECT_NOT_FOUND && Result != ERROR_DEVICE_NOT_MOUNTED && Result != ERROR_NO_MORE_ENTRIES) - EMSG(_("I/O ERROR")); + emsg(_("I/O ERROR")); /* * Sort the files for this pattern. diff --git a/src/os_mswin.c b/src/os_mswin.c --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -776,7 +776,7 @@ mch_chdir(char *path) if (p_verbose >= 5) { verbose_enter(); - smsg((char_u *)"chdir(%s)", path); + smsg("chdir(%s)", path); verbose_leave(); } if (isalpha(path[0]) && path[1] == ':') /* has a drive name */ @@ -841,7 +841,7 @@ mch_check_messages(void) int mch_screenmode(char_u *arg UNUSED) { - EMSG(_(e_screenmode)); + emsg(_(e_screenmode)); return FAIL; } @@ -1004,7 +1004,7 @@ mch_libcall( if (!fRunTimeLinkSuccess) { - EMSG2(_(e_libcall), funcname); + semsg(_(e_libcall), funcname); return FAIL; } @@ -1524,7 +1524,7 @@ mch_print_init(prt_settings_T *psettings if (prt_dlg.hDC == NULL) { - EMSG(_("E237: Printer selection failed")); + emsg(_("E237: Printer selection failed")); mch_print_cleanup(); return FALSE; } @@ -1601,7 +1601,7 @@ mch_print_init(prt_settings_T *psettings vim_memset(&fLogFont, 0, sizeof(fLogFont)); if (get_logfont(&fLogFont, p_pfn, prt_dlg.hDC, TRUE) == FAIL) { - EMSG2(_("E613: Unknown printer font: %s"), p_pfn); + semsg(_("E613: Unknown printer font: %s"), p_pfn); mch_print_cleanup(); return FALSE; } @@ -1662,7 +1662,7 @@ init_fail_dlg: FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, 0, (LPTSTR)(&buf), 0, NULL); - EMSG2(_("E238: Print error: %s"), + semsg(_("E238: Print error: %s"), buf == NULL ? (char_u *)_("Unknown") : buf); LocalFree((LPVOID)(buf)); } @@ -2504,7 +2504,7 @@ serverSendToVim( if (target == 0) { if (!silent) - EMSG2(_(e_noserver), name); + semsg(_(e_noserver), name); return -1; } @@ -3070,9 +3070,7 @@ get_logfont( } if (cp->name == NULL && verbose) { - vim_snprintf((char *)IObuff, IOSIZE, - _("E244: Illegal charset name \"%s\" in font name \"%s\""), p, name); - EMSG(IObuff); + semsg(_("E244: Illegal charset name \"%s\" in font name \"%s\""), p, name); break; } break; @@ -3090,21 +3088,14 @@ get_logfont( } if (qp->name == NULL && verbose) { - vim_snprintf((char *)IObuff, IOSIZE, - _("E244: Illegal quality name \"%s\" in font name \"%s\""), p, name); - EMSG(IObuff); + semsg(_("E244: Illegal quality name \"%s\" in font name \"%s\""), p, name); break; } break; } default: if (verbose) - { - vim_snprintf((char *)IObuff, IOSIZE, - _("E245: Illegal char '%c' in font name \"%s\""), - p[-1], name); - EMSG(IObuff); - } + semsg(_("E245: Illegal char '%c' in font name \"%s\""), p[-1], name); goto theend; } while (*p == ':') diff --git a/src/os_unix.c b/src/os_unix.c --- a/src/os_unix.c +++ b/src/os_unix.c @@ -327,7 +327,7 @@ mch_chdir(char *path) if (p_verbose >= 5) { verbose_enter(); - smsg((char_u *)"chdir(%s)", path); + smsg("chdir(%s)", path); verbose_leave(); } # ifdef VMS @@ -1004,7 +1004,7 @@ static volatile sig_atomic_t lc_active I * if (SETJMP(lc_jump_env) != 0) * { * mch_didjmp(); - * EMSG("crash!"); + * emsg("crash!"); * } * else * { @@ -1632,7 +1632,7 @@ mch_input_isatty(void) static void xopen_message(long elapsed_msec) { - smsg((char_u *)_("Opening the X display took %ld msec"), elapsed_msec); + smsg(_("Opening the X display took %ld msec"), elapsed_msec); } # endif #endif @@ -2670,7 +2670,7 @@ mch_FullName( #endif l = mch_chdir((char *)olddir); if (l != 0) - EMSG(_(e_prev_dir)); + emsg(_(e_prev_dir)); } l = STRLEN(buf); @@ -3974,7 +3974,7 @@ check_mouse_termcode(void) int mch_screenmode(char_u *arg UNUSED) { - EMSG(_(e_screenmode)); + emsg(_(e_screenmode)); return FAIL; } @@ -5454,7 +5454,7 @@ mch_job_start(char **argv, job_T *job, j fd_in[0] = mch_open((char *)fname, O_RDONLY, 0); if (fd_in[0] < 0) { - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); goto failed; } } @@ -5472,7 +5472,7 @@ mch_job_start(char **argv, job_T *job, j fd_out[1] = mch_open((char *)fname, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd_out[1] < 0) { - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); goto failed; } } @@ -5486,7 +5486,7 @@ mch_job_start(char **argv, job_T *job, j fd_err[1] = mch_open((char *)fname, O_WRONLY | O_CREAT | O_TRUNC, 0600); if (fd_err[1] < 0) { - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); goto failed; } } @@ -6509,7 +6509,7 @@ mch_expand_wildcards( */ if ((tempname = vim_tempname('o', FALSE)) == NULL) { - EMSG(_(e_notmp)); + emsg(_(e_notmp)); return FAIL; } @@ -6763,7 +6763,7 @@ mch_expand_wildcards( if (i != (int)len) { /* unexpected read error */ - EMSG2(_(e_notread), tempname); + semsg(_(e_notread), tempname); vim_free(tempname); vim_free(buffer); return FAIL; @@ -7347,7 +7347,7 @@ mch_libcall( /* "dlerr" must be used before dlclose() */ dlerr = (char *)dlerror(); if (dlerr != NULL) - EMSG2(_("dlerror = \"%s\""), dlerr); + semsg(_("dlerror = \"%s\""), dlerr); } # else hinstLib = shl_load((const char*)libname, BIND_IMMEDIATE|BIND_VERBOSE, 0L); @@ -7442,7 +7442,7 @@ mch_libcall( for (i = 0; signal_info[i].sig != -1; i++) if (lc_signal == signal_info[i].sig) break; - EMSG2("E368: got SIG%s in libcall()", signal_info[i].name); + semsg("E368: got SIG%s in libcall()", signal_info[i].name); } # endif # endif @@ -7450,7 +7450,7 @@ mch_libcall( # if defined(USE_DLOPEN) /* "dlerr" must be used before dlclose() */ if (dlerr != NULL) - EMSG2(_("dlerror = \"%s\""), dlerr); + semsg(_("dlerror = \"%s\""), dlerr); /* Free the DLL module. */ (void)dlclose(hinstLib); @@ -7461,7 +7461,7 @@ mch_libcall( if (!success) { - EMSG2(_(e_libcall), funcname); + semsg(_(e_libcall), funcname); return FAIL; } diff --git a/src/os_win32.c b/src/os_win32.c --- a/src/os_win32.c +++ b/src/os_win32.c @@ -633,7 +633,7 @@ dyn_libintl_init(void) if (p_verbose > 0) { verbose_enter(); - EMSG2(_(e_loadlib), GETTEXT_DLL); + semsg(_(e_loadlib), GETTEXT_DLL); verbose_leave(); } return 0; @@ -648,7 +648,7 @@ dyn_libintl_init(void) if (p_verbose > 0) { verbose_enter(); - EMSG2(_(e_loadfunc), libintl_entry[i].name); + semsg(_(e_loadfunc), libintl_entry[i].name); verbose_leave(); } return 0; @@ -5182,7 +5182,7 @@ mch_call_shell( { x = -1; #ifdef FEAT_GUI_W32 - EMSG(_("E371: Command not found")); + emsg(_("E371: Command not found")); #endif } @@ -5260,7 +5260,7 @@ mch_call_shell( #endif ) { - smsg((char_u *)_("shell returned %d"), x); + smsg(_("shell returned %d"), x); msg_putchar('\n'); } #ifdef FEAT_TITLE @@ -5489,7 +5489,7 @@ mch_job_start(char *cmd, job_T *job, job &saAttr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL); if (ifd[0] == INVALID_HANDLE_VALUE) { - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); goto failed; } } @@ -5507,7 +5507,7 @@ mch_job_start(char *cmd, job_T *job, job &saAttr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL); if (ofd[1] == INVALID_HANDLE_VALUE) { - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); goto failed; } } @@ -5525,7 +5525,7 @@ mch_job_start(char *cmd, job_T *job, job &saAttr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL); if (efd[1] == INVALID_HANDLE_VALUE) { - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); goto failed; } } diff --git a/src/popupmnu.c b/src/popupmnu.c --- a/src/popupmnu.c +++ b/src/popupmnu.c @@ -1199,7 +1199,7 @@ pum_show_popupmenu(vimmenu_T *menu) // pum_size being zero. if (pum_size <= 0) { - EMSG(e_menuothermode); + emsg(e_menuothermode); return; } diff --git a/src/proto.h b/src/proto.h --- a/src/proto.h +++ b/src/proto.h @@ -108,25 +108,25 @@ int # ifdef __BORLANDC__ _RTLENTRYF # endif -smsg(char_u *, ...); +smsg(const char *, ...); int # ifdef __BORLANDC__ _RTLENTRYF # endif -smsg_attr(int, char_u *, ...); +smsg_attr(int, const char *, ...); int # ifdef __BORLANDC__ _RTLENTRYF # endif -smsg_attr_keep(int, char_u *, ...); +smsg_attr_keep(int, const char *, ...); int # ifdef __BORLANDC__ _RTLENTRYF # endif -vim_snprintf_add(char *, size_t, char *, ...) +vim_snprintf_add(char *, size_t, const char *, ...) #ifdef USE_PRINTF_FORMAT_ATTRIBUTE __attribute__((format(printf, 3, 4))) #endif @@ -136,14 +136,14 @@ int # ifdef __BORLANDC__ _RTLENTRYF # endif -vim_snprintf(char *, size_t, char *, ...) +vim_snprintf(char *, size_t, const char *, ...) #ifdef USE_PRINTF_FORMAT_ATTRIBUTE __attribute__((format(printf, 3, 4))) #endif ; -int vim_vsnprintf(char *str, size_t str_m, char *fmt, va_list ap); -int vim_vsnprintf_typval(char *str, size_t str_m, char *fmt, va_list ap, typval_T *tvs); +int vim_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap); +int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap, typval_T *tvs); # include "message.pro" # include "misc1.pro" diff --git a/src/proto/buffer.pro b/src/proto/buffer.pro --- a/src/proto/buffer.pro +++ b/src/proto/buffer.pro @@ -8,7 +8,7 @@ void buf_clear_file(buf_T *buf); void buf_freeall(buf_T *buf, int flags); void goto_buffer(exarg_T *eap, int start, int dir, int count); void handle_swap_exists(bufref_T *old_curbuf); -char_u *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int end_bnr, int forceit); +char *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int end_bnr, int forceit); int do_buffer(int action, int start, int dir, int count, int forceit); void set_curbuf(buf_T *buf, int action); void enter_buffer(buf_T *buf); diff --git a/src/proto/digraph.pro b/src/proto/digraph.pro --- a/src/proto/digraph.pro +++ b/src/proto/digraph.pro @@ -5,7 +5,7 @@ int get_digraph(int cmdline); int getdigraph(int char1, int char2, int meta_char); void putdigraph(char_u *str); void listdigraphs(int use_headers); -char_u *keymap_init(void); +char *keymap_init(void); void ex_loadkeymap(exarg_T *eap); void keymap_clear(garray_T *kmap); /* vim: set ft=c : */ diff --git a/src/proto/ex_docmd.pro b/src/proto/ex_docmd.pro --- a/src/proto/ex_docmd.pro +++ b/src/proto/ex_docmd.pro @@ -4,15 +4,15 @@ int do_cmdline_cmd(char_u *cmd); int do_cmdline(char_u *cmdline, char_u *(*fgetline)(int, void *, int), void *cookie, int flags); int getline_equal(char_u *(*fgetline)(int, void *, int), void *cookie, char_u *(*func)(int, void *, int)); void *getline_cookie(char_u *(*fgetline)(int, void *, int), void *cookie); -int parse_command_modifiers(exarg_T *eap, char_u **errormsg, int skip_only); -int parse_cmd_address(exarg_T *eap, char_u **errormsg, int silent); +int parse_command_modifiers(exarg_T *eap, char **errormsg, int skip_only); +int parse_cmd_address(exarg_T *eap, char **errormsg, int silent); int checkforcmd(char_u **pp, char *cmd, int len); int modifier_len(char_u *cmd); int cmd_exists(char_u *name); char_u *set_one_cmd_context(expand_T *xp, char_u *buff); char_u *skip_range(char_u *cmd, int *ctx); void ex_ni(exarg_T *eap); -int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp); +int expand_filename(exarg_T *eap, char_u **cmdlinep, char **errormsgp); void separate_nextcmd(exarg_T *eap); int get_bad_opt(char_u *p, exarg_T *eap); int ends_excmd(int c); @@ -61,7 +61,7 @@ void ex_normal(exarg_T *eap); void exec_normal_cmd(char_u *cmd, int remap, int silent); void exec_normal(int was_typed, int use_vpeekc, int may_use_terminal_loop); int find_cmdline_var(char_u *src, int *usedlen); -char_u *eval_vars(char_u *src, char_u *srcstart, int *usedlen, linenr_T *lnump, char_u **errormsg, int *escaped); +char_u *eval_vars(char_u *src, char_u *srcstart, int *usedlen, linenr_T *lnump, char **errormsg, int *escaped); char_u *expand_sfile(char_u *arg); int put_eol(FILE *fd); int put_line(FILE *fd, char *s); diff --git a/src/proto/ex_eval.pro b/src/proto/ex_eval.pro --- a/src/proto/ex_eval.pro +++ b/src/proto/ex_eval.pro @@ -7,7 +7,7 @@ int cause_errthrow(char_u *mesg, int sev void free_global_msglist(void); void do_errthrow(struct condstack *cstack, char_u *cmdname); int do_intthrow(struct condstack *cstack); -char_u *get_exception_string(void *value, except_type_T type, char_u *cmdname, int *should_free); +char *get_exception_string(void *value, except_type_T type, char_u *cmdname, int *should_free); void discard_current_exception(void); void report_make_pending(int pending, void *value); void report_resume_pending(int pending, void *value); diff --git a/src/proto/ex_getln.pro b/src/proto/ex_getln.pro --- a/src/proto/ex_getln.pro +++ b/src/proto/ex_getln.pro @@ -4,7 +4,7 @@ char_u *getcmdline(int firstc, long coun char_u *getcmdline_prompt(int firstc, char_u *prompt, int attr, int xp_context, char_u *xp_arg); int text_locked(void); void text_locked_msg(void); -char_u *get_text_locked_msg(void); +char *get_text_locked_msg(void); int curbuf_locked(void); int allbuf_locked(void); char_u *getexline(int c, void *cookie, int indent); diff --git a/src/proto/hardcopy.pro b/src/proto/hardcopy.pro --- a/src/proto/hardcopy.pro +++ b/src/proto/hardcopy.pro @@ -1,6 +1,6 @@ /* hardcopy.c */ -char_u *parse_printoptions(void); -char_u *parse_printmbfont(void); +char *parse_printoptions(void); +char *parse_printmbfont(void); int prt_header_height(void); int prt_use_number(void); int prt_get_unit(int idx); diff --git a/src/proto/mbyte.pro b/src/proto/mbyte.pro --- a/src/proto/mbyte.pro +++ b/src/proto/mbyte.pro @@ -1,6 +1,6 @@ /* mbyte.c */ int enc_canon_props(char_u *name); -char_u *mb_init(void); +char *mb_init(void); int bomb_size(void); void remove_bom(char_u *s); int mb_get_class(char_u *p); diff --git a/src/proto/message.pro b/src/proto/message.pro --- a/src/proto/message.pro +++ b/src/proto/message.pro @@ -10,13 +10,10 @@ void msg_source(int attr); int emsg_not_now(void); void ignore_error_for_testing(char_u *error); void do_perror(char *msg); -int emsg(char_u *s); -int emsg2(char_u *s, char_u *a1); -int emsg3(char_u *s, char_u *a1, char_u *a2); -int emsgn(char_u *s, long n); -void iemsg(char_u *s); -void iemsg2(char_u *s, char_u *a1); -void iemsgn(char_u *s, long n); +int emsg(char *s); +int semsg(const char *s, ...); +void iemsg(char *s); +void siemsg(const char *s, ...); void internal_error(char *where); void emsg_invreg(int name); char_u *msg_trunc_attr(char_u *s, int force, int attr); diff --git a/src/proto/misc2.pro b/src/proto/misc2.pro --- a/src/proto/misc2.pro +++ b/src/proto/misc2.pro @@ -87,7 +87,7 @@ int after_pathsep(char_u *b, char_u *p); int same_directory(char_u *f1, char_u *f2); int vim_chdirfile(char_u *fname, char *trigger_autocmd); int vim_stat(const char *name, stat_T *stp); -char_u *parse_shape_opt(int what); +char *parse_shape_opt(int what); int get_shape_idx(int mouse); void update_mouseshape(int shape_idx); void *vim_findfile_init(char_u *path, char_u *filename, char_u *stopdirs, int level, int free_visited, int find_what, void *search_ctx_arg, int tagfile, char_u *rel_fname); diff --git a/src/proto/option.pro b/src/proto/option.pro --- a/src/proto/option.pro +++ b/src/proto/option.pro @@ -21,13 +21,13 @@ int get_term_opt_idx(char_u **p); int set_term_option_alloced(char_u **p); int was_set_insecurely(char_u *opt, int opt_flags); void set_string_option_direct(char_u *name, int opt_idx, char_u *val, int opt_flags, int set_sid); -char_u *check_colorcolumn(win_T *wp); -char_u *check_stl_option(char_u *s); +char *check_colorcolumn(win_T *wp); +char *check_stl_option(char_u *s); void set_term_option_sctx_idx(char *name, int opt_idx); int get_option_value(char_u *name, long *numval, char_u **stringval, int opt_flags); int get_option_value_strict(char_u *name, long *numval, char_u **stringval, int opt_type, void *from); char_u *option_iter_next(void **option, int opt_type); -char_u *set_option_value(char_u *name, long number, char_u *string, int opt_flags); +char *set_option_value(char_u *name, long number, char_u *string, int opt_flags); char_u *get_term_code(char_u *tname); char_u *get_highlight_default(void); char_u *get_encoding_default(void); diff --git a/src/proto/spell.pro b/src/proto/spell.pro --- a/src/proto/spell.pro +++ b/src/proto/spell.pro @@ -10,7 +10,7 @@ void slang_clear_sug(slang_T *lp); void count_common_word(slang_T *lp, char_u *word, int len, int count); int byte_in_str(char_u *str, int n); int init_syl_tab(slang_T *slang); -char_u *did_set_spelllang(win_T *wp); +char *did_set_spelllang(win_T *wp); int captype(char_u *word, char_u *end); void spell_delete_wordlist(void); void spell_free_all(void); diff --git a/src/quickfix.c b/src/quickfix.c --- a/src/quickfix.c +++ b/src/quickfix.c @@ -239,17 +239,14 @@ efmpat_to_regpat( char_u *regpat, efm_T *efminfo, int idx, - int round, - char_u *errmsg) + int round) { char_u *srcptr; if (efminfo->addr[idx]) { // Each errorformat pattern can occur only once - sprintf((char *)errmsg, - _("E372: Too many %%%c in format string"), *efmpat); - EMSG(errmsg); + semsg(_("E372: Too many %%%c in format string"), *efmpat); return NULL; } if ((idx && idx < 6 @@ -257,9 +254,7 @@ efmpat_to_regpat( || (idx == 6 && vim_strchr((char_u *)"OPQ", efminfo->prefix) == NULL)) { - sprintf((char *)errmsg, - _("E373: Unexpected %%%c in format string"), *efmpat); - EMSG(errmsg); + semsg(_("E373: Unexpected %%%c in format string"), *efmpat); return NULL; } efminfo->addr[idx] = (char_u)++round; @@ -316,8 +311,7 @@ scanf_fmt_to_regpat( char_u **pefmp, char_u *efm, int len, - char_u *regpat, - char_u *errmsg) + char_u *regpat) { char_u *efmp = *pefmp; @@ -335,7 +329,7 @@ scanf_fmt_to_regpat( // skip ; if (efmp == efm + len) { - EMSG(_("E374: Missing ] in format string")); + emsg(_("E374: Missing ] in format string")); return NULL; } } @@ -348,9 +342,7 @@ scanf_fmt_to_regpat( else { // TODO: scanf()-like: %*ud, %*3c, %*f, ... ? - sprintf((char *)errmsg, - _("E375: Unsupported %%%c in format string"), *efmp); - EMSG(errmsg); + semsg(_("E375: Unsupported %%%c in format string"), *efmp); return NULL; } @@ -363,7 +355,7 @@ scanf_fmt_to_regpat( * Analyze/parse an errorformat prefix. */ static char_u * -efm_analyze_prefix(char_u *efmp, efm_T *efminfo, char_u *errmsg) +efm_analyze_prefix(char_u *efmp, efm_T *efminfo) { if (vim_strchr((char_u *)"+-", *efmp) != NULL) efminfo->flags = *efmp++; @@ -371,9 +363,7 @@ efm_analyze_prefix(char_u *efmp, efm_T * efminfo->prefix = *efmp; else { - sprintf((char *)errmsg, - _("E376: Invalid %%%c in format string prefix"), *efmp); - EMSG(errmsg); + semsg(_("E376: Invalid %%%c in format string prefix"), *efmp); return NULL; } @@ -391,8 +381,7 @@ efm_to_regpat( char_u *efm, int len, efm_T *fmt_ptr, - char_u *regpat, - char_u *errmsg) + char_u *regpat) { char_u *ptr; char_u *efmp; @@ -413,8 +402,7 @@ efm_to_regpat( break; if (idx < FMT_PATTERNS) { - ptr = efmpat_to_regpat(efmp, ptr, fmt_ptr, idx, round, - errmsg); + ptr = efmpat_to_regpat(efmp, ptr, fmt_ptr, idx, round); if (ptr == NULL) return FAIL; round++; @@ -422,7 +410,7 @@ efm_to_regpat( else if (*efmp == '*') { ++efmp; - ptr = scanf_fmt_to_regpat(&efmp, efm, len, ptr, errmsg); + ptr = scanf_fmt_to_regpat(&efmp, efm, len, ptr); if (ptr == NULL) return FAIL; } @@ -436,15 +424,13 @@ efm_to_regpat( { // prefix is allowed only at the beginning of the errorformat // option part - efmp = efm_analyze_prefix(efmp, fmt_ptr, errmsg); + efmp = efm_analyze_prefix(efmp, fmt_ptr); if (efmp == NULL) return FAIL; } else { - sprintf((char *)errmsg, - _("E377: Invalid %%%c in format string"), *efmp); - EMSG(errmsg); + semsg(_("E377: Invalid %%%c in format string"), *efmp); return FAIL; } } @@ -526,8 +512,6 @@ efm_option_part_len(char_u *efm) static efm_T * parse_efm_option(char_u *efm) { - char_u *errmsg = NULL; - int errmsglen; efm_T *fmt_ptr = NULL; efm_T *fmt_first = NULL; efm_T *fmt_last = NULL; @@ -535,11 +519,6 @@ parse_efm_option(char_u *efm) int len; int sz; - errmsglen = CMDBUFFSIZE + 1; - errmsg = alloc_id(errmsglen, aid_qf_errmsg); - if (errmsg == NULL) - goto parse_efm_end; - // Each part of the format string is copied and modified from errorformat // to regex prog. Only a few % characters are allowed. @@ -563,7 +542,7 @@ parse_efm_option(char_u *efm) // Isolate one part in the 'errorformat' option len = efm_option_part_len(efm); - if (efm_to_regpat(efm, len, fmt_ptr, fmtstr, errmsg) == FAIL) + if (efm_to_regpat(efm, len, fmt_ptr, fmtstr) == FAIL) goto parse_efm_error; if ((fmt_ptr->prog = vim_regcomp(fmtstr, RE_MAGIC + RE_STRING)) == NULL) goto parse_efm_error; @@ -572,7 +551,7 @@ parse_efm_option(char_u *efm) } if (fmt_first == NULL) // nothing found - EMSG(_("E378: 'errorformat' contains no pattern")); + emsg(_("E378: 'errorformat' contains no pattern")); goto parse_efm_end; @@ -581,7 +560,6 @@ parse_efm_error: parse_efm_end: vim_free(fmtstr); - vim_free(errmsg); return fmt_first; } @@ -1271,7 +1249,7 @@ qf_parse_dir_pfx(int idx, qffields_T *fi { if (*fields->namebuf == NUL) { - EMSG(_("E379: Missing or empty directory name")); + emsg(_("E379: Missing or empty directory name")); return QF_FAIL; } qfl->qf_directory = @@ -1568,7 +1546,7 @@ qf_setup_state( if (efile != NULL && (pstate->fd = mch_fopen((char *)efile, "r")) == NULL) { - EMSG2(_(e_openerrf), efile); + semsg(_(e_openerrf), efile); return FAIL; } @@ -1751,7 +1729,7 @@ qf_init_ext( retval = qfl->qf_count; goto qf_init_end; } - EMSG(_(e_readerrf)); + emsg(_(e_readerrf)); error2: if (!adding) { @@ -1968,7 +1946,7 @@ decr_quickfix_busy(void) #ifdef ABORT_ON_INTERNAL_ERROR if (quickfix_busy < 0) { - EMSG("quickfix_busy has become negative"); + emsg("quickfix_busy has become negative"); abort(); } #endif @@ -1980,7 +1958,7 @@ check_quickfix_busy(void) { if (quickfix_busy != 0) { - EMSGN("quickfix_busy not zero on exit: %ld", (long)quickfix_busy); + semsg("quickfix_busy not zero on exit: %ld", (long)quickfix_busy); # ifdef ABORT_ON_INTERNAL_ERROR abort(); # endif @@ -2635,7 +2613,7 @@ get_nth_valid_entry( qf_idx = prev_index; if (err != NULL) { - EMSG(_(err)); + emsg(_(err)); return NULL; } break; @@ -3041,14 +3019,14 @@ qf_jump_edit_buffer( // present. if (qfl_type == QFLT_LOCATION && !win_valid_any_tab(oldwin)) { - EMSG(_("E924: Current window was closed")); + emsg(_("E924: Current window was closed")); *opened_window = FALSE; return NOTDONE; } if (qfl_type == QFLT_QUICKFIX && !qflist_valid(NULL, save_qfid)) { - EMSG(_("E925: Current quickfix was changed")); + emsg(_("E925: Current quickfix was changed")); return NOTDONE; } @@ -3056,9 +3034,9 @@ qf_jump_edit_buffer( || !is_qf_entry_present(qfl, qf_ptr)) { if (qfl_type == QFLT_QUICKFIX) - EMSG(_("E925: Current quickfix was changed")); + emsg(_("E925: Current quickfix was changed")); else - EMSG(_(e_loc_list_changed)); + emsg(_(e_loc_list_changed)); return NOTDONE; } @@ -3315,7 +3293,7 @@ qf_jump_newwin(qf_info_T *qi, if (qf_stack_empty(qi) || qf_list_empty(qi, qi->qf_curlist)) { - EMSG(_(e_quickfix)); + emsg(_(e_quickfix)); return; } @@ -3497,14 +3475,14 @@ qf_list(exarg_T *eap) qi = GET_LOC_LIST(curwin); if (qi == NULL) { - EMSG(_(e_loclist)); + emsg(_(e_loclist)); return; } } if (qf_stack_empty(qi) || qf_list_empty(qi, qi->qf_curlist)) { - EMSG(_(e_quickfix)); + emsg(_(e_quickfix)); return; } if (*arg == '+') @@ -3514,7 +3492,7 @@ qf_list(exarg_T *eap) } if (!get_list_range(&arg, &idx1, &idx2) || *arg != NUL) { - EMSG(_(e_trailing)); + emsg(_(e_trailing)); return; } qfl = &qi->qf_lists[qi->qf_curlist]; @@ -3643,7 +3621,7 @@ qf_age(exarg_T *eap) qi = GET_LOC_LIST(curwin); if (qi == NULL) { - EMSG(_(e_loclist)); + emsg(_(e_loclist)); return; } } @@ -3658,7 +3636,7 @@ qf_age(exarg_T *eap) { if (qi->qf_curlist == 0) { - EMSG(_("E380: At bottom of quickfix stack")); + emsg(_("E380: At bottom of quickfix stack")); break; } --qi->qf_curlist; @@ -3667,7 +3645,7 @@ qf_age(exarg_T *eap) { if (qi->qf_curlist >= qi->qf_listcount - 1) { - EMSG(_("E381: At top of quickfix stack")); + emsg(_("E381: At top of quickfix stack")); break; } ++qi->qf_curlist; @@ -3870,7 +3848,7 @@ qf_view_result(int split) if (qf_list_empty(qi, qi->qf_curlist)) { - EMSG(_(e_quickfix)); + emsg(_(e_quickfix)); return; } @@ -4081,7 +4059,7 @@ ex_copen(exarg_T *eap) qi = GET_LOC_LIST(curwin); if (qi == NULL) { - EMSG(_(e_loclist)); + emsg(_(e_loclist)); return; } } @@ -4163,7 +4141,7 @@ ex_cbottom(exarg_T *eap) qi = GET_LOC_LIST(curwin); if (qi == NULL) { - EMSG(_(e_loclist)); + emsg(_(e_loclist)); return; } } @@ -4609,7 +4587,7 @@ get_mef_name(void) { name = vim_tempname('e', FALSE); if (name == NULL) - EMSG(_(e_notmp)); + emsg(_(e_notmp)); return name; } @@ -4941,7 +4919,7 @@ ex_cc(exarg_T *eap) qi = GET_LOC_LIST(curwin); if (qi == NULL) { - EMSG(_(e_loclist)); + emsg(_(e_loclist)); return; } } @@ -4992,7 +4970,7 @@ ex_cnext(exarg_T *eap) qi = GET_LOC_LIST(curwin); if (qi == NULL) { - EMSG(_(e_loclist)); + emsg(_(e_loclist)); return; } } @@ -5148,7 +5126,7 @@ vgr_init_regmatch(regmmatch_T *regmatch, // Pattern is empty, use last search pattern. if (last_search_pat() == NULL) { - EMSG(_(e_noprevre)); + emsg(_(e_noprevre)); return; } regmatch->regprog = vim_regcomp(last_search_pat(), RE_MAGIC); @@ -5238,7 +5216,7 @@ vgr_qflist_valid( if (wp != NULL) { // An autocmd has freed the location list. - EMSG(_(e_loc_list_changed)); + emsg(_(e_loc_list_changed)); return FALSE; } else @@ -5417,7 +5395,7 @@ ex_vimgrep(exarg_T *eap) p = skip_vimgrep_pat(eap->arg, &s, &flags); if (p == NULL) { - EMSG(_(e_invalpat)); + emsg(_(e_invalpat)); goto theend; } @@ -5428,7 +5406,7 @@ ex_vimgrep(exarg_T *eap) p = skipwhite(p); if (*p == NUL) { - EMSG(_("E683: File name missing or invalid pattern")); + emsg(_("E683: File name missing or invalid pattern")); goto theend; } @@ -5444,7 +5422,7 @@ ex_vimgrep(exarg_T *eap) goto theend; if (fcount == 0) { - EMSG(_(e_nomatch)); + emsg(_(e_nomatch)); goto theend; } @@ -5505,7 +5483,7 @@ ex_vimgrep(exarg_T *eap) if (buf == NULL) { if (!got_int) - smsg((char_u *)_("Cannot open file \"%s\""), fname); + smsg(_("Cannot open file \"%s\""), fname); } else { @@ -5608,7 +5586,7 @@ ex_vimgrep(exarg_T *eap) first_match_buf, target_dir); } else - EMSG2(_(e_nomatch2), s); + semsg(_(e_nomatch2), s); decr_quickfix_busy(); @@ -6285,7 +6263,7 @@ qf_add_entry_from_dict( if (!did_bufnr_emsg) { did_bufnr_emsg = TRUE; - EMSGN(_("E92: Buffer %ld not found"), bufnum); + semsg(_("E92: Buffer %ld not found"), bufnum); } valid = FALSE; bufnum = 0; @@ -6864,9 +6842,9 @@ ex_cbuffer(exarg_T *eap) else if (*skipwhite(skipdigits(eap->arg)) == NUL) buf = buflist_findnr(atoi((char *)eap->arg)); if (buf == NULL) - EMSG(_(e_invarg)); + emsg(_(e_invarg)); else if (buf->b_ml.ml_mfp == NULL) - EMSG(_("E681: Buffer is not loaded")); + emsg(_("E681: Buffer is not loaded")); else { if (eap->addr_count == 0) @@ -6876,7 +6854,7 @@ ex_cbuffer(exarg_T *eap) } if (eap->line1 < 1 || eap->line1 > buf->b_ml.ml_line_count || eap->line2 < 1 || eap->line2 > buf->b_ml.ml_line_count) - EMSG(_(e_invrange)); + emsg(_(e_invrange)); else { char_u *qf_title = qf_cmdtitle(*eap->cmdlinep); @@ -7011,7 +6989,7 @@ ex_cexpr(exarg_T *eap) decr_quickfix_busy(); } else - EMSG(_("E777: String or List expected")); + emsg(_("E777: String or List expected")); cleanup: free_tv(tv); } @@ -7310,7 +7288,7 @@ ex_helpgrep(exarg_T *eap) if (!qf_list_empty(qi, qi->qf_curlist)) qf_jump(qi, 0, 0, FALSE); else - EMSG2(_(e_nomatch2), eap->arg); + semsg(_(e_nomatch2), eap->arg); decr_quickfix_busy(); diff --git a/src/regexp.c b/src/regexp.c --- a/src/regexp.c +++ b/src/regexp.c @@ -334,11 +334,11 @@ toggle_Magic(int x) /* Used for an error (down from) vim_regcomp(): give the error message, set * rc_did_emsg and return NULL */ -#define EMSG_RET_NULL(m) return (EMSG(m), rc_did_emsg = TRUE, (void *)NULL) -#define IEMSG_RET_NULL(m) return (IEMSG(m), rc_did_emsg = TRUE, (void *)NULL) -#define EMSG_RET_FAIL(m) return (EMSG(m), rc_did_emsg = TRUE, FAIL) -#define EMSG2_RET_NULL(m, c) return (EMSG2((m), (c) ? "" : "\\"), rc_did_emsg = TRUE, (void *)NULL) -#define EMSG2_RET_FAIL(m, c) return (EMSG2((m), (c) ? "" : "\\"), rc_did_emsg = TRUE, FAIL) +#define EMSG_RET_NULL(m) return (emsg((m)), rc_did_emsg = TRUE, (void *)NULL) +#define IEMSG_RET_NULL(m) return (iemsg((m)), rc_did_emsg = TRUE, (void *)NULL) +#define EMSG_RET_FAIL(m) return (emsg((m)), rc_did_emsg = TRUE, FAIL) +#define EMSG2_RET_NULL(m, c) return (semsg((const char *)(m), (c) ? "" : "\\"), rc_did_emsg = TRUE, (void *)NULL) +#define EMSG2_RET_FAIL(m, c) return (semsg((const char *)(m), (c) ? "" : "\\"), rc_did_emsg = TRUE, FAIL) #define EMSG_ONE_RET_NULL EMSG2_RET_NULL(_("E369: invalid item in %s%%[]"), reg_magic == MAGIC_ALL) @@ -1304,7 +1304,7 @@ seen_endbrace(int refnum) break; if (*p == NUL) { - EMSG(_("E65: Illegal back reference")); + emsg(_("E65: Illegal back reference")); rc_did_emsg = TRUE; return FALSE; } @@ -1902,7 +1902,7 @@ regpiece(int *flagp) else sprintf((char *)IObuff, _("E62: Nested %s%c"), reg_magic == MAGIC_ALL ? "" : "\\", no_Magic(peekchr())); - EMSG_RET_NULL(IObuff); + EMSG_RET_NULL((char *)IObuff); } return ret; @@ -2078,7 +2078,7 @@ regatom(int *flagp) sprintf((char *)IObuff, _("E64: %s%c follows nothing"), (c == '*' ? reg_magic >= MAGIC_ON : reg_magic == MAGIC_ALL) ? "" : "\\", c); - EMSG_RET_NULL(IObuff); + EMSG_RET_NULL((char *)IObuff); /* NOTREACHED */ case Magic('~'): /* previous substitute pattern */ @@ -3406,7 +3406,7 @@ read_limits(long *minval, long *maxval) { sprintf((char *)IObuff, _("E554: Syntax error in %s{...}"), reg_magic == MAGIC_ALL ? "" : "\\"); - EMSG_RET_FAIL(IObuff); + EMSG_RET_FAIL((char *)IObuff); } /* @@ -3826,7 +3826,7 @@ bt_regexec_both( /* Be paranoid... */ if (prog == NULL || line == NULL) { - EMSG(_(e_null)); + emsg(_(e_null)); goto theend; } @@ -5241,7 +5241,7 @@ regmatch( * a regstar_T on the regstack. */ if ((long)((unsigned)regstack.ga_len >> 10) >= p_mmp) { - EMSG(_(e_maxmempat)); + emsg(_(e_maxmempat)); status = RA_FAIL; } else if (ga_grow(®stack, sizeof(regstar_T)) == FAIL) @@ -5286,7 +5286,7 @@ regmatch( /* Need a bit of room to store extra positions. */ if ((long)((unsigned)regstack.ga_len >> 10) >= p_mmp) { - EMSG(_(e_maxmempat)); + emsg(_(e_maxmempat)); status = RA_FAIL; } else if (ga_grow(®stack, sizeof(regbehind_T)) == FAIL) @@ -5338,7 +5338,7 @@ regmatch( break; default: - EMSG(_(e_re_corr)); + emsg(_(e_re_corr)); #ifdef DEBUG printf("Illegal op code %d\n", op); #endif @@ -5748,7 +5748,7 @@ regmatch( * We get here only if there's trouble -- normally "case END" is * the terminating point. */ - EMSG(_(e_re_corr)); + emsg(_(e_re_corr)); #ifdef DEBUG printf("Premature EOL\n"); #endif @@ -5772,7 +5772,7 @@ regstack_push(regstate_T state, char_u * if ((long)((unsigned)regstack.ga_len >> 10) >= p_mmp) { - EMSG(_(e_maxmempat)); + emsg(_(e_maxmempat)); return NULL; } if (ga_grow(®stack, sizeof(regitem_T)) == FAIL) @@ -6185,7 +6185,7 @@ do_class: break; default: /* Oh dear. Called inappropriately. */ - EMSG(_(e_re_corr)); + emsg(_(e_re_corr)); #ifdef DEBUG printf("Called regrepeat with op code %d\n", OP(p)); #endif @@ -6236,7 +6236,7 @@ prog_magic_wrong(void) if (UCHARAT(((bt_regprog_T *)prog)->program) != REGMAGIC) { - EMSG(_(e_re_corr)); + emsg(_(e_re_corr)); return TRUE; } return FALSE; @@ -7487,7 +7487,7 @@ vim_regsub_both( /* Be paranoid... */ if ((source == NULL && expr == NULL) || dest == NULL) { - EMSG(_(e_null)); + emsg(_(e_null)); return 0; } if (prog_magic_wrong()) @@ -7790,7 +7790,7 @@ vim_regsub_both( else if (*s == NUL) /* we hit NUL. */ { if (copy) - EMSG(_(e_re_damg)); + emsg(_(e_re_damg)); goto exit; } else @@ -8120,13 +8120,13 @@ vim_regcomp(char_u *expr_arg, int re_fla regexp_engine = expr[4] - '0'; expr += 5; #ifdef DEBUG - smsg((char_u *)"New regexp mode selected (%d): %s", + smsg("New regexp mode selected (%d): %s", regexp_engine, regname[newengine]); #endif } else { - EMSG(_("E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be used ")); + emsg(_("E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be used ")); regexp_engine = AUTOMATIC_ENGINE; } } @@ -8158,7 +8158,7 @@ vim_regcomp(char_u *expr_arg, int re_fla fclose(f); } else - EMSG2("(NFA) Could not open \"%s\" to write !!!", + semsg("(NFA) Could not open \"%s\" to write !!!", BT_REGEXP_DEBUG_LOG_NAME); } #endif @@ -8241,7 +8241,7 @@ vim_regexec_string( // Cannot use the same prog recursively, it contains state. if (rmp->regprog->re_in_use) { - EMSG(_(e_recursive)); + emsg(_(e_recursive)); return FALSE; } rmp->regprog->re_in_use = TRUE; @@ -8365,7 +8365,7 @@ vim_regexec_multi( // Cannot use the same prog recursively, it contains state. if (rmp->regprog->re_in_use) { - EMSG(_(e_recursive)); + emsg(_(e_recursive)); return FALSE; } rmp->regprog->re_in_use = TRUE; diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c --- a/src/regexp_nfa.c +++ b/src/regexp_nfa.c @@ -1303,11 +1303,11 @@ nfa_regatom(void) { if (extra == NFA_ADD_NL) { - EMSGN(_(e_ill_char_class), c); + semsg(_(e_ill_char_class), c); rc_did_emsg = TRUE; return FAIL; } - IEMSGN("INTERNAL: Unknown character class char: %ld", c); + siemsg("INTERNAL: Unknown character class char: %ld", c); return FAIL; } #ifdef FEAT_MBYTE @@ -1349,7 +1349,7 @@ nfa_regatom(void) case Magic('|'): case Magic('&'): case Magic(')'): - EMSGN(_(e_misplaced), no_Magic(c)); + semsg(_(e_misplaced), no_Magic(c)); return FAIL; case Magic('='): @@ -1359,7 +1359,7 @@ nfa_regatom(void) case Magic('*'): case Magic('{'): /* these should follow an atom, not form an atom */ - EMSGN(_(e_misplaced), no_Magic(c)); + semsg(_(e_misplaced), no_Magic(c)); return FAIL; case Magic('~'): @@ -1370,7 +1370,7 @@ nfa_regatom(void) * Generated as "\%(pattern\)". */ if (reg_prev_sub == NULL) { - EMSG(_(e_nopresub)); + emsg(_(e_nopresub)); return FAIL; } for (lp = reg_prev_sub; *lp != NUL; MB_CPTR_ADV(lp)) @@ -1445,7 +1445,7 @@ nfa_regatom(void) break; #endif default: - EMSGN(_("E867: (NFA) Unknown operator '\\z%c'"), + semsg(_("E867: (NFA) Unknown operator '\\z%c'"), no_Magic(c)); return FAIL; } @@ -1577,7 +1577,7 @@ nfa_regatom(void) #if VIM_SIZEOF_INT < VIM_SIZEOF_LONG if (n > INT_MAX) { - EMSG(_("E951: \\% value too large")); + emsg(_("E951: \\% value too large")); return FAIL; } #endif @@ -1593,7 +1593,7 @@ nfa_regatom(void) break; } } - EMSGN(_("E867: (NFA) Unknown operator '\\%%%c'"), + semsg(_("E867: (NFA) Unknown operator '\\%%%c'"), no_Magic(c)); return FAIL; } @@ -2071,7 +2071,7 @@ nfa_regpiece(void) } if (i == 0) { - EMSGN(_("E869: (NFA) Unknown operator '\\@%c'"), op); + semsg(_("E869: (NFA) Unknown operator '\\@%c'"), op); return FAIL; } EMIT(i); @@ -2928,7 +2928,7 @@ st_error(int *postfix UNUSED, int *end U fclose(df); } #endif - EMSG(_("E874: (NFA) Could not pop the stack!")); + emsg(_("E874: (NFA) Could not pop the stack!")); } /* @@ -4877,7 +4877,7 @@ check_char_class(int class, int c) default: /* should not be here :P */ - IEMSGN(_(e_ill_char_class), class); + siemsg(_(e_ill_char_class), class); return FAIL; } return FAIL; @@ -5146,7 +5146,7 @@ recursive_regmatch( *listids = (int *)lalloc(sizeof(int) * prog->nstate, TRUE); if (*listids == NULL) { - EMSG(_("E878: (NFA) Could not allocate memory for branch traversal!")); + emsg(_("E878: (NFA) Could not allocate memory for branch traversal!")); return 0; } *listids_len = prog->nstate; @@ -5201,7 +5201,7 @@ recursive_regmatch( } else { - EMSG(_(e_log_open_failed)); + emsg(_(e_log_open_failed)); log_fd = stderr; } #endif @@ -5521,7 +5521,7 @@ nfa_regmatch( debug = fopen(NFA_REGEXP_DEBUG_LOG, "a"); if (debug == NULL) { - EMSG2("(NFA) COULD NOT OPEN %s!", NFA_REGEXP_DEBUG_LOG); + semsg("(NFA) COULD NOT OPEN %s!", NFA_REGEXP_DEBUG_LOG); return FALSE; } #endif @@ -5549,7 +5549,7 @@ nfa_regmatch( } else { - EMSG(_(e_log_open_failed)); + emsg(_(e_log_open_failed)); log_fd = stderr; } #endif @@ -6670,7 +6670,7 @@ nfa_regmatch( #ifdef DEBUG if (c < 0) - IEMSGN("INTERNAL: Negative state char: %ld", c); + siemsg("INTERNAL: Negative state char: %ld", c); #endif result = (c == curc); @@ -6961,7 +6961,7 @@ nfa_regtry( fclose(f); } else - EMSG("Could not open temporary log file for writing"); + emsg("Could not open temporary log file for writing"); #endif clear_sub(&subs.norm); @@ -7094,7 +7094,7 @@ nfa_regexec_both( /* Be paranoid... */ if (prog == NULL || line == NULL) { - EMSG(_(e_null)); + emsg(_(e_null)); goto theend; } @@ -7212,7 +7212,7 @@ nfa_regcomp(char_u *expr, int re_flags) { /* TODO: only give this error for debugging? */ if (post_ptr >= post_end) - IEMSGN("Internal error: estimated max number of states insufficient: %ld", post_end - post_start); + siemsg("Internal error: estimated max number of states insufficient: %ld", post_end - post_start); goto fail; /* Cascaded (syntax?) error */ } diff --git a/src/search.c b/src/search.c --- a/src/search.c +++ b/src/search.c @@ -156,9 +156,9 @@ search_regcomp( if (spats[i].pat == NULL) /* pattern was never defined */ { if (pat_use == RE_SUBST) - EMSG(_(e_nopresub)); + emsg(_(e_nopresub)); else - EMSG(_(e_noprevre)); + emsg(_(e_noprevre)); rc_did_emsg = TRUE; return FAIL; } @@ -369,7 +369,7 @@ static int saved_no_hlsearch = 0; save_last_search_pattern(void) { if (did_save_last_search_spat != 0) - IEMSG("did_save_last_search_spat is not zero"); + iemsg("did_save_last_search_spat is not zero"); else ++did_save_last_search_spat; @@ -385,7 +385,7 @@ restore_last_search_pattern(void) { if (did_save_last_search_spat != 1) { - IEMSG("did_save_last_search_spat is not one"); + iemsg("did_save_last_search_spat is not one"); return; } --did_save_last_search_spat; @@ -670,7 +670,7 @@ searchit( (options & (SEARCH_HIS + SEARCH_KEEP)), ®match) == FAIL) { if ((options & SEARCH_MSG) && !rc_did_emsg) - EMSG2(_("E383: Invalid search string: %s"), mr_pattern); + semsg(_("E383: Invalid search string: %s"), mr_pattern); return FAIL; } @@ -1136,16 +1136,16 @@ searchit( if (!found) /* did not find it */ { if (got_int) - EMSG(_(e_interr)); + emsg(_(e_interr)); else if ((options & SEARCH_MSG) == SEARCH_MSG) { if (p_ws) - EMSG2(_(e_patnotf2), mr_pattern); + semsg(_(e_patnotf2), mr_pattern); else if (lnum == 0) - EMSG2(_("E384: search hit TOP without match for: %s"), + semsg(_("E384: search hit TOP without match for: %s"), mr_pattern); else - EMSG2(_("E385: search hit BOTTOM without match for: %s"), + semsg(_("E385: search hit BOTTOM without match for: %s"), mr_pattern); } return FAIL; @@ -1324,7 +1324,7 @@ do_search( searchstr = spats[RE_SUBST].pat; if (searchstr == NULL) { - EMSG(_(e_noprevre)); + emsg(_(e_noprevre)); retval = 0; goto end_do_search; } @@ -1581,7 +1581,7 @@ do_search( if (dirc != '?' && dirc != '/') { retval = 0; - EMSG(_("E386: Expected '?' or '/' after ';'")); + emsg(_("E386: Expected '?' or '/' after ';'")); goto end_do_search; } ++pat; @@ -5219,7 +5219,7 @@ find_pattern_in_path( if (p_verbose >= 5) { verbose_enter(); - smsg((char_u *)_("Searching included file %s"), + smsg(_("Searching included file %s"), (char *)new_fname); verbose_leave(); } @@ -5442,7 +5442,7 @@ search_line: && g_do_tagpreview == 0 #endif ) - EMSG(_("E387: Match is on current line")); + emsg(_("E387: Match is on current line")); else if (action == ACTION_SHOW) { show_pat_in_path(line, type, did_show, action, @@ -5609,11 +5609,11 @@ exit_matched: #else if (got_int) #endif - EMSG(_(e_interr)); + emsg(_(e_interr)); else if (type == FIND_DEFINE) - EMSG(_("E388: Couldn't find definition")); + emsg(_("E388: Couldn't find definition")); else - EMSG(_("E389: Couldn't find pattern")); + emsg(_("E389: Couldn't find pattern")); } if (action == ACTION_SHOW || action == ACTION_SHOW_ALL) msg_end(); diff --git a/src/sign.c b/src/sign.c --- a/src/sign.c +++ b/src/sign.c @@ -752,7 +752,7 @@ sign_define_by_name( if (next_sign_typenr == start) { vim_free(sp); - EMSG(_("E612: Too many signs defined")); + emsg(_("E612: Too many signs defined")); return FAIL; } lp = first_sign; // start all over @@ -835,7 +835,7 @@ sign_define_by_name( // Currently must be one or two display cells if (s != endp || cells < 1 || cells > 2) { - EMSG2(_("E239: Invalid sign text: %s"), text); + semsg(_("E239: Invalid sign text: %s"), text); return FAIL; } @@ -870,7 +870,7 @@ sign_undefine_by_name(char_u *name) sp = sign_find(name, &sp_prev); if (sp == NULL) { - EMSG2(_("E155: Unknown sign: %s"), name); + semsg(_("E155: Unknown sign: %s"), name); return FAIL; } sign_undefine(sp, sp_prev); @@ -890,7 +890,7 @@ sign_list_by_name(char_u *name) if (sp != NULL) sign_list_defined(sp); else - EMSG2(_("E155: Unknown sign: %s"), name); + semsg(_("E155: Unknown sign: %s"), name); } /* @@ -916,7 +916,7 @@ sign_place( break; if (sp == NULL) { - EMSG2(_("E155: Unknown sign: %s"), sign_name); + semsg(_("E155: Unknown sign: %s"), sign_name); return FAIL; } if (*sign_id == 0) @@ -933,7 +933,7 @@ sign_place( redraw_buf_line_later(buf, lnum); else { - EMSG2(_("E885: Not possible to change sign %s"), sign_name); + semsg(_("E885: Not possible to change sign %s"), sign_name); return FAIL; } @@ -980,7 +980,7 @@ sign_unplace_at_cursor(char_u *groupname if (id > 0) sign_unplace(id, groupname, curwin->w_buffer, curwin->w_cursor.lnum); else - EMSG(_("E159: Missing sign number")); + emsg(_("E159: Missing sign number")); } /* @@ -993,7 +993,7 @@ sign_jump(int sign_id, char_u *sign_grou if ((lnum = buf_findsign(buf, sign_id, sign_group)) <= 0) { - EMSGN(_("E157: Invalid sign ID: %ld"), sign_id); + semsg(_("E157: Invalid sign ID: %ld"), sign_id); return -1; } @@ -1010,7 +1010,7 @@ sign_jump(int sign_id, char_u *sign_grou if (buf->b_fname == NULL) { - EMSG(_("E934: Cannot jump to a buffer that does not have a name")); + emsg(_("E934: Cannot jump to a buffer that does not have a name")); return -1; } cmd = alloc((unsigned)STRLEN(buf->b_fname) + 25); @@ -1070,7 +1070,7 @@ sign_define_cmd(char_u *sign_name, char_ } else { - EMSG2(_(e_invarg2), arg); + semsg(_(e_invarg2), arg); failed = TRUE; break; } @@ -1111,7 +1111,7 @@ sign_place_cmd( // :sign place group=* if (lnum >= 0 || sign_name != NULL || (group != NULL && *group == '\0')) - EMSG(_(e_invarg)); + emsg(_(e_invarg)); else sign_list_placed(buf, group); } @@ -1121,7 +1121,7 @@ sign_place_cmd( if (sign_name == NULL || buf == NULL || (group != NULL && *group == '\0')) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } @@ -1142,7 +1142,7 @@ sign_unplace_cmd( { if (lnum >= 0 || sign_name != NULL || (group != NULL && *group == '\0')) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } @@ -1211,7 +1211,7 @@ sign_jump_cmd( { if (sign_name == NULL && group == NULL && id == -1) { - EMSG(_(e_argreq)); + emsg(_(e_argreq)); return; } @@ -1220,7 +1220,7 @@ sign_jump_cmd( { // File or buffer is not specified or an empty group is used // or a line number or a sign name is specified. - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } (void)sign_jump(id, group, buf); @@ -1275,7 +1275,7 @@ parse_sign_cmd_args( { if (*signid != -1) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return FAIL; } *signid = -2; @@ -1319,12 +1319,12 @@ parse_sign_cmd_args( filename = arg; *buf = buflist_findnr((int)getdigits(&arg)); if (*skipwhite(arg) != NUL) - EMSG(_(e_trailing)); + emsg(_(e_trailing)); break; } else { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return FAIL; } arg = skipwhite(arg); @@ -1332,7 +1332,7 @@ parse_sign_cmd_args( if (filename != NULL && *buf == NULL) { - EMSG2(_("E158: Invalid buffer name: %s"), filename); + semsg(_("E158: Invalid buffer name: %s"), filename); return FAIL; } @@ -1362,7 +1362,7 @@ ex_sign(exarg_T *eap) idx = sign_cmd_idx(arg, p); if (idx == SIGNCMD_LAST) { - EMSG2(_("E160: Unknown sign command: %s"), arg); + semsg(_("E160: Unknown sign command: %s"), arg); return; } arg = skipwhite(p); @@ -1377,7 +1377,7 @@ ex_sign(exarg_T *eap) sign_list_defined(sp); } else if (*arg == NUL) - EMSG(_("E156: Missing sign name")); + emsg(_("E156: Missing sign name")); else { char_u *name; @@ -1591,7 +1591,7 @@ sign_list_defined(sign_T *sp) { char_u *p; - smsg((char_u *)"sign %s", sp->sn_name); + smsg("sign %s", sp->sn_name); if (sp->sn_icon != NULL) { MSG_PUTS(" icon="); diff --git a/src/spell.c b/src/spell.c --- a/src/spell.c +++ b/src/spell.c @@ -717,7 +717,7 @@ find_word(matchinf_T *mip, int mode) if (endidxcnt == MAXWLEN) { /* Must be a corrupted spell file. */ - EMSG(_(e_format)); + emsg(_(e_format)); return; } endlen[endidxcnt] = wlen; @@ -1537,7 +1537,7 @@ no_spell_checking(win_T *wp) if (!wp->w_p_spell || *wp->w_s->b_p_spl == NUL || wp->w_s->b_langp.ga_len == 0) { - EMSG(_("E756: Spell checking is not enabled")); + emsg(_("E756: Spell checking is not enabled")); return TRUE; } return FALSE; @@ -1888,7 +1888,7 @@ spell_load_lang(char_u *lang) if (r == FAIL) { - smsg((char_u *) + smsg( #ifdef VMS _("Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\""), #else @@ -2307,7 +2307,7 @@ count_syllables(slang_T *slang, char_u * * Parse 'spelllang' and set w_s->b_langp accordingly. * Returns NULL if it's OK, an error message otherwise. */ - char_u * + char * did_set_spelllang(win_T *wp) { garray_T ga; @@ -2330,7 +2330,7 @@ did_set_spelllang(win_T *wp) int i, j; langp_T *lp, *lp2; static int recursive = FALSE; - char_u *ret_msg = NULL; + char *ret_msg = NULL; char_u *spl_copy; bufref_T bufref; @@ -2435,7 +2435,7 @@ did_set_spelllang(win_T *wp) * destroying the buffer we are using... */ if (!bufref_valid(&bufref)) { - ret_msg = (char_u *)N_("E797: SpellFileMissing autocommand deleted buffer"); + ret_msg = N_("E797: SpellFileMissing autocommand deleted buffer"); goto theend; } } @@ -2464,8 +2464,7 @@ did_set_spelllang(win_T *wp) else /* This is probably an error. Give a warning and * accept the words anyway. */ - smsg((char_u *) - _("Warning: region %s not supported"), + smsg(_("Warning: region %s not supported"), region); } else @@ -3380,7 +3379,7 @@ spell_suggest(int count) else if (count > 0) { if (count > sug.su_ga.ga_len) - smsg((char_u *)_("Sorry, only %ld suggestions"), + smsg(_("Sorry, only %ld suggestions"), (long)sug.su_ga.ga_len); } else @@ -3615,7 +3614,7 @@ ex_spellrepall(exarg_T *eap UNUSED) if (repl_from == NULL || repl_to == NULL) { - EMSG(_("E752: No previous spell replacement")); + emsg(_("E752: No previous spell replacement")); return; } addlen = (int)(STRLEN(repl_to) - STRLEN(repl_from)); @@ -3665,7 +3664,7 @@ ex_spellrepall(exarg_T *eap UNUSED) vim_free(frompat); if (sub_nsubs == 0) - EMSG2(_("E753: Not found: %s"), repl_from); + semsg(_("E753: Not found: %s"), repl_from); else do_sub_msg(FALSE); } @@ -3905,7 +3904,7 @@ spell_suggest_file(suginfo_T *su, char_u fd = mch_fopen((char *)fname, "r"); if (fd == NULL) { - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); return; } diff --git a/src/spellfile.c b/src/spellfile.c --- a/src/spellfile.c +++ b/src/spellfile.c @@ -359,11 +359,11 @@ spell_load_file( if (fd == NULL) { if (!silent) - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); else if (p_verbose > 2) { verbose_enter(); - smsg((char_u *)e_notopen, fname); + smsg((const char *)e_notopen, fname); verbose_leave(); } goto endFAIL; @@ -371,7 +371,7 @@ spell_load_file( if (p_verbose > 2) { verbose_enter(); - smsg((char_u *)_("Reading spell file \"%s\""), fname); + smsg(_("Reading spell file \"%s\""), fname); verbose_leave(); } @@ -403,18 +403,18 @@ spell_load_file( buf[i] = getc(fd); /* */ if (STRNCMP(buf, VIMSPELLMAGIC, VIMSPELLMAGICL) != 0) { - EMSG(_("E757: This does not look like a spell file")); + emsg(_("E757: This does not look like a spell file")); goto endFAIL; } c = getc(fd); /* */ if (c < VIMSPELLVERSION) { - EMSG(_("E771: Old spell file, needs to be updated")); + emsg(_("E771: Old spell file, needs to be updated")); goto endFAIL; } else if (c > VIMSPELLVERSION) { - EMSG(_("E772: Spell file is for newer version of Vim")); + emsg(_("E772: Spell file is for newer version of Vim")); goto endFAIL; } @@ -521,7 +521,7 @@ spell_load_file( * message. When it's not required skip the contents. */ if (c & SNF_REQUIRED) { - EMSG(_("E770: Unsupported section in spell file")); + emsg(_("E770: Unsupported section in spell file")); goto endFAIL; } while (--len >= 0) @@ -532,13 +532,13 @@ spell_load_file( someerror: if (res == SP_FORMERROR) { - EMSG(_(e_format)); + emsg(_(e_format)); goto endFAIL; } if (res == SP_TRUNCERROR) { truncerr: - EMSG(_(e_spell_trunc)); + emsg(_(e_spell_trunc)); goto endFAIL; } if (res == SP_OTHERERROR) @@ -695,20 +695,20 @@ suggest_load_files(void) buf[i] = getc(fd); /* */ if (STRNCMP(buf, VIMSUGMAGIC, VIMSUGMAGICL) != 0) { - EMSG2(_("E778: This does not look like a .sug file: %s"), + semsg(_("E778: This does not look like a .sug file: %s"), slang->sl_fname); goto nextone; } c = getc(fd); /* */ if (c < VIMSUGVERSION) { - EMSG2(_("E779: Old .sug file, needs to be updated: %s"), + semsg(_("E779: Old .sug file, needs to be updated: %s"), slang->sl_fname); goto nextone; } else if (c > VIMSUGVERSION) { - EMSG2(_("E780: .sug file is for newer version of Vim: %s"), + semsg(_("E780: .sug file is for newer version of Vim: %s"), slang->sl_fname); goto nextone; } @@ -718,7 +718,7 @@ suggest_load_files(void) timestamp = get8ctime(fd); /* */ if (timestamp != slang->sl_sugtime) { - EMSG2(_("E781: .sug file doesn't match .spl file: %s"), + semsg(_("E781: .sug file doesn't match .spl file: %s"), slang->sl_fname); goto nextone; } @@ -731,7 +731,7 @@ suggest_load_files(void) FALSE, 0) != 0) { someerror: - EMSG2(_("E782: error while reading .sug file: %s"), + semsg(_("E782: error while reading .sug file: %s"), slang->sl_fname); slang_clear_sug(slang); goto nextone; @@ -2225,7 +2225,7 @@ spell_read_aff(spellinfo_T *spin, char_u fd = mch_fopen((char *)fname, "r"); if (fd == NULL) { - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); return NULL; } @@ -2277,7 +2277,7 @@ spell_read_aff(spellinfo_T *spin, char_u pc = string_convert(&spin->si_conv, rline, NULL); if (pc == NULL) { - smsg((char_u *)_("Conversion failure for word in %s line %d: %s"), + smsg(_("Conversion failure for word in %s line %d: %s"), fname, lnum, rline); continue; } @@ -2325,11 +2325,11 @@ spell_read_aff(spellinfo_T *spin, char_u if (aff->af_enc != NULL && !spin->si_ascii && convert_setup(&spin->si_conv, aff->af_enc, p_enc) == FAIL) - smsg((char_u *)_("Conversion in %s not supported: from %s to %s"), + smsg(_("Conversion in %s not supported: from %s to %s"), fname, aff->af_enc, p_enc); spin->si_conv.vc_fail = TRUE; #else - smsg((char_u *)_("Conversion in %s not supported"), fname); + smsg(_("Conversion in %s not supported"), fname); #endif } else if (is_aff_rule(items, itemcnt, "FLAG", 2) @@ -2342,7 +2342,7 @@ spell_read_aff(spellinfo_T *spin, char_u else if (STRCMP(items[1], "caplong") == 0) aff->af_flagtype = AFT_CAPLONG; else - smsg((char_u *)_("Invalid value for FLAG in %s line %d: %s"), + smsg(_("Invalid value for FLAG in %s line %d: %s"), fname, lnum, items[1]); if (aff->af_rare != 0 || aff->af_keepcase != 0 @@ -2355,7 +2355,7 @@ spell_read_aff(spellinfo_T *spin, char_u || compflags != NULL || aff->af_suff.ht_used > 0 || aff->af_pref.ht_used > 0) - smsg((char_u *)_("FLAG after using flags in %s line %d: %s"), + smsg(_("FLAG after using flags in %s line %d: %s"), fname, lnum, items[1]); } else if (spell_info_item(items[0])) @@ -2446,7 +2446,7 @@ spell_read_aff(spellinfo_T *spin, char_u aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1], fname, lnum); if (aff->af_pref.ht_used > 0) - smsg((char_u *)_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"), + smsg(_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"), fname, lnum); } else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2) @@ -2455,7 +2455,7 @@ spell_read_aff(spellinfo_T *spin, char_u aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1], fname, lnum); if (aff->af_pref.ht_used > 0) - smsg((char_u *)_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"), + smsg(_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"), fname, lnum); } else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2) @@ -2476,7 +2476,7 @@ spell_read_aff(spellinfo_T *spin, char_u /* We don't use the count, but do check that it's a number and * not COMPOUNDRULE mistyped. */ if (atoi((char *)items[1]) == 0) - smsg((char_u *)_("Wrong COMPOUNDRULES value in %s line %d: %s"), + smsg(_("Wrong COMPOUNDRULES value in %s line %d: %s"), fname, lnum, items[1]); } else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2)) @@ -2507,7 +2507,7 @@ spell_read_aff(spellinfo_T *spin, char_u { compmax = atoi((char *)items[1]); if (compmax == 0) - smsg((char_u *)_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"), + smsg(_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"), fname, lnum, items[1]); } else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2) @@ -2515,7 +2515,7 @@ spell_read_aff(spellinfo_T *spin, char_u { compminlen = atoi((char *)items[1]); if (compminlen == 0) - smsg((char_u *)_("Wrong COMPOUNDMIN value in %s line %d: %s"), + smsg(_("Wrong COMPOUNDMIN value in %s line %d: %s"), fname, lnum, items[1]); } else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2) @@ -2523,7 +2523,7 @@ spell_read_aff(spellinfo_T *spin, char_u { compsylmax = atoi((char *)items[1]); if (compsylmax == 0) - smsg((char_u *)_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"), + smsg(_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"), fname, lnum, items[1]); } else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1)) @@ -2545,7 +2545,7 @@ spell_read_aff(spellinfo_T *spin, char_u else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2)) { if (atoi((char *)items[1]) == 0) - smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"), + smsg(_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"), fname, lnum, items[1]); } else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3)) @@ -2619,10 +2619,10 @@ spell_read_aff(spellinfo_T *spin, char_u { cur_aff = HI2AH(hi); if (cur_aff->ah_combine != (*items[2] == 'Y')) - smsg((char_u *)_("Different combining flag in continued affix block in %s line %d: %s"), + smsg(_("Different combining flag in continued affix block in %s line %d: %s"), fname, lnum, items[1]); if (!cur_aff->ah_follows) - smsg((char_u *)_("Duplicate affix in %s line %d: %s"), + smsg(_("Duplicate affix in %s line %d: %s"), fname, lnum, items[1]); } else @@ -2644,7 +2644,7 @@ spell_read_aff(spellinfo_T *spin, char_u || cur_aff->ah_flag == aff->af_nosuggest || cur_aff->ah_flag == aff->af_needcomp || cur_aff->ah_flag == aff->af_comproot) - smsg((char_u *)_("Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST in %s line %d: %s"), + smsg(_("Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST in %s line %d: %s"), fname, lnum, items[1]); STRCPY(cur_aff->ah_key, items[1]); hash_add(tp, cur_aff->ah_key); @@ -2665,10 +2665,10 @@ spell_read_aff(spellinfo_T *spin, char_u /* Myspell allows extra text after the item, but that might * mean mistakes go unnoticed. Require a comment-starter. */ if (itemcnt > lasti && *items[lasti] != '#') - smsg((char_u *)_(e_afftrailing), fname, lnum, items[lasti]); + smsg(_(e_afftrailing), fname, lnum, items[lasti]); if (STRCMP(items[2], "Y") != 0 && STRCMP(items[2], "N") != 0) - smsg((char_u *)_("Expected Y or N in %s line %d: %s"), + smsg(_("Expected Y or N in %s line %d: %s"), fname, lnum, items[2]); if (*items[0] == 'P' && aff->af_pfxpostpone) @@ -2710,7 +2710,7 @@ spell_read_aff(spellinfo_T *spin, char_u && *items[lasti] != '#' && (STRCMP(items[lasti], "-") != 0 || itemcnt != lasti + 1)) - smsg((char_u *)_(e_afftrailing), fname, lnum, items[lasti]); + smsg(_(e_afftrailing), fname, lnum, items[lasti]); /* New item for an affix letter. */ --aff_todo; @@ -2754,7 +2754,7 @@ spell_read_aff(spellinfo_T *spin, char_u aff_entry->ae_prog = vim_regcomp(buf, RE_MAGIC + RE_STRING + RE_STRICT); if (aff_entry->ae_prog == NULL) - smsg((char_u *)_("Broken condition in %s line %d: %s"), + smsg(_("Broken condition in %s line %d: %s"), fname, lnum, items[4]); } @@ -2902,7 +2902,7 @@ spell_read_aff(spellinfo_T *spin, char_u { /* Ignore REP/REPSAL count */; if (!isdigit(*items[1])) - smsg((char_u *)_("Expected REP(SAL) count in %s line %d"), + smsg(_("Expected REP(SAL) count in %s line %d"), fname, lnum); } else if ((STRCMP(items[0], "REP") == 0 @@ -2913,7 +2913,7 @@ spell_read_aff(spellinfo_T *spin, char_u /* Myspell ignores extra arguments, we require it starts with * # to detect mistakes. */ if (itemcnt > 3 && items[3][0] != '#') - smsg((char_u *)_(e_afftrailing), fname, lnum, items[3]); + smsg(_(e_afftrailing), fname, lnum, items[3]); if (items[0][3] == 'S' ? do_repsal : do_rep) { /* Replace underscore with space (can't include a space @@ -2937,7 +2937,7 @@ spell_read_aff(spellinfo_T *spin, char_u /* First line contains the count. */ found_map = TRUE; if (!isdigit(*items[1])) - smsg((char_u *)_("Expected MAP count in %s line %d"), + smsg(_("Expected MAP count in %s line %d"), fname, lnum); } else if (do_mapline) @@ -2956,7 +2956,7 @@ spell_read_aff(spellinfo_T *spin, char_u && vim_strchr(spin->si_map.ga_data, c) != NULL) || vim_strchr(p, c) != NULL) - smsg((char_u *)_("Duplicate character in MAP in %s line %d"), + smsg(_("Duplicate character in MAP in %s line %d"), fname, lnum); } @@ -3013,7 +3013,7 @@ spell_read_aff(spellinfo_T *spin, char_u } } else - smsg((char_u *)_("Unrecognized or duplicate item in %s line %d: %s"), + smsg(_("Unrecognized or duplicate item in %s line %d: %s"), fname, lnum, items[0]); } } @@ -3041,7 +3041,7 @@ spell_read_aff(spellinfo_T *spin, char_u ) { if (fol == NULL || low == NULL || upp == NULL) - smsg((char_u *)_("Missing FOL/LOW/UPP line in %s"), fname); + smsg(_("Missing FOL/LOW/UPP line in %s"), fname); else (void)set_spell_chartab(fol, low, upp); } @@ -3067,7 +3067,7 @@ spell_read_aff(spellinfo_T *spin, char_u if (compsylmax != 0) { if (syllable == NULL) - smsg((char_u *)_("COMPOUNDSYLMAX used without SYLLABLE")); + smsg(_("COMPOUNDSYLMAX used without SYLLABLE")); aff_check_number(spin->si_compsylmax, compsylmax, "COMPOUNDSYLMAX"); spin->si_compsylmax = compsylmax; } @@ -3101,10 +3101,10 @@ spell_read_aff(spellinfo_T *spin, char_u if (sofofrom != NULL || sofoto != NULL) { if (sofofrom == NULL || sofoto == NULL) - smsg((char_u *)_("Missing SOFO%s line in %s"), + smsg(_("Missing SOFO%s line in %s"), sofofrom == NULL ? "FROM" : "TO", fname); else if (spin->si_sal.ga_len > 0) - smsg((char_u *)_("Both SAL and SOFO lines in %s"), fname); + smsg(_("Both SAL and SOFO lines in %s"), fname); else { aff_check_string(spin->si_sofofr, sofofrom, "SOFOFROM"); @@ -3208,15 +3208,15 @@ affitem2flag( if (res == 0) { if (flagtype == AFT_NUM) - smsg((char_u *)_("Flag is not a number in %s line %d: %s"), + smsg(_("Flag is not a number in %s line %d: %s"), fname, lnum, item); else - smsg((char_u *)_("Illegal flag in %s line %d: %s"), + smsg(_("Illegal flag in %s line %d: %s"), fname, lnum, item); } if (*p != NUL) { - smsg((char_u *)_(e_affname), fname, lnum, item); + smsg(_(e_affname), fname, lnum, item); return 0; } @@ -3419,7 +3419,7 @@ flag_in_afflist(int flagtype, char_u *af aff_check_number(int spinval, int affval, char *name) { if (spinval != 0 && spinval != affval) - smsg((char_u *)_("%s value differs from what is used in another .aff file"), name); + smsg(_("%s value differs from what is used in another .aff file"), name); } /* @@ -3429,7 +3429,7 @@ aff_check_number(int spinval, int affval aff_check_string(char_u *spinval, char_u *affval, char *name) { if (spinval != NULL && STRCMP(spinval, affval) != 0) - smsg((char_u *)_("%s value differs from what is used in another .aff file"), name); + smsg(_("%s value differs from what is used in another .aff file"), name); } /* @@ -3549,7 +3549,7 @@ spell_read_dic(spellinfo_T *spin, char_u fd = mch_fopen((char *)fname, "r"); if (fd == NULL) { - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); return FAIL; } @@ -3566,7 +3566,7 @@ spell_read_dic(spellinfo_T *spin, char_u /* Read and ignore the first line: word count. */ (void)vim_fgets(line, MAXLINELEN, fd); if (!vim_isdigit(*skipwhite(line))) - EMSG2(_("E760: No word count in %s"), fname); + semsg(_("E760: No word count in %s"), fname); /* * Read all the lines in the file one by one. @@ -3596,7 +3596,7 @@ spell_read_dic(spellinfo_T *spin, char_u pc = string_convert(&spin->si_conv, line, NULL); if (pc == NULL) { - smsg((char_u *)_("Conversion failure for word in %s line %d: %s"), + smsg(_("Conversion failure for word in %s line %d: %s"), fname, lnum, line); continue; } @@ -3661,10 +3661,10 @@ spell_read_dic(spellinfo_T *spin, char_u if (!HASHITEM_EMPTY(hi)) { if (p_verbose > 0) - smsg((char_u *)_("Duplicate word in %s line %d: %s"), + smsg(_("Duplicate word in %s line %d: %s"), fname, lnum, dw); else if (duplicate == 0) - smsg((char_u *)_("First duplicate word in %s line %d: %s"), + smsg(_("First duplicate word in %s line %d: %s"), fname, lnum, dw); ++duplicate; } @@ -3719,9 +3719,9 @@ spell_read_dic(spellinfo_T *spin, char_u } if (duplicate > 0) - smsg((char_u *)_("%d duplicate word(s) in %s"), duplicate, fname); + smsg(_("%d duplicate word(s) in %s"), duplicate, fname); if (spin->si_ascii && non_ascii > 0) - smsg((char_u *)_("Ignored %d word(s) with non-ASCII characters in %s"), + smsg(_("Ignored %d word(s) with non-ASCII characters in %s"), non_ascii, fname); hash_clear(&ht); @@ -4133,7 +4133,7 @@ spell_read_wordfile(spellinfo_T *spin, c fd = mch_fopen((char *)fname, "r"); if (fd == NULL) { - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); return FAIL; } @@ -4168,7 +4168,7 @@ spell_read_wordfile(spellinfo_T *spin, c pc = string_convert(&spin->si_conv, rline, NULL); if (pc == NULL) { - smsg((char_u *)_("Conversion failure for word in %s line %d: %s"), + smsg(_("Conversion failure for word in %s line %d: %s"), fname, lnum, rline); continue; } @@ -4187,10 +4187,10 @@ spell_read_wordfile(spellinfo_T *spin, c if (STRNCMP(line, "encoding=", 9) == 0) { if (spin->si_conv.vc_type != CONV_NONE) - smsg((char_u *)_("Duplicate /encoding= line ignored in %s line %d: %s"), + smsg(_("Duplicate /encoding= line ignored in %s line %d: %s"), fname, lnum, line - 1); else if (did_word) - smsg((char_u *)_("/encoding= line after word ignored in %s line %d: %s"), + smsg(_("/encoding= line after word ignored in %s line %d: %s"), fname, lnum, line - 1); else { @@ -4203,12 +4203,12 @@ spell_read_wordfile(spellinfo_T *spin, c if (enc != NULL && !spin->si_ascii && convert_setup(&spin->si_conv, enc, p_enc) == FAIL) - smsg((char_u *)_("Conversion in %s not supported: from %s to %s"), + smsg(_("Conversion in %s not supported: from %s to %s"), fname, line, p_enc); vim_free(enc); spin->si_conv.vc_fail = TRUE; #else - smsg((char_u *)_("Conversion in %s not supported"), fname); + smsg(_("Conversion in %s not supported"), fname); #endif } continue; @@ -4217,13 +4217,13 @@ spell_read_wordfile(spellinfo_T *spin, c if (STRNCMP(line, "regions=", 8) == 0) { if (spin->si_region_count > 1) - smsg((char_u *)_("Duplicate /regions= line ignored in %s line %d: %s"), + smsg(_("Duplicate /regions= line ignored in %s line %d: %s"), fname, lnum, line); else { line += 8; if (STRLEN(line) > MAXREGIONS * 2) - smsg((char_u *)_("Too many regions in %s line %d: %s"), + smsg(_("Too many regions in %s line %d: %s"), fname, lnum, line); else { @@ -4237,7 +4237,7 @@ spell_read_wordfile(spellinfo_T *spin, c continue; } - smsg((char_u *)_("/ line ignored in %s line %d: %s"), + smsg(_("/ line ignored in %s line %d: %s"), fname, lnum, line - 1); continue; } @@ -4267,7 +4267,7 @@ spell_read_wordfile(spellinfo_T *spin, c l = *p - '0'; if (l == 0 || l > spin->si_region_count) { - smsg((char_u *)_("Invalid region nr in %s line %d: %s"), + smsg(_("Invalid region nr in %s line %d: %s"), fname, lnum, p); break; } @@ -4275,7 +4275,7 @@ spell_read_wordfile(spellinfo_T *spin, c } else { - smsg((char_u *)_("Unrecognized flags in %s line %d: %s"), + smsg(_("Unrecognized flags in %s line %d: %s"), fname, lnum, p); break; } @@ -4346,7 +4346,7 @@ getroom( { if (!spin->si_did_emsg) { - EMSG(_("E845: Insufficient memory, word list will be incomplete")); + emsg(_("E845: Insufficient memory, word list will be incomplete")); spin->si_did_emsg = TRUE; } return NULL; @@ -4576,7 +4576,7 @@ tree_add_word( node = *prev; } #ifdef SPELL_PRINTTREE - smsg((char_u *)"Added \"%s\"", word); + smsg("Added \"%s\"", word); spell_print_tree(root->wn_sibling); #endif @@ -4916,7 +4916,7 @@ write_vim_spell(spellinfo_T *spin, char_ fd = mch_fopen((char *)fname, "w"); if (fd == NULL) { - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); return FAIL; } @@ -5305,7 +5305,7 @@ theend: if (fwv != (size_t)1) retval = FAIL; if (retval == FAIL) - EMSG(_(e_write)); + emsg(_(e_write)); return retval; } @@ -5450,7 +5450,7 @@ put_node( if (fd != NULL) if (putc(np->wn_byte, fd) == EOF) /* or */ { - EMSG(_(e_write)); + emsg(_(e_write)); return 0; } } @@ -5555,7 +5555,7 @@ spell_make_sugfile(spellinfo_T *spin, ch if (sug_maketable(spin) == FAIL) goto theend; - smsg((char_u *)_("Number of words after soundfolding: %ld"), + smsg(_("Number of words after soundfolding: %ld"), (long)spin->si_spellbuf->b_ml.ml_line_count); /* @@ -5682,7 +5682,7 @@ sug_filltree(spellinfo_T *spin, slang_T } } - smsg((char_u *)_("Total number of words: %d"), words_done); + smsg(_("Total number of words: %d"), words_done); return OK; } @@ -5848,7 +5848,7 @@ sug_write(spellinfo_T *spin, char_u *fna fd = mch_fopen((char *)fname, "w"); if (fd == NULL) { - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); return; } @@ -5861,7 +5861,7 @@ sug_write(spellinfo_T *spin, char_u *fna */ if (fwrite(VIMSUGMAGIC, VIMSUGMAGICL, (size_t)1, fd) != 1) /* */ { - EMSG(_(e_write)); + emsg(_(e_write)); goto theend; } putc(VIMSUGVERSION, fd); /* */ @@ -5903,7 +5903,7 @@ sug_write(spellinfo_T *spin, char_u *fna len = (int)STRLEN(line) + 1; if (fwrite(line, (size_t)len, (size_t)1, fd) == 0) { - EMSG(_(e_write)); + emsg(_(e_write)); goto theend; } spin->si_memtot += len; @@ -5911,7 +5911,7 @@ sug_write(spellinfo_T *spin, char_u *fna /* Write another byte to check for errors. */ if (putc(0, fd) == EOF) - EMSG(_(e_write)); + emsg(_(e_write)); vim_snprintf((char *)IObuff, IOSIZE, _("Estimated runtime memory use: %d bytes"), spin->si_memtot); @@ -6010,23 +6010,23 @@ mkspell( } if (incount <= 0) - EMSG(_(e_invarg)); /* need at least output and input names */ + emsg(_(e_invarg)); /* need at least output and input names */ else if (vim_strchr(gettail(wfname), '_') != NULL) - EMSG(_("E751: Output file name must not have region name")); + emsg(_("E751: Output file name must not have region name")); else if (incount > MAXREGIONS) - EMSGN(_("E754: Only up to %ld regions supported"), MAXREGIONS); + semsg(_("E754: Only up to %ld regions supported"), MAXREGIONS); else { /* Check for overwriting before doing things that may take a lot of * time. */ if (!over_write && mch_stat((char *)wfname, &st) >= 0) { - EMSG(_(e_exists)); + emsg(_(e_exists)); goto theend; } if (mch_isdir(wfname)) { - EMSG2(_(e_isadir2), wfname); + semsg(_(e_isadir2), wfname); goto theend; } @@ -6048,7 +6048,7 @@ mkspell( if (STRLEN(gettail(innames[i])) < 5 || innames[i][len - 3] != '_') { - EMSG2(_("E755: Invalid region in %s"), innames[i]); + semsg(_("E755: Invalid region in %s"), innames[i]); goto theend; } spin.si_region_name[i * 2] = TOLOWER_ASC(innames[i][len - 2]); @@ -6260,7 +6260,7 @@ spell_add_word( if (*curwin->w_s->b_p_spf == NUL) { - EMSG2(_(e_notset), "spellfile"); + semsg(_(e_notset), "spellfile"); return; } fnamebuf = alloc(MAXPATHL); @@ -6274,7 +6274,7 @@ spell_add_word( break; if (*spf == NUL) { - EMSGN(_("E765: 'spellfile' does not have %ld entries"), idx); + semsg(_("E765: 'spellfile' does not have %ld entries"), idx); vim_free(fnamebuf); return; } @@ -6286,7 +6286,7 @@ spell_add_word( buf = NULL; if (buf != NULL && bufIsChanged(buf)) { - EMSG(_(e_bufloaded)); + emsg(_(e_bufloaded)); vim_free(fnamebuf); return; } @@ -6321,7 +6321,7 @@ spell_add_word( if (undo) { home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE); - smsg((char_u *)_("Word '%.*s' removed from %s"), + smsg(_("Word '%.*s' removed from %s"), len, word, NameBuff); } } @@ -6358,7 +6358,7 @@ spell_add_word( } if (fd == NULL) - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); else { if (bad) @@ -6368,7 +6368,7 @@ spell_add_word( fclose(fd); home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE); - smsg((char_u *)_("Word '%.*s' added to %s"), len, word, NameBuff); + smsg(_("Word '%.*s' added to %s"), len, word, NameBuff); } } @@ -6485,7 +6485,7 @@ set_spell_chartab(char_u *fol, char_u *l { if (*pl == NUL || *pu == NUL) { - EMSG(_(e_affform)); + emsg(_(e_affform)); return FAIL; } #ifdef FEAT_MBYTE @@ -6511,7 +6511,7 @@ set_spell_chartab(char_u *fol, char_u *l { if (f >= 256) { - EMSG(_(e_affrange)); + emsg(_(e_affrange)); return FAIL; } new_st.st_fold[l] = f; @@ -6524,7 +6524,7 @@ set_spell_chartab(char_u *fol, char_u *l { if (f >= 256) { - EMSG(_(e_affrange)); + emsg(_(e_affrange)); return FAIL; } new_st.st_fold[u] = f; @@ -6535,7 +6535,7 @@ set_spell_chartab(char_u *fol, char_u *l if (*pl != NUL || *pu != NUL) { - EMSG(_(e_affform)); + emsg(_(e_affform)); return FAIL; } @@ -6599,7 +6599,7 @@ set_spell_finish(spelltab_T *new_st) || spelltab.st_fold[i] != new_st->st_fold[i] || spelltab.st_upper[i] != new_st->st_upper[i]) { - EMSG(_("E763: Word characters differ between spell files")); + emsg(_("E763: Word characters differ between spell files")); return FAIL; } } @@ -6725,7 +6725,7 @@ set_map_str(slang_T *lp, char_u *map) { /* This should have been checked when generating the .spl * file. */ - EMSG(_("E783: duplicate char in MAP entry")); + emsg(_("E783: duplicate char in MAP entry")); vim_free(b); } } diff --git a/src/structs.h b/src/structs.h --- a/src/structs.h +++ b/src/structs.h @@ -889,8 +889,8 @@ struct condstack */ struct msglist { - char_u *msg; /* original message */ - char_u *throw_msg; /* msg to throw: usually original one */ + char *msg; /* original message */ + char *throw_msg; /* msg to throw: usually original one */ struct msglist *next; /* next of several messages in a row */ }; @@ -912,7 +912,7 @@ typedef struct vim_exception except_T; struct vim_exception { except_type_T type; /* exception type */ - char_u *value; /* exception value */ + char *value; /* exception value */ struct msglist *messages; /* message(s) causing error exception */ char_u *throw_name; /* name of the throw point */ linenr_T throw_lnum; /* line number of the throw point */ diff --git a/src/syntax.c b/src/syntax.c --- a/src/syntax.c +++ b/src/syntax.c @@ -3444,7 +3444,7 @@ syn_cmd_conceal(exarg_T *eap UNUSED, int else if (STRNICMP(arg, "off", 3) == 0 && next - arg == 3) curwin->w_s->b_syn_conceal = FALSE; else - EMSG2(_("E390: Illegal argument: %s"), arg); + semsg(_("E390: Illegal argument: %s"), arg); #endif } @@ -3474,7 +3474,7 @@ syn_cmd_case(exarg_T *eap, int syncing U else if (STRNICMP(arg, "ignore", 6) == 0 && next - arg == 6) curwin->w_s->b_syn_ic = TRUE; else - EMSG2(_("E390: Illegal argument: %s"), arg); + semsg(_("E390: Illegal argument: %s"), arg); } /* @@ -3508,7 +3508,7 @@ syn_cmd_spell(exarg_T *eap, int syncing curwin->w_s->b_syn_spell = SYNSPL_DEFAULT; else { - EMSG2(_("E390: Illegal argument: %s"), arg); + semsg(_("E390: Illegal argument: %s"), arg); return; } @@ -3764,7 +3764,7 @@ syn_cmd_clear(exarg_T *eap, int syncing) id = syn_scl_namen2id(arg + 1, (int)(arg_end - arg - 1)); if (id == 0) { - EMSG2(_("E391: No such syntax cluster: %s"), arg); + semsg(_("E391: No such syntax cluster: %s"), arg); break; } else @@ -3784,7 +3784,7 @@ syn_cmd_clear(exarg_T *eap, int syncing) id = syn_namen2id(arg, (int)(arg_end - arg)); if (id == 0) { - EMSG2(_(e_nogroup), arg); + semsg(_(e_nogroup), arg); break; } else @@ -3969,7 +3969,7 @@ syn_cmd_list( { id = syn_scl_namen2id(arg + 1, (int)(arg_end - arg - 1)); if (id == 0) - EMSG2(_("E392: No such syntax cluster: %s"), arg); + semsg(_("E392: No such syntax cluster: %s"), arg); else syn_list_cluster(id - SYNID_CLUSTER); } @@ -3977,7 +3977,7 @@ syn_cmd_list( { id = syn_namen2id(arg, (int)(arg_end - arg)); if (id == 0) - EMSG2(_(e_nogroup), arg); + semsg(_(e_nogroup), arg); else syn_list_one(id, syncing, TRUE); } @@ -4650,7 +4650,7 @@ get_syn_options( { if (!opt->has_cont_list) { - EMSG(_("E395: contains argument not accepted here")); + emsg(_("E395: contains argument not accepted here")); return NULL; } if (get_id_list(&arg, 8, &opt->cont_list, skip) == FAIL) @@ -4689,7 +4689,7 @@ get_syn_options( #ifdef FEAT_CONCEAL if (!vim_isprintc_strict(*conceal_char)) { - EMSG(_("E844: invalid cchar value")); + emsg(_("E844: invalid cchar value")); return NULL; } #endif @@ -4705,7 +4705,7 @@ get_syn_options( { if (opt->sync_idx == NULL) { - EMSG(_("E393: group[t]here not accepted here")); + emsg(_("E393: group[t]here not accepted here")); return NULL; } gname_start = arg; @@ -4729,7 +4729,7 @@ get_syn_options( } if (i < 0) { - EMSG2(_("E394: Didn't find region item for %s"), gname); + semsg(_("E394: Didn't find region item for %s"), gname); vim_free(gname); return NULL; } @@ -4787,7 +4787,7 @@ syn_cmd_include(exarg_T *eap, int syncin int sgl_id = 1; char_u *group_name_end; char_u *rest; - char_u *errormsg = NULL; + char *errormsg = NULL; int prev_toplvl_grp; int prev_syn_inc_tag; int source = FALSE; @@ -4802,7 +4802,7 @@ syn_cmd_include(exarg_T *eap, int syncin rest = get_group_name(arg, &group_name_end); if (rest == NULL) { - EMSG((char_u *)_("E397: Filename required")); + emsg(_("E397: Filename required")); return; } sgl_id = syn_check_cluster(arg, (int)(group_name_end - arg)); @@ -4827,7 +4827,7 @@ syn_cmd_include(exarg_T *eap, int syncin if (expand_filename(eap, syn_cmdlinep, &errormsg) == FAIL) { if (errormsg != NULL) - EMSG(errormsg); + emsg(errormsg); return; } } @@ -4838,7 +4838,7 @@ syn_cmd_include(exarg_T *eap, int syncin */ if (running_syn_inc_tag >= MAX_SYN_INC_TAG) { - EMSG((char_u *)_("E847: Too many syntax includes")); + emsg(_("E847: Too many syntax includes")); return; } prev_syn_inc_tag = current_syn_inc_tag; @@ -4847,7 +4847,7 @@ syn_cmd_include(exarg_T *eap, int syncin curwin->w_s->b_syn_topgrp = sgl_id; if (source ? do_source(eap->arg, FALSE, DOSO_NONE) == FAIL : source_runtime(eap->arg, DIP_ALL) == FAIL) - EMSG2(_(e_notopen), eap->arg); + semsg(_(e_notopen), eap->arg); curwin->w_s->b_syn_topgrp = prev_toplvl_grp; current_syn_inc_tag = prev_syn_inc_tag; } @@ -4934,14 +4934,14 @@ syn_cmd_keyword(exarg_T *eap, int syncin break; if (p[1] == NUL) { - EMSG2(_("E789: Missing ']': %s"), kw); + semsg(_("E789: Missing ']': %s"), kw); goto error; } if (p[1] == ']') { if (p[2] != NUL) { - EMSG3(_("E890: trailing char after ']': %s]%s"), + semsg(_("E890: trailing char after ']': %s]%s"), kw, &p[2]); goto error; } @@ -4975,7 +4975,7 @@ error: if (rest != NULL) eap->nextcmd = check_nextcmd(rest); else - EMSG2(_(e_invarg2), arg); + semsg(_(e_invarg2), arg); redraw_curbuf_later(SOME_VALID); syn_stack_free_all(curwin->w_s); /* Need to recompute all syntax. */ @@ -5083,7 +5083,7 @@ syn_cmd_match( vim_free(syn_opt_arg.next_list); if (rest == NULL) - EMSG2(_(e_invarg2), arg); + semsg(_(e_invarg2), arg); } /* @@ -5184,7 +5184,7 @@ syn_cmd_region( if (*rest != '=') { rest = NULL; - EMSG2(_("E398: Missing '=': %s"), arg); + semsg(_("E398: Missing '=': %s"), arg); break; } rest = skipwhite(rest + 1); @@ -5347,9 +5347,9 @@ syn_cmd_region( vim_free(syn_opt_arg.cont_in_list); vim_free(syn_opt_arg.next_list); if (not_enough) - EMSG2(_("E399: Not enough arguments: syntax region %s"), arg); + semsg(_("E399: Not enough arguments: syntax region %s"), arg); else if (illegal || rest == NULL) - EMSG2(_(e_invarg2), arg); + semsg(_(e_invarg2), arg); } } @@ -5578,7 +5578,7 @@ syn_add_cluster(char_u *name) len = curwin->w_s->b_syn_clusters.ga_len; if (len >= MAX_CLUSTER_ID) { - EMSG((char_u *)_("E848: Too many syntax clusters")); + emsg(_("E848: Too many syntax clusters")); vim_free(name); return 0; } @@ -5661,7 +5661,7 @@ syn_cmd_cluster(exarg_T *eap, int syncin clstr_list = NULL; if (get_id_list(&rest, opt_len, &clstr_list, eap->skip) == FAIL) { - EMSG2(_(e_invarg2), rest); + semsg(_(e_invarg2), rest); break; } if (scl_id >= 0) @@ -5680,9 +5680,9 @@ syn_cmd_cluster(exarg_T *eap, int syncin } if (!got_clstr) - EMSG(_("E400: No cluster specified")); + emsg(_("E400: No cluster specified")); if (rest == NULL || !ends_excmd(*rest)) - EMSG2(_(e_invarg2), arg); + semsg(_(e_invarg2), arg); } /* @@ -5715,7 +5715,7 @@ get_syn_pattern(char_u *arg, synpat_T *c end = skip_regexp(arg + 1, *arg, TRUE, NULL); if (*end != *arg) /* end delimiter not found */ { - EMSG2(_("E401: Pattern delimiter not found: %s"), arg); + semsg(_("E401: Pattern delimiter not found: %s"), arg); return NULL; } /* store the pattern and compiled regexp program */ @@ -5793,7 +5793,7 @@ get_syn_pattern(char_u *arg, synpat_T *c if (!ends_excmd(*end) && !VIM_ISWHITE(*end)) { - EMSG2(_("E402: Garbage after pattern: %s"), arg); + semsg(_("E402: Garbage after pattern: %s"), arg); return NULL; } return skipwhite(end); @@ -5885,7 +5885,7 @@ syn_cmd_sync(exarg_T *eap, int syncing U } if (curwin->w_s->b_syn_linecont_pat != NULL) { - EMSG(_("E403: syntax sync: line continuations pattern specified twice")); + emsg(_("E403: syntax sync: line continuations pattern specified twice")); finished = TRUE; break; } @@ -5944,7 +5944,7 @@ syn_cmd_sync(exarg_T *eap, int syncing U } vim_free(key); if (illegal) - EMSG2(_("E404: Illegal arguments: %s"), arg_start); + semsg(_("E404: Illegal arguments: %s"), arg_start); else if (!finished) { eap->nextcmd = check_nextcmd(arg_start); @@ -5995,13 +5995,13 @@ get_id_list( p = skipwhite(*arg + keylen); if (*p != '=') { - EMSG2(_("E405: Missing equal sign: %s"), *arg); + semsg(_("E405: Missing equal sign: %s"), *arg); break; } p = skipwhite(p + 1); if (ends_excmd(*p)) { - EMSG2(_("E406: Empty argument: %s"), *arg); + semsg(_("E406: Empty argument: %s"), *arg); break; } @@ -6027,14 +6027,14 @@ get_id_list( { if (TOUPPER_ASC(**arg) != 'C') { - EMSG2(_("E407: %s not allowed here"), name + 1); + semsg(_("E407: %s not allowed here"), name + 1); failed = TRUE; vim_free(name); break; } if (count != 0) { - EMSG2(_("E408: %s must be first in contains list"), + semsg(_("E408: %s must be first in contains list"), name + 1); failed = TRUE; vim_free(name); @@ -6108,7 +6108,7 @@ get_id_list( vim_free(name); if (id == 0) { - EMSG2(_("E409: Unknown group name: %s"), p); + semsg(_("E409: Unknown group name: %s"), p); failed = TRUE; break; } @@ -6343,7 +6343,7 @@ ex_syntax(exarg_T *eap) { if (subcommands[i].name == NULL) { - EMSG2(_("E410: Invalid :syntax subcommand: %s"), subcmd_name); + semsg(_("E410: Invalid :syntax subcommand: %s"), subcmd_name); break; } if (STRCMP(subcmd_name, (char_u *)subcommands[i].name) == 0) @@ -6648,7 +6648,7 @@ ex_syntime(exarg_T *eap) else if (STRCMP(eap->arg, "report") == 0) syntime_report(); else - EMSG2(_(e_invarg2), eap->arg); + semsg(_(e_invarg2), eap->arg); } static void @@ -7158,7 +7158,7 @@ init_highlight( static int recursive = 0; if (recursive >= 5) - EMSG(_("E679: recursive loop loading syncolor.vim")); + emsg(_("E679: recursive loop loading syncolor.vim")); else { ++recursive; @@ -7407,7 +7407,7 @@ do_highlight( { id = syn_namen2id(line, (int)(name_end - line)); if (id == 0) - EMSG2(_("E411: highlight group not found: %s"), line); + semsg(_("E411: highlight group not found: %s"), line); else highlight_list_one(id); return; @@ -7431,14 +7431,14 @@ do_highlight( if (ends_excmd(*from_start) || ends_excmd(*to_start)) { - EMSG2(_("E412: Not enough arguments: \":highlight link %s\""), + semsg(_("E412: Not enough arguments: \":highlight link %s\""), from_start); return; } if (!ends_excmd(*skipwhite(to_end))) { - EMSG2(_("E413: Too many arguments: \":highlight link %s\""), from_start); + semsg(_("E413: Too many arguments: \":highlight link %s\""), from_start); return; } @@ -7458,7 +7458,7 @@ do_highlight( && hl_has_settings(from_id - 1, dodefault)) { if (sourcing_name == NULL && !dodefault) - EMSG(_("E414: group has settings, highlight link ignored")); + emsg(_("E414: group has settings, highlight link ignored")); } else if (HL_TABLE()[from_id - 1].sg_link != to_id #ifdef FEAT_EVAL @@ -7605,7 +7605,7 @@ do_highlight( key_start = linep; if (*linep == '=') { - EMSG2(_("E415: unexpected equal sign: %s"), key_start); + semsg(_("E415: unexpected equal sign: %s"), key_start); error = TRUE; break; } @@ -7641,7 +7641,7 @@ do_highlight( */ if (*linep != '=') { - EMSG2(_("E416: missing equal sign: %s"), key_start); + semsg(_("E416: missing equal sign: %s"), key_start); error = TRUE; break; } @@ -7657,7 +7657,7 @@ do_highlight( linep = vim_strchr(linep, '\''); if (linep == NULL) { - EMSG2(_(e_invarg2), key_start); + semsg(_(e_invarg2), key_start); error = TRUE; break; } @@ -7669,7 +7669,7 @@ do_highlight( } if (linep == arg_start) { - EMSG2(_("E417: missing argument: %s"), key_start); + semsg(_("E417: missing argument: %s"), key_start); error = TRUE; break; } @@ -7706,7 +7706,7 @@ do_highlight( } if (i < 0) { - EMSG2(_("E418: Illegal value: %s"), arg); + semsg(_("E418: Illegal value: %s"), arg); error = TRUE; break; } @@ -7831,7 +7831,7 @@ do_highlight( color = cterm_normal_fg_color - 1; else { - EMSG(_("E419: FG color unknown")); + emsg(_("E419: FG color unknown")); error = TRUE; break; } @@ -7842,7 +7842,7 @@ do_highlight( color = cterm_normal_bg_color - 1; else { - EMSG(_("E420: BG color unknown")); + emsg(_("E420: BG color unknown")); error = TRUE; break; } @@ -7866,7 +7866,7 @@ do_highlight( break; if (i < 0) { - EMSG2(_("E421: Color name or number not recognized: %s"), key_start); + semsg(_("E421: Color name or number not recognized: %s"), key_start); error = TRUE; break; } @@ -8113,7 +8113,7 @@ do_highlight( /* Append it to the already found stuff */ if ((int)(STRLEN(buf) + STRLEN(p)) >= 99) { - EMSG2(_("E422: terminal code too long: %s"), arg); + semsg(_("E422: terminal code too long: %s"), arg); error = TRUE; break; } @@ -8160,7 +8160,7 @@ do_highlight( } else { - EMSG2(_("E423: Illegal argument: %s"), key_start); + semsg(_("E423: Illegal argument: %s"), key_start); error = TRUE; break; } @@ -8827,7 +8827,7 @@ get_attr_entry(garray_T *table, attrentr */ if (recursive) { - EMSG(_("E424: Too many different highlighting attributes in use")); + emsg(_("E424: Too many different highlighting attributes in use")); return 0; } recursive = TRUE; @@ -9716,7 +9716,7 @@ syn_add_group(char_u *name) { if (!vim_isprintc(*p)) { - EMSG(_("E669: Unprintable character in group name")); + emsg(_("E669: Unprintable character in group name")); vim_free(name); return 0; } @@ -9741,7 +9741,7 @@ syn_add_group(char_u *name) if (highlight_ga.ga_len >= MAX_HL_ID) { - EMSG(_("E849: Too many highlight and syntax groups")); + emsg(_("E849: Too many highlight and syntax groups")); vim_free(name); return 0; } diff --git a/src/tag.c b/src/tag.c --- a/src/tag.c +++ b/src/tag.c @@ -279,7 +279,7 @@ do_tag( tagstacklen == 0) { /* empty stack */ - EMSG(_(e_tagstack)); + emsg(_(e_tagstack)); goto end_do_tag; } @@ -290,7 +290,7 @@ do_tag( #endif if ((tagstackidx -= count) < 0) { - EMSG(_(bottommsg)); + emsg(_(bottommsg)); if (tagstackidx + count == 0) { /* We did [num]^T from the bottom of the stack */ @@ -304,7 +304,7 @@ do_tag( } else if (tagstackidx >= tagstacklen) /* count == 0? */ { - EMSG(_(topmsg)); + emsg(_(topmsg)); goto end_do_tag; } @@ -375,12 +375,12 @@ do_tag( * position. */ tagstackidx = tagstacklen - 1; - EMSG(_(topmsg)); + emsg(_(topmsg)); save_pos = FALSE; } else if (tagstackidx < 0) /* must have been count == 0 */ { - EMSG(_(bottommsg)); + emsg(_(bottommsg)); tagstackidx = 0; goto end_do_tag; } @@ -424,7 +424,7 @@ do_tag( cur_match = MAXCOL - 1; else if (cur_match < 0) { - EMSG(_("E425: Cannot go before first matching tag")); + emsg(_("E425: Cannot go before first matching tag")); skip_msg = TRUE; cur_match = 0; cur_fnum = curbuf->b_fnum; @@ -566,7 +566,7 @@ do_tag( if (num_matches <= 0) { if (verbose) - EMSG2(_("E426: tag not found: %s"), name); + semsg(_("E426: tag not found: %s"), name); #if defined(FEAT_QUICKFIX) g_do_tagpreview = 0; #endif @@ -950,14 +950,14 @@ do_tag( { /* Avoid giving this error when a file wasn't found and we're * looking for a match in another file, which wasn't found. - * There will be an EMSG("file doesn't exist") below then. */ + * There will be an emsg("file doesn't exist") below then. */ if ((type == DT_NEXT || type == DT_FIRST) && nofile_fname == NULL) { if (num_matches == 1) - EMSG(_("E427: There is only one matching tag")); + emsg(_("E427: There is only one matching tag")); else - EMSG(_("E428: Cannot go beyond last matching tag")); + emsg(_("E428: Cannot go beyond last matching tag")); skip_msg = TRUE; } cur_match = num_matches - 1; @@ -978,10 +978,10 @@ do_tag( /* * Only when going to try the next match, report that the previous - * file didn't exist. Otherwise an EMSG() is given below. + * file didn't exist. Otherwise an emsg() is given below. */ if (nofile_fname != NULL && error_cur_match != cur_match) - smsg((char_u *)_("File \"%s\" does not exist"), nofile_fname); + smsg(_("File \"%s\" does not exist"), nofile_fname); ic = (matches[cur_match][0] & MT_IC_OFF); @@ -1053,7 +1053,7 @@ do_tag( } continue; } - EMSG2(_("E429: File \"%s\" does not exist"), nofile_fname); + semsg(_("E429: File \"%s\" does not exist"), nofile_fname); } else { @@ -1577,7 +1577,7 @@ find_tags( if (p_verbose >= 5) { verbose_enter(); - smsg((char_u *)_("Searching tags file %s"), tag_fname); + smsg(_("Searching tags file %s"), tag_fname); verbose_leave(); } } @@ -1801,7 +1801,7 @@ line_read_in: if (fp != NULL) { if (STRLEN(fullpath_ebuf) > LSIZE) - EMSG2(_("E430: Tag file path truncated for %s\n"), ebuf); + semsg(_("E430: Tag file path truncated for %s\n"), ebuf); vim_strncpy(tag_fname, fullpath_ebuf, MAXPATHL); ++incstack_idx; @@ -2451,11 +2451,11 @@ parse_line: if (line_error) { - EMSG2(_("E431: Format error in tags file \"%s\""), tag_fname); + semsg(_("E431: Format error in tags file \"%s\""), tag_fname); #ifdef FEAT_CSCOPE if (!use_cscope) #endif - EMSGN(_("Before byte %ld"), (long)vim_ftell(fp)); + semsg(_("Before byte %ld"), (long)vim_ftell(fp)); stop_searching = TRUE; line_error = FALSE; } @@ -2481,7 +2481,7 @@ parse_line: tag_file_sorted = NUL; if (sort_error) { - EMSG2(_("E432: Tags file not sorted: %s"), tag_fname); + semsg(_("E432: Tags file not sorted: %s"), tag_fname); sort_error = FALSE; } #endif @@ -2525,7 +2525,7 @@ parse_line: if (!stop_searching) { if (!did_open && verbose) /* never opened any tags file */ - EMSG(_("E433: No tags file")); + emsg(_("E433: No tags file")); retval = OK; /* It's OK even when no tag found */ } @@ -3370,7 +3370,7 @@ jumpto_tag( } if (found == 0) { - EMSG(_("E434: Can't find tag pattern")); + emsg(_("E434: Can't find tag pattern")); curwin->w_cursor.lnum = save_lnum; } else @@ -3895,7 +3895,7 @@ add_tag_field( if (p_verbose > 0) { verbose_enter(); - smsg((char_u *)_("Duplicate field name: %s"), field_name); + smsg(_("Duplicate field name: %s"), field_name); verbose_leave(); } return FAIL; @@ -4200,7 +4200,7 @@ set_tagstack(win_T *wp, dict_T *d, int a { if (di->di_tv.v_type != VAR_LIST) { - EMSG(_(e_listreq)); + emsg(_(e_listreq)); return FAIL; } l = di->di_tv.vval.v_list; diff --git a/src/term.c b/src/term.c --- a/src/term.c +++ b/src/term.c @@ -92,7 +92,7 @@ static int term_is_builtin(char_u *name) static int term_7to8bit(char_u *p); #ifdef HAVE_TGETENT -static char_u *tgetent_error(char_u *, char_u *); +static char *tgetent_error(char_u *, char_u *); /* * Here is our own prototype for tgetstr(), any prototypes from the include @@ -1357,7 +1357,7 @@ termgui_get_color(char_u *name) t = termgui_mch_get_color(name); if (t == INVALCOLOR) - EMSG2(_("E254: Cannot allocate color %s"), name); + semsg(_("E254: Cannot allocate color %s"), name); return t; } @@ -1696,14 +1696,14 @@ get_term_entries(int *height, int *width #endif static void -report_term_error(char_u *error_msg, char_u *term) +report_term_error(char *error_msg, char_u *term) { struct builtin_term *termp; mch_errmsg("\r\n"); if (error_msg != NULL) { - mch_errmsg((char *)error_msg); + mch_errmsg(error_msg); mch_errmsg("\r\n"); } mch_errmsg("'"); @@ -1756,7 +1756,7 @@ set_termname(char_u *term) int termcap_cleared = FALSE; #endif int width = 0, height = 0; - char_u *error_msg = NULL; + char *error_msg = NULL; char_u *bs_p, *del_p; /* In silect mode (ex -s) we don't use the 'term' option. */ @@ -2191,7 +2191,7 @@ del_mouse_termcode( * Call tgetent() * Return error message if it fails, NULL if it's OK. */ - static char_u * + static char * tgetent_error(char_u *tbuf, char_u *term) { int i; @@ -2210,13 +2210,13 @@ tgetent_error(char_u *tbuf, char_u *term if (i < 0) # ifdef TGETENT_ZERO_ERR - return (char_u *)_("E557: Cannot open termcap file"); + return _("E557: Cannot open termcap file"); if (i == 0) # endif #ifdef TERMINFO - return (char_u *)_("E558: Terminal entry not found in terminfo"); + return _("E558: Terminal entry not found in terminfo"); #else - return (char_u *)_("E559: Terminal entry not found in termcap"); + return _("E559: Terminal entry not found in termcap"); #endif } return NULL; @@ -2282,7 +2282,7 @@ add_termcap_entry(char_u *name, int forc char_u tbuf[TBUFSZ]; char_u tstrbuf[TBUFSZ]; char_u *tp = tstrbuf; - char_u *error_msg = NULL; + char *error_msg = NULL; #endif /* @@ -2369,10 +2369,10 @@ add_termcap_entry(char_u *name, int forc { #ifdef HAVE_TGETENT if (error_msg != NULL) - EMSG(error_msg); + emsg(error_msg); else #endif - EMSG2(_("E436: No \"%s\" entry in termcap"), name); + semsg(_("E436: No \"%s\" entry in termcap"), name); } return FAIL; } @@ -3055,7 +3055,7 @@ ttest(int pairs) * MUST have "cm": cursor motion. */ if (*T_CM == NUL) - EMSG(_("E437: terminal capability \"cm\" required")); + emsg(_("E437: terminal capability \"cm\" required")); /* * if "cs" defined, use a scroll region, it's faster. @@ -6153,7 +6153,7 @@ replace_termcodes( if (STRNICMP(src, "", 5) == 0) { if (current_sctx.sc_sid <= 0) - EMSG(_(e_usingsid)); + emsg(_(e_usingsid)); else { src += 5; diff --git a/src/terminal.c b/src/terminal.c --- a/src/terminal.c +++ b/src/terminal.c @@ -377,7 +377,7 @@ term_start( || (!(opt->jo_set & JO_OUT_IO) && (opt->jo_set & JO_OUT_BUF)) || (!(opt->jo_set & JO_ERR_IO) && (opt->jo_set & JO_ERR_BUF))) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return NULL; } @@ -719,7 +719,7 @@ ex_terminal(exarg_T *eap) { if (*p) *p = NUL; - EMSG2(_("E181: Invalid attribute: %s"), cmd); + semsg(_("E181: Invalid attribute: %s"), cmd); goto theend; } cmd = skipwhite(p); @@ -3487,7 +3487,7 @@ init_vterm_ansi_colors(VTerm *vterm) && (var->di_tv.v_type != VAR_LIST || var->di_tv.vval.v_list == NULL || set_ansi_colors_list(vterm, var->di_tv.vval.v_list) == FAIL)) - EMSG2(_(e_invarg2), "g:terminal_ansi_colors"); + semsg(_(e_invarg2), "g:terminal_ansi_colors"); } #endif @@ -3914,7 +3914,7 @@ f_term_dumpwrite(typval_T *argvars, typv term = buf->b_term; if (term->tl_vterm == NULL) { - EMSG(_("E958: Job already finished")); + emsg(_("E958: Job already finished")); return; } @@ -3924,7 +3924,7 @@ f_term_dumpwrite(typval_T *argvars, typv if (argvars[2].v_type != VAR_DICT) { - EMSG(_(e_dictreq)); + emsg(_(e_dictreq)); return; } d = argvars[2].vval.v_dict; @@ -3940,13 +3940,13 @@ f_term_dumpwrite(typval_T *argvars, typv return; if (mch_stat((char *)fname, &st) >= 0) { - EMSG2(_("E953: File exists: %s"), fname); + semsg(_("E953: File exists: %s"), fname); return; } if (*fname == NUL || (fd = mch_fopen((char *)fname, WRITEBIN)) == NULL) { - EMSG2(_(e_notcreate), *fname == NUL ? (char_u *)_("") : fname); + semsg(_(e_notcreate), *fname == NUL ? (char_u *)_("") : fname); return; } @@ -4389,13 +4389,13 @@ term_load_dump(typval_T *argvars, typval fname2 = tv_get_string_buf_chk(&argvars[1], buf2); if (fname1 == NULL || (do_diff && fname2 == NULL)) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } fd1 = mch_fopen((char *)fname1, READBIN); if (fd1 == NULL) { - EMSG2(_(e_notread), fname1); + semsg(_(e_notread), fname1); return; } if (do_diff) @@ -4404,7 +4404,7 @@ term_load_dump(typval_T *argvars, typval if (fd2 == NULL) { fclose(fd1); - EMSG2(_(e_notread), fname2); + semsg(_(e_notread), fname2); return; } } @@ -4922,7 +4922,7 @@ f_term_setsize(typval_T *argvars UNUSED, if (buf == NULL) { - EMSG(_("E955: Not a terminal buffer")); + emsg(_("E955: Not a terminal buffer")); return; } if (buf->b_term->tl_vterm == NULL) @@ -5007,7 +5007,7 @@ f_term_gettty(typval_T *argvars, typval_ p = buf->b_term->tl_job->jv_tty_in; break; default: - EMSG2(_(e_invarg2), tv_get_string(&argvars[1])); + semsg(_(e_invarg2), tv_get_string(&argvars[1])); return; } if (p != NULL) @@ -5236,12 +5236,12 @@ f_term_setansicolors(typval_T *argvars, if (argvars[1].v_type != VAR_LIST || argvars[1].vval.v_list == NULL) { - EMSG(_(e_listreq)); + emsg(_(e_listreq)); return; } if (set_ansi_colors_list(term->tl_vterm, argvars[1].vval.v_list) == FAIL) - EMSG(_(e_invarg)); + emsg(_(e_invarg)); } #endif @@ -5485,7 +5485,7 @@ dyn_winpty_init(int verbose) if (!hWinPtyDLL) { if (verbose) - EMSG2(_(e_loadlib), *p_winptydll != NUL ? p_winptydll + semsg(_(e_loadlib), *p_winptydll != NUL ? p_winptydll : (char_u *)WINPTY_DLL); return FAIL; } @@ -5496,7 +5496,7 @@ dyn_winpty_init(int verbose) winpty_entry[i].name)) == NULL) { if (verbose) - EMSG2(_(e_loadfunc), winpty_entry[i].name); + semsg(_(e_loadfunc), winpty_entry[i].name); return FAIL; } } @@ -5548,7 +5548,7 @@ term_and_job_init( } if (cmd == NULL || *cmd == NUL) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); goto failed; } @@ -5680,7 +5680,7 @@ term_and_job_init( ch_log(channel, "Opening output file %s", fname); term->tl_out_fd = mch_fopen((char *)fname, WRITEBIN); if (term->tl_out_fd == NULL) - EMSG2(_(e_notopen), fname); + semsg(_(e_notopen), fname); } return OK; @@ -5713,7 +5713,7 @@ failed: char_u *msg = utf16_to_enc( (short_u *)winpty_error_msg(winpty_err), NULL); - EMSG(msg); + emsg(msg); winpty_error_free(winpty_err); } return FAIL; diff --git a/src/textprop.c b/src/textprop.c --- a/src/textprop.c +++ b/src/textprop.c @@ -19,7 +19,7 @@ * TODO: * - Adjust text property column and length when text is inserted/deleted. * -> a :substitute with a multi-line match - * -> search for changed_bytes() from ex_cmds.c + * -> search for changed_bytes() from misc1.c * - Perhaps we only need TP_FLAG_CONT_NEXT and can drop TP_FLAG_CONT_PREV? * - Add an arrray for global_proptypes, to quickly lookup a prop type by ID * - Add an arrray for b_proptypes, to quickly lookup a prop type by ID @@ -106,7 +106,7 @@ lookup_prop_type(char_u *name, buf_T *bu if (type == NULL) type = find_prop(name, NULL); if (type == NULL) - EMSG2(_(e_type_not_exist), name); + semsg(_(e_type_not_exist), name); return type; } @@ -124,7 +124,7 @@ get_bufnr_from_arg(typval_T *arg, buf_T if (arg->v_type != VAR_DICT) { - EMSG(_(e_dictreq)); + emsg(_(e_dictreq)); return FAIL; } if (arg->vval.v_dict == NULL) @@ -167,19 +167,19 @@ f_prop_add(typval_T *argvars, typval_T * start_col = tv_get_number(&argvars[1]); if (start_col < 1) { - EMSGN(_(e_invalid_col), (long)start_col); + semsg(_(e_invalid_col), (long)start_col); return; } if (argvars[2].v_type != VAR_DICT) { - EMSG(_(e_dictreq)); + emsg(_(e_dictreq)); return; } dict = argvars[2].vval.v_dict; if (dict == NULL || dict_find(dict, (char_u *)"type", -1) == NULL) { - EMSG(_("E965: missing property type name")); + emsg(_("E965: missing property type name")); return; } type_name = dict_get_string(dict, (char_u *)"type", FALSE); @@ -189,7 +189,7 @@ f_prop_add(typval_T *argvars, typval_T * end_lnum = dict_get_number(dict, (char_u *)"end_lnum"); if (end_lnum < start_lnum) { - EMSG2(_(e_invargval), "end_lnum"); + semsg(_(e_invargval), "end_lnum"); return; } } @@ -202,7 +202,7 @@ f_prop_add(typval_T *argvars, typval_T * if (length < 0 || end_lnum > start_lnum) { - EMSG2(_(e_invargval), "length"); + semsg(_(e_invargval), "length"); return; } end_col = start_col + length; @@ -212,7 +212,7 @@ f_prop_add(typval_T *argvars, typval_T * end_col = dict_get_number(dict, (char_u *)"end_col"); if (end_col <= 0) { - EMSG2(_(e_invargval), "end_col"); + semsg(_(e_invargval), "end_col"); return; } } @@ -233,12 +233,12 @@ f_prop_add(typval_T *argvars, typval_T * if (start_lnum < 1 || start_lnum > buf->b_ml.ml_line_count) { - EMSGN(_(e_invalid_lnum), (long)start_lnum); + semsg(_(e_invalid_lnum), (long)start_lnum); return; } if (end_lnum < start_lnum || end_lnum > buf->b_ml.ml_line_count) { - EMSGN(_(e_invalid_lnum), (long)end_lnum); + semsg(_(e_invalid_lnum), (long)end_lnum); return; } @@ -257,7 +257,7 @@ f_prop_add(typval_T *argvars, typval_T * col = 1; if (col - 1 > (colnr_T)textlen) { - EMSGN(_(e_invalid_col), (long)start_col); + semsg(_(e_invalid_col), (long)start_col); return; } @@ -340,7 +340,7 @@ get_text_props(buf_T *buf, linenr_T lnum proplen = buf->b_ml.ml_line_len - textlen; if (proplen % sizeof(textprop_T) != 0) { - IEMSG(_("E967: text property info corrupted")); + iemsg(_("E967: text property info corrupted")); return 0; } if (proplen > 0) @@ -440,7 +440,7 @@ f_prop_clear(typval_T *argvars, typval_T } if (start < 1 || end < 1) { - EMSG(_(e_invrange)); + emsg(_(e_invrange)); return; } @@ -487,7 +487,7 @@ f_prop_list(typval_T *argvars, typval_T } if (lnum < 1 || lnum > buf->b_ml.ml_line_count) { - EMSG(_(e_invrange)); + emsg(_(e_invrange)); return; } @@ -542,7 +542,7 @@ f_prop_remove(typval_T *argvars, typval_ rettv->vval.v_number = 0; if (argvars[0].v_type != VAR_DICT || argvars[0].vval.v_dict == NULL) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } @@ -554,7 +554,7 @@ f_prop_remove(typval_T *argvars, typval_ end = tv_get_number(&argvars[2]); if (start < 1 || end < 1) { - EMSG(_(e_invrange)); + emsg(_(e_invrange)); return; } } @@ -585,7 +585,7 @@ f_prop_remove(typval_T *argvars, typval_ } if (id == -1 && type_id == -1) { - EMSG(_("E968: Need at least one of 'id' or 'type'")); + emsg(_("E968: Need at least one of 'id' or 'type'")); return; } @@ -661,7 +661,7 @@ prop_type_set(typval_T *argvars, int add name = tv_get_string(&argvars[0]); if (*name == NUL) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } @@ -676,7 +676,7 @@ prop_type_set(typval_T *argvars, int add if (prop != NULL) { - EMSG2(_("E969: Property type %s already defined"), name); + semsg(_("E969: Property type %s already defined"), name); return; } prop = (proptype_T *)alloc_clear((int)(sizeof(proptype_T) + STRLEN(name))); @@ -701,7 +701,7 @@ prop_type_set(typval_T *argvars, int add { if (prop == NULL) { - EMSG2(_(e_type_not_exist), name); + semsg(_(e_type_not_exist), name); return; } } @@ -719,7 +719,7 @@ prop_type_set(typval_T *argvars, int add hl_id = syn_name2id(highlight); if (hl_id <= 0) { - EMSG2(_("E970: Unknown highlight group name: '%s'"), + semsg(_("E970: Unknown highlight group name: '%s'"), highlight == NULL ? (char_u *)"" : highlight); return; } @@ -781,7 +781,7 @@ f_prop_type_delete(typval_T *argvars, ty name = tv_get_string(&argvars[0]); if (*name == NUL) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } @@ -816,7 +816,7 @@ f_prop_type_get(typval_T *argvars, typva if (*name == NUL) { - EMSG(_(e_invarg)); + emsg(_(e_invarg)); return; } if (rettv_dict_alloc(rettv) == OK) diff --git a/src/ui.c b/src/ui.c --- a/src/ui.c +++ b/src/ui.c @@ -337,7 +337,7 @@ ui_suspend(void) suspend_shell(void) { if (*p_sh == NUL) - EMSG(_(e_shellempty)); + emsg(_(e_shellempty)); else { MSG_PUTS(_("new shell started\n")); diff --git a/src/undo.c b/src/undo.c --- a/src/undo.c +++ b/src/undo.c @@ -158,30 +158,30 @@ u_check_tree(u_header_T *uhp, ++header_count; if (uhp == curbuf->b_u_curhead && ++seen_b_u_curhead > 1) { - EMSG("b_u_curhead found twice (looping?)"); + emsg("b_u_curhead found twice (looping?)"); return; } if (uhp == curbuf->b_u_newhead && ++seen_b_u_newhead > 1) { - EMSG("b_u_newhead found twice (looping?)"); + emsg("b_u_newhead found twice (looping?)"); return; } if (uhp->uh_magic != UH_MAGIC) - EMSG("uh_magic wrong (may be using freed memory)"); + emsg("uh_magic wrong (may be using freed memory)"); else { /* Check pointers back are correct. */ if (uhp->uh_next.ptr != exp_uh_next) { - EMSG("uh_next wrong"); - smsg((char_u *)"expected: 0x%x, actual: 0x%x", + emsg("uh_next wrong"); + smsg("expected: 0x%x, actual: 0x%x", exp_uh_next, uhp->uh_next.ptr); } if (uhp->uh_alt_prev.ptr != exp_uh_alt_prev) { - EMSG("uh_alt_prev wrong"); - smsg((char_u *)"expected: 0x%x, actual: 0x%x", + emsg("uh_alt_prev wrong"); + smsg("expected: 0x%x, actual: 0x%x", exp_uh_alt_prev, uhp->uh_alt_prev.ptr); } @@ -190,7 +190,7 @@ u_check_tree(u_header_T *uhp, { if (uep->ue_magic != UE_MAGIC) { - EMSG("ue_magic wrong (may be using freed memory)"); + emsg("ue_magic wrong (may be using freed memory)"); break; } } @@ -214,13 +214,13 @@ u_check(int newhead_may_be_NULL) if (seen_b_u_newhead == 0 && curbuf->b_u_oldhead != NULL && !(newhead_may_be_NULL && curbuf->b_u_newhead == NULL)) - EMSGN("b_u_newhead invalid: 0x%x", curbuf->b_u_newhead); + semsg("b_u_newhead invalid: 0x%x", curbuf->b_u_newhead); if (curbuf->b_u_curhead != NULL && seen_b_u_curhead == 0) - EMSGN("b_u_curhead invalid: 0x%x", curbuf->b_u_curhead); + semsg("b_u_curhead invalid: 0x%x", curbuf->b_u_curhead); if (header_count != curbuf->b_u_numhead) { - EMSG("b_u_numhead invalid"); - smsg((char_u *)"expected: %ld, actual: %ld", + emsg("b_u_numhead invalid"); + smsg("expected: %ld, actual: %ld", (long)header_count, (long)curbuf->b_u_numhead); } } @@ -316,7 +316,7 @@ undo_allowed(void) /* Don't allow changes when 'modifiable' is off. */ if (!curbuf->b_p_ma) { - EMSG(_(e_modifiable)); + emsg(_(e_modifiable)); return FALSE; } @@ -324,7 +324,7 @@ undo_allowed(void) /* In the sandbox it's not allowed to change the text. */ if (sandbox != 0) { - EMSG(_(e_sandbox)); + emsg(_(e_sandbox)); return FALSE; } #endif @@ -333,7 +333,7 @@ undo_allowed(void) * caller of getcmdline() may get confused. */ if (textlock != 0) { - EMSG(_(e_secure)); + emsg(_(e_secure)); return FALSE; } @@ -413,12 +413,12 @@ u_savecommon( { if (netbeans_is_guarded(top, bot)) { - EMSG(_(e_guarded)); + emsg(_(e_guarded)); return FAIL; } if (curbuf->b_p_ro) { - EMSG(_(e_nbreadonly)); + emsg(_(e_nbreadonly)); return FAIL; } } @@ -439,7 +439,7 @@ u_savecommon( { /* This happens when the FileChangedRO autocommand changes the * file in a way it becomes shorter. */ - EMSG(_("E881: Line count changed unexpectedly")); + emsg(_("E881: Line count changed unexpectedly")); return FAIL; } } @@ -861,7 +861,7 @@ u_get_undo_file_name(char_u *buf_ffname, static void corruption_error(char *mesg, char_u *file_name) { - EMSG3(_("E825: Corrupted undo file (%s): %s"), mesg, file_name); + semsg(_("E825: Corrupted undo file (%s): %s"), mesg, file_name); } static void @@ -1553,7 +1553,7 @@ u_write_undo( if (p_verbose > 0) { verbose_enter(); - smsg((char_u *) + smsg( _("Cannot write undo file in any directory in 'undodir'")); verbose_leave(); } @@ -1601,7 +1601,7 @@ u_write_undo( { if (name == NULL) verbose_enter(); - smsg((char_u *) + smsg( _("Will not overwrite with undo file, cannot read: %s"), file_name); if (name == NULL) @@ -1623,7 +1623,7 @@ u_write_undo( { if (name == NULL) verbose_enter(); - smsg((char_u *) + smsg( _("Will not overwrite, this is not an undo file: %s"), file_name); if (name == NULL) @@ -1649,14 +1649,14 @@ u_write_undo( O_CREAT|O_EXTRA|O_WRONLY|O_EXCL|O_NOFOLLOW, perm); if (fd < 0) { - EMSG2(_(e_not_open), file_name); + semsg(_(e_not_open), file_name); goto theend; } (void)mch_setperm(file_name, perm); if (p_verbose > 0) { verbose_enter(); - smsg((char_u *)_("Writing undo file: %s"), file_name); + smsg(_("Writing undo file: %s"), file_name); verbose_leave(); } @@ -1688,7 +1688,7 @@ u_write_undo( fp = fdopen(fd, "w"); if (fp == NULL) { - EMSG2(_(e_not_open), file_name); + semsg(_(e_not_open), file_name); close(fd); mch_remove(file_name); goto theend; @@ -1743,8 +1743,8 @@ u_write_undo( #ifdef U_DEBUG if (headers_written != buf->b_u_numhead) { - EMSGN("Written %ld headers, ...", headers_written); - EMSGN("... but numhead is %ld", buf->b_u_numhead); + semsg("Written %ld headers, ...", headers_written); + semsg("... but numhead is %ld", buf->b_u_numhead); } #endif @@ -1756,7 +1756,7 @@ u_write_undo( write_error: fclose(fp); if (!write_ok) - EMSG2(_("E829: write error in undo file: %s"), file_name); + semsg(_("E829: write error in undo file: %s"), file_name); #if defined(WIN3264) /* Copy file attributes; for systems where this can only be done after @@ -1846,7 +1846,7 @@ u_read_undo(char_u *name, char_u *hash, if (p_verbose > 0) { verbose_enter(); - smsg((char_u *)_("Not reading undo file, owner differs: %s"), + smsg(_("Not reading undo file, owner differs: %s"), file_name); verbose_leave(); } @@ -1860,7 +1860,7 @@ u_read_undo(char_u *name, char_u *hash, if (p_verbose > 0) { verbose_enter(); - smsg((char_u *)_("Reading undo file: %s"), file_name); + smsg(_("Reading undo file: %s"), file_name); verbose_leave(); } @@ -1868,7 +1868,7 @@ u_read_undo(char_u *name, char_u *hash, if (fp == NULL) { if (name != NULL || p_verbose > 0) - EMSG2(_("E822: Cannot open undo file for reading: %s"), file_name); + semsg(_("E822: Cannot open undo file for reading: %s"), file_name); goto error; } bi.bi_buf = curbuf; @@ -1880,7 +1880,7 @@ u_read_undo(char_u *name, char_u *hash, if (fread(magic_buf, UF_START_MAGIC_LEN, 1, fp) != 1 || memcmp(magic_buf, UF_START_MAGIC, UF_START_MAGIC_LEN) != 0) { - EMSG2(_("E823: Not an undo file: %s"), file_name); + semsg(_("E823: Not an undo file: %s"), file_name); goto error; } version = get2c(fp); @@ -1889,14 +1889,14 @@ u_read_undo(char_u *name, char_u *hash, #ifdef FEAT_CRYPT if (*curbuf->b_p_key == NUL) { - EMSG2(_("E832: Non-encrypted file has encrypted undo file: %s"), + semsg(_("E832: Non-encrypted file has encrypted undo file: %s"), file_name); goto error; } bi.bi_state = crypt_create_from_file(fp, curbuf->b_p_key); if (bi.bi_state == NULL) { - EMSG2(_("E826: Undo file decryption failed: %s"), file_name); + semsg(_("E826: Undo file decryption failed: %s"), file_name); goto error; } if (crypt_whole_undofile(bi.bi_state->method_nr)) @@ -1912,13 +1912,13 @@ u_read_undo(char_u *name, char_u *hash, bi.bi_used = 0; } #else - EMSG2(_("E827: Undo file is encrypted: %s"), file_name); + semsg(_("E827: Undo file is encrypted: %s"), file_name); goto error; #endif } else if (version != UF_VERSION) { - EMSG2(_("E824: Incompatible undo file: %s"), file_name); + semsg(_("E824: Incompatible undo file: %s"), file_name); goto error; } @@ -2122,13 +2122,13 @@ u_read_undo(char_u *name, char_u *hash, #ifdef U_DEBUG for (i = 0; i < num_head; ++i) if (uhp_table_used[i] == 0) - EMSGN("uhp_table entry %ld not used, leaking memory", i); + semsg("uhp_table entry %ld not used, leaking memory", i); vim_free(uhp_table_used); u_check(TRUE); #endif if (name != NULL) - smsg((char_u *)_("Finished reading undo file %s"), file_name); + smsg(_("Finished reading undo file %s"), file_name); goto theend; error: @@ -2488,7 +2488,7 @@ undo_time( if (absolute) { - EMSGN(_("E830: Undo number %ld not found"), step); + semsg(_("E830: Undo number %ld not found"), step); return; } @@ -2678,7 +2678,7 @@ u_undoredo(int undo) || bot > curbuf->b_ml.ml_line_count + 1) { unblock_autocmds(); - IEMSG(_("E438: u_undo: line numbers wrong")); + iemsg(_("E438: u_undo: line numbers wrong")); changed(); /* don't want UNCHANGED now */ return; } @@ -2988,7 +2988,7 @@ u_undo_end( } #endif - smsg_attr_keep(0, (char_u *)_("%ld %s; %s #%ld %s"), + smsg_attr_keep(0, _("%ld %s; %s #%ld %s"), u_oldcount < 0 ? -u_oldcount : u_oldcount, _(msgstr), did_undo ? _("before") : _("after"), @@ -3165,7 +3165,7 @@ ex_undojoin(exarg_T *eap UNUSED) return; /* nothing changed before */ if (curbuf->b_u_curhead != NULL) { - EMSG(_("E790: undojoin is not allowed after undo")); + emsg(_("E790: undojoin is not allowed after undo")); return; } if (!curbuf->b_u_synced) @@ -3270,7 +3270,7 @@ u_get_headentry(void) { if (curbuf->b_u_newhead == NULL || curbuf->b_u_newhead->uh_entry == NULL) { - IEMSG(_("E439: undo list corrupt")); + iemsg(_("E439: undo list corrupt")); return NULL; } return curbuf->b_u_newhead->uh_entry; @@ -3302,7 +3302,7 @@ u_getbot(void) uep->ue_bot = uep->ue_top + uep->ue_size + 1 + extra; if (uep->ue_bot < 1 || uep->ue_bot > curbuf->b_ml.ml_line_count) { - IEMSG(_("E440: undo line missing")); + iemsg(_("E440: undo line missing")); uep->ue_bot = uep->ue_top + 1; /* assume all lines deleted, will * get all the old lines back * without deleting the current diff --git a/src/userfunc.c b/src/userfunc.c --- a/src/userfunc.c +++ b/src/userfunc.c @@ -119,7 +119,7 @@ get_function_args( || (p - arg == 8 && STRNCMP(arg, "lastline", 8) == 0)) { if (!skip) - EMSG2(_("E125: Illegal argument: %s"), arg); + semsg(_("E125: Illegal argument: %s"), arg); break; } if (newargs != NULL && ga_grow(newargs, 1) == FAIL) @@ -139,7 +139,7 @@ get_function_args( for (i = 0; i < newargs->ga_len; ++i) if (STRCMP(((char_u **)(newargs->ga_data))[i], arg) == 0) { - EMSG2(_("E853: Duplicate argument name: %s"), arg); + semsg(_("E853: Duplicate argument name: %s"), arg); vim_free(arg); goto err_ret; } @@ -157,7 +157,7 @@ get_function_args( if (mustend && *p != endchar) { if (!skip) - EMSG2(_(e_invarg2), *argp); + semsg(_(e_invarg2), *argp); break; } } @@ -386,7 +386,7 @@ emsg_funcname(char *ermsg, char_u *name) p = concat_str((char_u *)"", name + 3); else p = name; - EMSG2(_(ermsg), p); + semsg(_(ermsg), p); if (p != name) vim_free(p); } @@ -713,7 +713,7 @@ call_user_func( /* If depth of calling is getting too high, don't execute the function */ if (depth >= p_mfd) { - EMSG(_("E132: Function call depth is higher than 'maxfuncdepth'")); + emsg(_("E132: Function call depth is higher than 'maxfuncdepth'")); rettv->v_type = VAR_NUMBER; rettv->vval.v_number = -1; return; @@ -885,7 +885,7 @@ call_user_func( ++no_wait_return; verbose_enter_scroll(); - smsg((char_u *)_("calling %s"), sourcing_name); + smsg(_("calling %s"), sourcing_name); if (p_verbose >= 14) { char_u buf[MSG_BUF_LEN]; @@ -990,9 +990,9 @@ call_user_func( verbose_enter_scroll(); if (aborting()) - smsg((char_u *)_("%s aborted"), sourcing_name); + smsg(_("%s aborted"), sourcing_name); else if (fc->rettv->v_type == VAR_NUMBER) - smsg((char_u *)_("%s returning #%ld"), sourcing_name, + smsg(_("%s returning #%ld"), sourcing_name, (long)fc->rettv->vval.v_number); else { @@ -1014,7 +1014,7 @@ call_user_func( trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN); s = buf; } - smsg((char_u *)_("%s returning %s"), sourcing_name, s); + smsg(_("%s returning %s"), sourcing_name, s); vim_free(tofree); } } @@ -1040,7 +1040,7 @@ call_user_func( ++no_wait_return; verbose_enter_scroll(); - smsg((char_u *)_("continuing in %s"), sourcing_name); + smsg(_("continuing in %s"), sourcing_name); msg_puts((char_u *)"\n"); /* don't overwrite this either */ verbose_leave_scroll(); @@ -1194,7 +1194,7 @@ save_funccal(funccal_entry_T *entry) restore_funccal(void) { if (funccal_stack == NULL) - IEMSG("INTERNAL: restore_funccal()"); + iemsg("INTERNAL: restore_funccal()"); else { current_funccal = funccal_stack->top_funccal; @@ -1312,7 +1312,7 @@ func_call( { if (argc == MAX_FUNC_ARGS - (partial == NULL ? 0 : partial->pt_argc)) { - EMSG(_("E699: Too many arguments")); + emsg(_("E699: Too many arguments")); break; } /* Make a copy of each argument. This is needed to be able to set @@ -1660,7 +1660,7 @@ trans_function_name( if (end == start) { if (!skip) - EMSG(_("E129: Function name required")); + emsg(_("E129: Function name required")); goto theend; } if (end == NULL || (lv.ll_tv != NULL && (lead > 2 || lv.ll_range))) @@ -1673,7 +1673,7 @@ trans_function_name( if (!aborting()) { if (end != NULL) - EMSG2(_(e_invarg2), start); + semsg(_(e_invarg2), start); } else *pp = find_name_end(start, NULL, NULL, FNE_INCL_BR); @@ -1706,7 +1706,7 @@ trans_function_name( { if (!skip && !(flags & TFN_QUIET) && (fdp == NULL || lv.ll_dict == NULL || fdp->fd_newkey == NULL)) - EMSG(_(e_funcref)); + emsg(_(e_funcref)); else *pp = end; name = NULL; @@ -1789,7 +1789,7 @@ trans_function_name( /* It's "s:" or "" */ if (current_sctx.sc_sid <= 0) { - EMSG(_(e_usingsid)); + emsg(_(e_usingsid)); goto theend; } sprintf((char *)sid_buf, "%ld_", (long)current_sctx.sc_sid); @@ -1798,7 +1798,7 @@ trans_function_name( } else if (!(flags & TFN_INT) && builtin_function(lv.ll_name, len)) { - EMSG2(_("E128: Function name must start with a capital or \"s:\": %s"), + semsg(_("E128: Function name must start with a capital or \"s:\": %s"), start); goto theend; } @@ -1808,7 +1808,7 @@ trans_function_name( if (cp != NULL && cp < end) { - EMSG2(_("E884: Function name cannot contain a colon: %s"), start); + semsg(_("E884: Function name cannot contain a colon: %s"), start); goto theend; } } @@ -1961,7 +1961,7 @@ ex_function(exarg_T *eap) if (!aborting()) { if (!eap->skip && fudi.fd_newkey != NULL) - EMSG2(_(e_dictkey), fudi.fd_newkey); + semsg(_(e_dictkey), fudi.fd_newkey); vim_free(fudi.fd_newkey); return; } @@ -1981,7 +1981,7 @@ ex_function(exarg_T *eap) { if (!ends_excmd(*skipwhite(p))) { - EMSG(_(e_trailing)); + emsg(_(e_trailing)); goto ret_free; } eap->nextcmd = check_nextcmd(p); @@ -2027,7 +2027,7 @@ ex_function(exarg_T *eap) { if (!eap->skip) { - EMSG2(_("E124: Missing '(': %s"), eap->arg); + semsg(_("E124: Missing '(': %s"), eap->arg); goto ret_free; } /* attempt to continue by skipping some text */ @@ -2062,7 +2062,7 @@ ex_function(exarg_T *eap) } /* Disallow using the g: dict. */ if (fudi.fd_dict != NULL && fudi.fd_dict->dv_scope == VAR_DEF_SCOPE) - EMSG(_("E862: Cannot use g: here")); + emsg(_("E862: Cannot use g: here")); } if (get_function_args(&p, ')', &newargs, &varargs, eap->skip) == FAIL) @@ -2107,7 +2107,7 @@ ex_function(exarg_T *eap) if (*p == '\n') line_arg = p + 1; else if (*p != NUL && *p != '"' && !eap->skip && !did_emsg) - EMSG(_(e_trailing)); + emsg(_(e_trailing)); /* * Read the body of the function, until ":endfunction" is found. @@ -2120,7 +2120,7 @@ ex_function(exarg_T *eap) if (!eap->skip && !eap->forceit) { if (fudi.fd_dict != NULL && fudi.fd_newkey == NULL) - EMSG(_(e_funcdict)); + emsg(_(e_funcdict)); else if (name != NULL && find_func(name) != NULL) emsg_funcname(e_funcexts, name); } @@ -2170,7 +2170,7 @@ ex_function(exarg_T *eap) lines_left = Rows - 1; if (theline == NULL) { - EMSG(_("E126: Missing :endfunction")); + emsg(_("E126: Missing :endfunction")); goto erret; } @@ -2374,7 +2374,7 @@ ex_function(exarg_T *eap) fp = NULL; if (fudi.fd_newkey == NULL && !eap->forceit) { - EMSG(_(e_funcdict)); + emsg(_(e_funcdict)); goto erret; } if (fudi.fd_di == NULL) @@ -2421,7 +2421,7 @@ ex_function(exarg_T *eap) } if (j == FAIL) { - EMSG2(_("E746: Function name does not match script file name: %s"), name); + semsg(_("E746: Function name does not match script file name: %s"), name); goto erret; } } @@ -2876,13 +2876,13 @@ ex_delfunction(exarg_T *eap) if (name == NULL) { if (fudi.fd_dict != NULL && !eap->skip) - EMSG(_(e_funcref)); + emsg(_(e_funcref)); return; } if (!ends_excmd(*skipwhite(p))) { vim_free(name); - EMSG(_(e_trailing)); + emsg(_(e_trailing)); return; } eap->nextcmd = check_nextcmd(p); @@ -2898,12 +2898,12 @@ ex_delfunction(exarg_T *eap) if (fp == NULL) { if (!eap->forceit) - EMSG2(_(e_nofunc), eap->arg); + semsg(_(e_nofunc), eap->arg); return; } if (fp->uf_calls > 0) { - EMSG2(_("E131: Cannot delete function %s: It is in use"), eap->arg); + semsg(_("E131: Cannot delete function %s: It is in use"), eap->arg); return; } @@ -3032,7 +3032,7 @@ ex_return(exarg_T *eap) if (current_funccal == NULL) { - EMSG(_("E133: :return not inside a function")); + emsg(_("E133: :return not inside a function")); return; } @@ -3108,7 +3108,7 @@ ex_call(exarg_T *eap) if (fudi.fd_newkey != NULL) { /* Still need to give an error message for missing key. */ - EMSG2(_(e_dictkey), fudi.fd_newkey); + semsg(_(e_dictkey), fudi.fd_newkey); vim_free(fudi.fd_newkey); } if (tofree == NULL) @@ -3133,7 +3133,7 @@ ex_call(exarg_T *eap) if (*startarg != '(') { - EMSG2(_("E107: Missing parentheses: %s"), eap->arg); + semsg(_("E107: Missing parentheses: %s"), eap->arg); goto end; } @@ -3158,7 +3158,7 @@ ex_call(exarg_T *eap) { // If the function deleted lines or switched to another buffer // the line number may become invalid. - EMSG(_(e_invrange)); + emsg(_(e_invrange)); break; } curwin->w_cursor.lnum = lnum; @@ -3205,7 +3205,7 @@ ex_call(exarg_T *eap) if (!ends_excmd(*arg)) { emsg_severe = TRUE; - EMSG(_(e_trailing)); + emsg(_(e_trailing)); } else eap->nextcmd = check_nextcmd(arg); @@ -3267,7 +3267,7 @@ do_return( if ((cstack->cs_rettv[idx] = alloc_tv()) != NULL) *(typval_T *)cstack->cs_rettv[idx] = *(typval_T *)rettv; else - EMSG(_(e_outofmem)); + emsg(_(e_outofmem)); } else cstack->cs_rettv[idx] = NULL; diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -796,6 +796,10 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 743, +/**/ + 743, +/**/ 742, /**/ 741, diff --git a/src/vim.h b/src/vim.h --- a/src/vim.h +++ b/src/vim.h @@ -1625,14 +1625,6 @@ typedef UINT32_TYPEDEF UINT32_T; #define MSG(s) msg((char_u *)(s)) #define MSG_ATTR(s, attr) msg_attr((char_u *)(s), (attr)) -#define EMSG(s) emsg((char_u *)(s)) -#define EMSG2(s, p) emsg2((char_u *)(s), (char_u *)(p)) -#define EMSG3(s, p, q) emsg3((char_u *)(s), (char_u *)(p), (char_u *)(q)) -#define EMSGN(s, n) emsgn((char_u *)(s), (long)(n)) -#define EMSGU(s, n) emsgu((char_u *)(s), (long_u)(n)) -#define IEMSG(s) iemsg((char_u *)(s)) -#define IEMSG2(s, p) iemsg2((char_u *)(s), (char_u *)(p)) -#define IEMSGN(s, n) iemsgn((char_u *)(s), (long)(n)) #define OUT_STR(s) out_str((char_u *)(s)) #define OUT_STR_NF(s) out_str_nf((char_u *)(s)) #define MSG_PUTS(s) msg_puts((char_u *)(s)) @@ -1676,10 +1668,10 @@ typedef UINT32_TYPEDEF UINT32_T; # define GUI_GET_COLOR GUI_FUNCTION(get_color) #endif -/* Prefer using emsg3(), because perror() may send the output to the wrong +/* Prefer using emsgf(), because perror() may send the output to the wrong * destination and mess up the screen. */ #ifdef HAVE_STRERROR -# define PERROR(msg) (void)emsg3((char_u *)"%s: %s", (char_u *)msg, (char_u *)strerror(errno)) +# define PERROR(msg) (void)semsg("%s: %s", (char *)msg, strerror(errno)) #else # define PERROR(msg) do_perror(msg) #endif diff --git a/src/window.c b/src/window.c --- a/src/window.c +++ b/src/window.c @@ -101,7 +101,7 @@ do_window( do { \ if (cmdwin_type != 0) \ { \ - EMSG(_(e_cmdwin)); \ + emsg(_(e_cmdwin)); \ return; \ } \ } while (0) @@ -156,9 +156,9 @@ do_window( ? curwin->w_alt_fnum : Prenum) == NULL) { if (Prenum == 0) - EMSG(_(e_noalt)); + emsg(_(e_noalt)); else - EMSGN(_("E92: Buffer %ld not found"), Prenum); + semsg(_("E92: Buffer %ld not found"), Prenum); break; } @@ -220,7 +220,7 @@ newwindow: if (wp->w_p_pvw) break; if (wp == NULL) - EMSG(_("E441: There is no preview window")); + emsg(_("E441: There is no preview window")); else win_goto(wp); break; @@ -739,7 +739,7 @@ win_split(int size, int flags) flags |= cmdmod.split; if ((flags & WSP_TOP) && (flags & WSP_BOT)) { - EMSG(_("E442: Can't split topleft and botright at the same time")); + emsg(_("E442: Can't split topleft and botright at the same time")); return FAIL; } @@ -794,7 +794,7 @@ win_split_ins( { if (VISIBLE_HEIGHT(oldwin) <= p_wmh && new_wp == NULL) { - EMSG(_(e_noroom)); + emsg(_(e_noroom)); return FAIL; } need_status = STATUS_HEIGHT; @@ -852,7 +852,7 @@ win_split_ins( } if (available < needed && new_wp == NULL) { - EMSG(_(e_noroom)); + emsg(_(e_noroom)); return FAIL; } if (new_size == 0) @@ -935,7 +935,7 @@ win_split_ins( } if (available < needed && new_wp == NULL) { - EMSG(_(e_noroom)); + emsg(_(e_noroom)); return FAIL; } oldwin_height = oldwin->w_height; @@ -1606,7 +1606,7 @@ win_rotate(int upwards, int count) FOR_ALL_FRAMES(frp, curwin->w_frame->fr_parent->fr_child) if (frp->fr_win == NULL) { - EMSG(_("E443: Cannot rotate when another window is split")); + emsg(_("E443: Cannot rotate when another window is split")); return; } @@ -2309,7 +2309,7 @@ win_close(win_T *win, int free_buf) if (last_window()) { - EMSG(_("E444: Cannot close last window")); + emsg(_("E444: Cannot close last window")); return FAIL; } @@ -2318,12 +2318,12 @@ win_close(win_T *win, int free_buf) return FAIL; /* window is already being closed */ if (win == aucmd_win) { - EMSG(_("E813: Cannot close autocmd window")); + emsg(_("E813: Cannot close autocmd window")); return FAIL; } if ((firstwin == aucmd_win || lastwin == aucmd_win) && one_window()) { - EMSG(_("E814: Cannot close window, only autocmd window would remain")); + emsg(_("E814: Cannot close window, only autocmd window would remain")); return FAIL; } @@ -3419,7 +3419,7 @@ close_others( } if (message && !ONE_WINDOW) - EMSG(_("E445: Other window contains changes")); + emsg(_("E445: Other window contains changes")); } /* @@ -5447,7 +5447,7 @@ win_setminheight(void) --p_wmh; if (first) { - EMSG(_(e_noroom)); + emsg(_(e_noroom)); first = FALSE; } } @@ -5473,7 +5473,7 @@ win_setminwidth(void) --p_wmw; if (first) { - EMSG(_(e_noroom)); + emsg(_(e_noroom)); first = FALSE; } } @@ -5950,7 +5950,7 @@ command_height(void) { if (frp == NULL) { - EMSG(_(e_noroom)); + emsg(_(e_noroom)); p_ch = old_p_ch; curtab->tp_ch_used = p_ch; cmdline_row = Rows - p_ch; @@ -6041,7 +6041,7 @@ last_status_rec(frame_T *fr, int statusl { if (fp == topframe) { - EMSG(_(e_noroom)); + emsg(_(e_noroom)); return; } /* In a column of frames: go to frame above. If already at @@ -6170,7 +6170,7 @@ file_name_in_line( if (*ptr == NUL) /* nothing found */ { if (options & FNAME_MESS) - EMSG(_("E446: No file name under cursor")); + emsg(_("E446: No file name under cursor")); return NULL; } @@ -6319,7 +6319,7 @@ find_file_name_in_path( { c = ptr[len]; ptr[len] = NUL; - EMSG2(_("E447: Can't find file \"%s\" in path"), ptr); + semsg(_("E447: Can't find file \"%s\" in path"), ptr); ptr[len] = c; } @@ -6782,7 +6782,7 @@ match_add( return -1; if (id < -1 || id == 0) { - EMSGN(_("E799: Invalid ID: %ld (must be greater than or equal to 1)"), id); + semsg(_("E799: Invalid ID: %ld (must be greater than or equal to 1)"), id); return -1; } if (id != -1) @@ -6792,7 +6792,7 @@ match_add( { if (cur->id == id) { - EMSGN(_("E801: ID already taken: %ld"), id); + semsg(_("E801: ID already taken: %ld"), id); return -1; } cur = cur->next; @@ -6800,12 +6800,12 @@ match_add( } if ((hlg_id = syn_namen2id(grp, (int)STRLEN(grp))) == 0) { - EMSG2(_(e_nogroup), grp); + semsg(_(e_nogroup), grp); return -1; } if (pat != NULL && (regprog = vim_regcomp(pat, RE_MAGIC)) == NULL) { - EMSG2(_(e_invarg2), pat); + semsg(_(e_invarg2), pat); return -1; } @@ -6900,7 +6900,7 @@ match_add( } else { - EMSG(_("List or number required")); + emsg(_("List or number required")); goto fail; } if (toplnum == 0 || lnum < toplnum) @@ -6969,7 +6969,7 @@ match_delete(win_T *wp, int id, int perr if (id < 1) { if (perr == TRUE) - EMSGN(_("E802: Invalid ID: %ld (must be greater than or equal to 1)"), + semsg(_("E802: Invalid ID: %ld (must be greater than or equal to 1)"), id); return -1; } @@ -6981,7 +6981,7 @@ match_delete(win_T *wp, int id, int perr if (cur == NULL) { if (perr == TRUE) - EMSGN(_("E803: ID not found: %ld"), id); + semsg(_("E803: ID not found: %ld"), id); return -1; } if (cur == prev)