comparison src/gui.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 29f3d59bb6f0
children 41fbbcea0f1b
comparison
equal deleted inserted replaced
15469:bc9b5261ed01 15470:55ccc2d353bd
213 * exit. */ 213 * exit. */
214 pipe_error = (pipe(pipefd) < 0); 214 pipe_error = (pipe(pipefd) < 0);
215 pid = fork(); 215 pid = fork();
216 if (pid < 0) /* Fork error */ 216 if (pid < 0) /* Fork error */
217 { 217 {
218 EMSG(_("E851: Failed to create a new process for the GUI")); 218 emsg(_("E851: Failed to create a new process for the GUI"));
219 return; 219 return;
220 } 220 }
221 else if (pid > 0) /* Parent */ 221 else if (pid > 0) /* Parent */
222 { 222 {
223 /* Give the child some time to do the setsid(), otherwise the 223 /* Give the child some time to do the setsid(), otherwise the
237 # ifdef __NeXT__ 237 # ifdef __NeXT__
238 wait4(pid, &exit_status, 0, (struct rusage *)0); 238 wait4(pid, &exit_status, 0, (struct rusage *)0);
239 # else 239 # else
240 waitpid(pid, &exit_status, 0); 240 waitpid(pid, &exit_status, 0);
241 # endif 241 # endif
242 EMSG(_("E852: The child process failed to start the GUI")); 242 emsg(_("E852: The child process failed to start the GUI"));
243 return; 243 return;
244 } 244 }
245 else if (status == GUI_CHILD_IO_ERROR) 245 else if (status == GUI_CHILD_IO_ERROR)
246 { 246 {
247 pipe_error = TRUE; 247 pipe_error = TRUE;
360 static int result = MAYBE; 360 static int result = MAYBE;
361 361
362 if (result != MAYBE) 362 if (result != MAYBE)
363 { 363 {
364 if (result == FAIL) 364 if (result == FAIL)
365 EMSG(_("E229: Cannot start the GUI")); 365 emsg(_("E229: Cannot start the GUI"));
366 return result; 366 return result;
367 } 367 }
368 368
369 gui.shell_created = FALSE; 369 gui.shell_created = FALSE;
370 gui.dying = FALSE; 370 gui.dying = FALSE;
513 if (use_gvimrc != NULL) 513 if (use_gvimrc != NULL)
514 { 514 {
515 if (STRCMP(use_gvimrc, "NONE") != 0 515 if (STRCMP(use_gvimrc, "NONE") != 0
516 && STRCMP(use_gvimrc, "NORC") != 0 516 && STRCMP(use_gvimrc, "NORC") != 0
517 && do_source(use_gvimrc, FALSE, DOSO_NONE) != OK) 517 && do_source(use_gvimrc, FALSE, DOSO_NONE) != OK)
518 EMSG2(_("E230: Cannot read from \"%s\""), use_gvimrc); 518 semsg(_("E230: Cannot read from \"%s\""), use_gvimrc);
519 } 519 }
520 else 520 else
521 { 521 {
522 /* 522 /*
523 * Get system wide defaults for gvim, only when file name defined. 523 * Get system wide defaults for gvim, only when file name defined.
647 || gui_init_font(p_guifontset, TRUE) == FAIL) && 647 || gui_init_font(p_guifontset, TRUE) == FAIL) &&
648 #endif 648 #endif
649 gui_init_font(*p_guifont == NUL ? hl_get_font_name() 649 gui_init_font(*p_guifont == NUL ? hl_get_font_name()
650 : p_guifont, FALSE) == FAIL) 650 : p_guifont, FALSE) == FAIL)
651 { 651 {
652 EMSG(_("E665: Cannot start GUI, no valid font found")); 652 emsg(_("E665: Cannot start GUI, no valid font found"));
653 goto error2; 653 goto error2;
654 } 654 }
655 #ifdef FEAT_MBYTE 655 #ifdef FEAT_MBYTE
656 if (gui_get_wide_font() == FAIL) 656 if (gui_get_wide_font() == FAIL)
657 EMSG(_("E231: 'guifontwide' invalid")); 657 emsg(_("E231: 'guifontwide' invalid"));
658 #endif 658 #endif
659 659
660 gui.num_cols = Columns; 660 gui.num_cols = Columns;
661 gui.num_rows = Rows; 661 gui.num_rows = Rows;
662 gui_reset_scroll_region(); 662 gui_reset_scroll_region();
767 gui_mch_disable_beval_area(balloonEval); 767 gui_mch_disable_beval_area(balloonEval);
768 #endif 768 #endif
769 769
770 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK) 770 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
771 if (!im_xim_isvalid_imactivate()) 771 if (!im_xim_isvalid_imactivate())
772 EMSG(_("E599: Value of 'imactivatekey' is invalid")); 772 emsg(_("E599: Value of 'imactivatekey' is invalid"));
773 #endif 773 #endif
774 /* When 'cmdheight' was set during startup it may not have taken 774 /* When 'cmdheight' was set during startup it may not have taken
775 * effect yet. */ 775 * effect yet. */
776 if (p_ch != 1L) 776 if (p_ch != 1L)
777 command_height(); 777 command_height();
4783 if (t == INVALCOLOR 4783 if (t == INVALCOLOR
4784 #if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK) 4784 #if defined(FEAT_GUI_X11) || defined(FEAT_GUI_GTK)
4785 && gui.in_use 4785 && gui.in_use
4786 #endif 4786 #endif
4787 ) 4787 )
4788 EMSG2(_("E254: Cannot allocate color %s"), name); 4788 semsg(_("E254: Cannot allocate color %s"), name);
4789 return t; 4789 return t;
4790 } 4790 }
4791 4791
4792 /* 4792 /*
4793 * Return the grey value of a color (range 0-255). 4793 * Return the grey value of a color (range 0-255).