Mercurial > vim
comparison src/mbyte.c @ 15470:55ccc2d353bd v8.1.0743
patch 8.1.0743: giving error messages is not flexible
commit https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jan 13 23:38:42 2019 +0100
patch 8.1.0743: giving error messages is not flexible
Problem: Giving error messages is not flexible.
Solution: Add semsg(). Change argument from "char_u *" to "char *", also
for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes
#3302) Also make emsg() accept a "char *" argument. Get rid of
an enormous number of type casts.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 13 Jan 2019 23:45:08 +0100 |
parents | 27b9a84395b5 |
children | 79e3dcc5aa50 |
comparison
equal
deleted
inserted
replaced
15469:bc9b5261ed01 | 15470:55ccc2d353bd |
---|---|
197 if (fd == NULL) | 197 if (fd == NULL) |
198 { | 198 { |
199 fd = mch_fopen("xim.log", "w"); | 199 fd = mch_fopen("xim.log", "w"); |
200 if (fd == NULL) | 200 if (fd == NULL) |
201 { | 201 { |
202 EMSG("Cannot open xim.log"); | 202 emsg("Cannot open xim.log"); |
203 fd = (FILE *)-1; | 203 fd = (FILE *)-1; |
204 return; | 204 return; |
205 } | 205 } |
206 } | 206 } |
207 | 207 |
507 * Sets the "enc_unicode", "enc_utf8", "enc_dbcs" and "has_mbyte" flags. | 507 * Sets the "enc_unicode", "enc_utf8", "enc_dbcs" and "has_mbyte" flags. |
508 * Fills mb_bytelen_tab[] and returns NULL when there are no problems. | 508 * Fills mb_bytelen_tab[] and returns NULL when there are no problems. |
509 * When there is something wrong: Returns an error message and doesn't change | 509 * When there is something wrong: Returns an error message and doesn't change |
510 * anything. | 510 * anything. |
511 */ | 511 */ |
512 char_u * | 512 char * |
513 mb_init(void) | 513 mb_init(void) |
514 { | 514 { |
515 int i; | 515 int i; |
516 int idx; | 516 int idx; |
517 int n; | 517 int n; |
4747 /* Only give the message when 'verbose' is set, otherwise it might be | 4747 /* Only give the message when 'verbose' is set, otherwise it might be |
4748 * done whenever a conversion is attempted. */ | 4748 * done whenever a conversion is attempted. */ |
4749 if (verbose && p_verbose > 0) | 4749 if (verbose && p_verbose > 0) |
4750 { | 4750 { |
4751 verbose_enter(); | 4751 verbose_enter(); |
4752 EMSG2(_(e_loadlib), | 4752 semsg(_(e_loadlib), |
4753 hIconvDLL == 0 ? DYNAMIC_ICONV_DLL : DYNAMIC_MSVCRT_DLL); | 4753 hIconvDLL == 0 ? DYNAMIC_ICONV_DLL : DYNAMIC_MSVCRT_DLL); |
4754 verbose_leave(); | 4754 verbose_leave(); |
4755 } | 4755 } |
4756 iconv_end(); | 4756 iconv_end(); |
4757 return FALSE; | 4757 return FALSE; |
4769 { | 4769 { |
4770 iconv_end(); | 4770 iconv_end(); |
4771 if (verbose && p_verbose > 0) | 4771 if (verbose && p_verbose > 0) |
4772 { | 4772 { |
4773 verbose_enter(); | 4773 verbose_enter(); |
4774 EMSG2(_(e_loadfunc), "for libiconv"); | 4774 semsg(_(e_loadfunc), "for libiconv"); |
4775 verbose_leave(); | 4775 verbose_leave(); |
4776 } | 4776 } |
4777 return FALSE; | 4777 return FALSE; |
4778 } | 4778 } |
4779 return TRUE; | 4779 return TRUE; |
6026 XNBackground, (Pixel) xim_bg_color, | 6026 XNBackground, (Pixel) xim_bg_color, |
6027 XNArea, &spot_area, | 6027 XNArea, &spot_area, |
6028 XNLineSpace, line_space, | 6028 XNLineSpace, line_space, |
6029 NULL); | 6029 NULL); |
6030 if (XSetICValues(xic, XNPreeditAttributes, attr_list, NULL)) | 6030 if (XSetICValues(xic, XNPreeditAttributes, attr_list, NULL)) |
6031 EMSG(_("E284: Cannot set IC values")); | 6031 emsg(_("E284: Cannot set IC values")); |
6032 XFree(attr_list); | 6032 XFree(attr_list); |
6033 } | 6033 } |
6034 } | 6034 } |
6035 | 6035 |
6036 # if defined(FEAT_GUI_X11) | 6036 # if defined(FEAT_GUI_X11) |
6185 /* Only give this message when verbose is set, because too many people | 6185 /* Only give this message when verbose is set, because too many people |
6186 * got this message when they didn't want to use a XIM. */ | 6186 * got this message when they didn't want to use a XIM. */ |
6187 if (p_verbose > 0) | 6187 if (p_verbose > 0) |
6188 { | 6188 { |
6189 verbose_enter(); | 6189 verbose_enter(); |
6190 EMSG(_("E286: Failed to open input method")); | 6190 emsg(_("E286: Failed to open input method")); |
6191 verbose_leave(); | 6191 verbose_leave(); |
6192 } | 6192 } |
6193 return FALSE; | 6193 return FALSE; |
6194 } | 6194 } |
6195 | 6195 |
6198 XIMCallback destroy_cb; | 6198 XIMCallback destroy_cb; |
6199 | 6199 |
6200 destroy_cb.callback = xim_destroy_cb; | 6200 destroy_cb.callback = xim_destroy_cb; |
6201 destroy_cb.client_data = NULL; | 6201 destroy_cb.client_data = NULL; |
6202 if (XSetIMValues(xim, XNDestroyCallback, &destroy_cb, NULL)) | 6202 if (XSetIMValues(xim, XNDestroyCallback, &destroy_cb, NULL)) |
6203 EMSG(_("E287: Warning: Could not set destroy callback to IM")); | 6203 emsg(_("E287: Warning: Could not set destroy callback to IM")); |
6204 } | 6204 } |
6205 # endif | 6205 # endif |
6206 | 6206 |
6207 if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL) || !xim_styles) | 6207 if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL) || !xim_styles) |
6208 { | 6208 { |
6209 EMSG(_("E288: input method doesn't support any style")); | 6209 emsg(_("E288: input method doesn't support any style")); |
6210 XCloseIM(xim); | 6210 XCloseIM(xim); |
6211 return FALSE; | 6211 return FALSE; |
6212 } | 6212 } |
6213 | 6213 |
6214 found = False; | 6214 found = False; |
6263 /* Only give this message when verbose is set, because too many people | 6263 /* Only give this message when verbose is set, because too many people |
6264 * got this message when they didn't want to use a XIM. */ | 6264 * got this message when they didn't want to use a XIM. */ |
6265 if (p_verbose > 0) | 6265 if (p_verbose > 0) |
6266 { | 6266 { |
6267 verbose_enter(); | 6267 verbose_enter(); |
6268 EMSG(_("E289: input method doesn't support my preedit type")); | 6268 emsg(_("E289: input method doesn't support my preedit type")); |
6269 verbose_leave(); | 6269 verbose_leave(); |
6270 } | 6270 } |
6271 XCloseIM(xim); | 6271 XCloseIM(xim); |
6272 return FALSE; | 6272 return FALSE; |
6273 } | 6273 } |
6327 gui_set_shellsize(FALSE, FALSE, RESIZE_BOTH); | 6327 gui_set_shellsize(FALSE, FALSE, RESIZE_BOTH); |
6328 } | 6328 } |
6329 else | 6329 else |
6330 { | 6330 { |
6331 if (!is_not_a_term()) | 6331 if (!is_not_a_term()) |
6332 EMSG(_(e_xim)); | 6332 emsg(_(e_xim)); |
6333 XCloseIM(xim); | 6333 XCloseIM(xim); |
6334 return FALSE; | 6334 return FALSE; |
6335 } | 6335 } |
6336 | 6336 |
6337 return TRUE; | 6337 return TRUE; |