comparison src/gui_x11.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 98c35d312987
comparison
equal deleted inserted replaced
15469:bc9b5261ed01 15470:55ccc2d353bd
1293 } 1293 }
1294 # endif 1294 # endif
1295 if (app_context == NULL || gui.dpy == NULL) 1295 if (app_context == NULL || gui.dpy == NULL)
1296 { 1296 {
1297 gui.dying = TRUE; 1297 gui.dying = TRUE;
1298 EMSG(_(e_opendisp)); 1298 emsg(_(e_opendisp));
1299 return FAIL; 1299 return FAIL;
1300 } 1300 }
1301 return OK; 1301 return OK;
1302 } 1302 }
1303 1303
1539 # endif 1539 # endif
1540 #endif 1540 #endif
1541 } 1541 }
1542 1542
1543 if (gui.color_approx) 1543 if (gui.color_approx)
1544 EMSG(_("Vim E458: Cannot allocate colormap entry, some colors may be incorrect")); 1544 emsg(_("Vim E458: Cannot allocate colormap entry, some colors may be incorrect"));
1545 1545
1546 #ifdef FEAT_SUN_WORKSHOP 1546 #ifdef FEAT_SUN_WORKSHOP
1547 if (usingSunWorkShop) 1547 if (usingSunWorkShop)
1548 workshop_connect(app_context); 1548 workshop_connect(app_context);
1549 #endif 1549 #endif
1968 font = XLoadQueryFont(gui.dpy, (char *)name); 1968 font = XLoadQueryFont(gui.dpy, (char *)name);
1969 1969
1970 if (font == NULL) 1970 if (font == NULL)
1971 { 1971 {
1972 if (giveErrorIfMissing) 1972 if (giveErrorIfMissing)
1973 EMSG2(_(e_font), name); 1973 semsg(_(e_font), name);
1974 return NOFONT; 1974 return NOFONT;
1975 } 1975 }
1976 1976
1977 #ifdef DEBUG 1977 #ifdef DEBUG
1978 printf("Font Information for '%s':\n", name); 1978 printf("Font Information for '%s':\n", name);
1992 printf("\n"); 1992 printf("\n");
1993 #endif 1993 #endif
1994 1994
1995 if (font->max_bounds.width != font->min_bounds.width) 1995 if (font->max_bounds.width != font->min_bounds.width)
1996 { 1996 {
1997 EMSG2(_(e_fontwidth), name); 1997 semsg(_(e_fontwidth), name);
1998 XFreeFont(gui.dpy, font); 1998 XFreeFont(gui.dpy, font);
1999 return NOFONT; 1999 return NOFONT;
2000 } 2000 }
2001 return (GuiFont)font; 2001 return (GuiFont)font;
2002 } 2002 }
2143 { 2143 {
2144 int i; 2144 int i;
2145 2145
2146 if (giveErrorIfMissing) 2146 if (giveErrorIfMissing)
2147 { 2147 {
2148 EMSG2(_("E250: Fonts for the following charsets are missing in fontset %s:"), name); 2148 semsg(_("E250: Fonts for the following charsets are missing in fontset %s:"), name);
2149 for (i = 0; i < num_missing; i++) 2149 for (i = 0; i < num_missing; i++)
2150 EMSG2("%s", missing[i]); 2150 semsg("%s", missing[i]);
2151 } 2151 }
2152 XFreeStringList(missing); 2152 XFreeStringList(missing);
2153 } 2153 }
2154 2154
2155 if (fontset == NULL) 2155 if (fontset == NULL)
2156 { 2156 {
2157 if (giveErrorIfMissing) 2157 if (giveErrorIfMissing)
2158 EMSG2(_(e_fontset), name); 2158 semsg(_(e_fontset), name);
2159 return NOFONTSET; 2159 return NOFONTSET;
2160 } 2160 }
2161 2161
2162 if (fixed_width && check_fontset_sanity(fontset) == FAIL) 2162 if (fixed_width && check_fontset_sanity(fontset) == FAIL)
2163 { 2163 {
2185 fn = XFontsOfFontSet(fs, &xfs, &font_name); 2185 fn = XFontsOfFontSet(fs, &xfs, &font_name);
2186 for (i = 0; i < fn; i++) 2186 for (i = 0; i < fn; i++)
2187 { 2187 {
2188 if (xfs[i]->max_bounds.width != xfs[i]->min_bounds.width) 2188 if (xfs[i]->max_bounds.width != xfs[i]->min_bounds.width)
2189 { 2189 {
2190 EMSG2(_("E252: Fontset name: %s"), base_name); 2190 semsg(_("E252: Fontset name: %s"), base_name);
2191 EMSG2(_("Font '%s' is not fixed-width"), font_name[i]); 2191 semsg(_("Font '%s' is not fixed-width"), font_name[i]);
2192 return FAIL; 2192 return FAIL;
2193 } 2193 }
2194 } 2194 }
2195 /* scan base font width */ 2195 /* scan base font width */
2196 min_width = 32767; 2196 min_width = 32767;
2205 for (i = 0; i < fn; i++) 2205 for (i = 0; i < fn; i++)
2206 { 2206 {
2207 if ( xfs[i]->max_bounds.width != 2 * min_width 2207 if ( xfs[i]->max_bounds.width != 2 * min_width
2208 && xfs[i]->max_bounds.width != min_width) 2208 && xfs[i]->max_bounds.width != min_width)
2209 { 2209 {
2210 EMSG2(_("E253: Fontset name: %s"), base_name); 2210 semsg(_("E253: Fontset name: %s"), base_name);
2211 EMSG2(_("Font0: %s"), font_name[min_font_idx]); 2211 semsg(_("Font0: %s"), font_name[min_font_idx]);
2212 EMSG2(_("Font1: %s"), font_name[i]); 2212 semsg(_("Font1: %s"), font_name[i]);
2213 EMSGN(_("Font%ld width is not twice that of font0"), i); 2213 semsg(_("Font%ld width is not twice that of font0"), i);
2214 EMSGN(_("Font0 width: %ld"), xfs[min_font_idx]->max_bounds.width); 2214 semsg(_("Font0 width: %ld"), xfs[min_font_idx]->max_bounds.width);
2215 EMSGN(_("Font1 width: %ld"), xfs[i]->max_bounds.width); 2215 semsg(_("Font1 width: %ld"), xfs[i]->max_bounds.width);
2216 return FAIL; 2216 return FAIL;
2217 } 2217 }
2218 } 2218 }
2219 /* it seems ok. Good Luck!! */ 2219 /* it seems ok. Good Luck!! */
2220 return OK; 2220 return OK;
3324 /* Sign width is fixed at two columns now. 3324 /* Sign width is fixed at two columns now.
3325 if (sign->width > gui.sign_width) 3325 if (sign->width > gui.sign_width)
3326 gui.sign_width = sign->width + 8; */ 3326 gui.sign_width = sign->width + 8; */
3327 } 3327 }
3328 else 3328 else
3329 EMSG(_(e_signdata)); 3329 emsg(_(e_signdata));
3330 } 3330 }
3331 3331
3332 return (void *)sign; 3332 return (void *)sign;
3333 } 3333 }
3334 3334