aboutsummaryrefslogtreecommitdiffstats
path: root/src/xfaces.c
diff options
context:
space:
mode:
authorDan Nicolaescu2010-07-04 00:50:25 -0700
committerDan Nicolaescu2010-07-04 00:50:25 -0700
commit971de7fb158335fbda39525feb2d7776a26bc030 (patch)
tree605333d85f16e35bb06baffcb66ac49f4ec0dce9 /src/xfaces.c
parentb8463cbfbe2c5183cf40772df2746e58b787ddeb (diff)
downloademacs-971de7fb158335fbda39525feb2d7776a26bc030.tar.gz
emacs-971de7fb158335fbda39525feb2d7776a26bc030.zip
Convert (most) functions in src to standard C.
* src/alloc.c: Convert function definitions to standard C. * src/atimer.c: * src/bidi.c: * src/bytecode.c: * src/callint.c: * src/callproc.c: * src/casefiddle.c: * src/casetab.c: * src/category.c: * src/ccl.c: * src/character.c: * src/charset.c: * src/chartab.c: * src/cmds.c: * src/coding.c: * src/composite.c: * src/data.c: * src/dbusbind.c: * src/dired.c: * src/dispnew.c: * src/doc.c: * src/doprnt.c: * src/ecrt0.c: * src/editfns.c: * src/fileio.c: * src/filelock.c: * src/filemode.c: * src/fns.c: * src/font.c: * src/fontset.c: * src/frame.c: * src/fringe.c: * src/ftfont.c: * src/ftxfont.c: * src/gtkutil.c: * src/indent.c: * src/insdel.c: * src/intervals.c: * src/keymap.c: * src/lread.c: * src/macros.c: * src/marker.c: * src/md5.c: * src/menu.c: * src/minibuf.c: * src/prefix-args.c: * src/print.c: * src/ralloc.c: * src/regex.c: * src/region-cache.c: * src/scroll.c: * src/search.c: * src/sound.c: * src/strftime.c: * src/syntax.c: * src/sysdep.c: * src/termcap.c: * src/terminal.c: * src/terminfo.c: * src/textprop.c: * src/tparam.c: * src/undo.c: * src/unexelf.c: * src/window.c: * src/xfaces.c: * src/xfns.c: * src/xfont.c: * src/xftfont.c: * src/xgselect.c: * src/xmenu.c: * src/xrdb.c: * src/xselect.c: * src/xsettings.c: * src/xsmfns.c: * src/xterm.c: Likewise.
Diffstat (limited to 'src/xfaces.c')
-rw-r--r--src/xfaces.c322
1 files changed, 76 insertions, 246 deletions
diff --git a/src/xfaces.c b/src/xfaces.c
index 79eb20febc0..79978f4665b 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -656,10 +656,7 @@ DEFUN ("dump-colors", Fdump_colors, Sdump_colors, 0, 0, 0,
656 is called. */ 656 is called. */
657 657
658void 658void
659x_free_colors (f, pixels, npixels) 659x_free_colors (struct frame *f, long unsigned int *pixels, int npixels)
660 struct frame *f;
661 unsigned long *pixels;
662 int npixels;
663{ 660{
664 int class = FRAME_X_DISPLAY_INFO (f)->visual->class; 661 int class = FRAME_X_DISPLAY_INFO (f)->visual->class;
665 662
@@ -681,12 +678,7 @@ x_free_colors (f, pixels, npixels)
681 is called. */ 678 is called. */
682 679
683void 680void
684x_free_dpy_colors (dpy, screen, cmap, pixels, npixels) 681x_free_dpy_colors (Display *dpy, Screen *screen, Colormap cmap, long unsigned int *pixels, int npixels)
685 Display *dpy;
686 Screen *screen;
687 Colormap cmap;
688 unsigned long *pixels;
689 int npixels;
690{ 682{
691 struct x_display_info *dpyinfo = x_display_info_for_display (dpy); 683 struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
692 int class = dpyinfo->visual->class; 684 int class = dpyinfo->visual->class;
@@ -707,10 +699,7 @@ x_free_dpy_colors (dpy, screen, cmap, pixels, npixels)
707 are given by XGCV and MASK. */ 699 are given by XGCV and MASK. */
708 700
709static INLINE GC 701static INLINE GC
710x_create_gc (f, mask, xgcv) 702x_create_gc (struct frame *f, long unsigned int mask, XGCValues *xgcv)
711 struct frame *f;
712 unsigned long mask;
713 XGCValues *xgcv;
714{ 703{
715 GC gc; 704 GC gc;
716 BLOCK_INPUT; 705 BLOCK_INPUT;
@@ -724,9 +713,7 @@ x_create_gc (f, mask, xgcv)
724/* Free GC which was used on frame F. */ 713/* Free GC which was used on frame F. */
725 714
726static INLINE void 715static INLINE void
727x_free_gc (f, gc) 716x_free_gc (struct frame *f, GC gc)
728 struct frame *f;
729 GC gc;
730{ 717{
731 eassert (interrupt_input_blocked); 718 eassert (interrupt_input_blocked);
732 IF_DEBUG (xassert (--ngcs >= 0)); 719 IF_DEBUG (xassert (--ngcs >= 0));
@@ -794,8 +781,7 @@ x_free_gc (f, gc)
794 are in ISO8859-1. */ 781 are in ISO8859-1. */
795 782
796int 783int
797xstrcasecmp (s1, s2) 784xstrcasecmp (const unsigned char *s1, const unsigned char *s2)
798 const unsigned char *s1, *s2;
799{ 785{
800 while (*s1 && *s2) 786 while (*s1 && *s2)
801 { 787 {
@@ -819,9 +805,7 @@ xstrcasecmp (s1, s2)
819 Lisp function definitions. */ 805 Lisp function definitions. */
820 806
821static INLINE struct frame * 807static INLINE struct frame *
822frame_or_selected_frame (frame, nparam) 808frame_or_selected_frame (Lisp_Object frame, int nparam)
823 Lisp_Object frame;
824 int nparam;
825{ 809{
826 if (NILP (frame)) 810 if (NILP (frame))
827 frame = selected_frame; 811 frame = selected_frame;
@@ -838,8 +822,7 @@ frame_or_selected_frame (frame, nparam)
838/* Initialize face cache and basic faces for frame F. */ 822/* Initialize face cache and basic faces for frame F. */
839 823
840void 824void
841init_frame_faces (f) 825init_frame_faces (struct frame *f)
842 struct frame *f;
843{ 826{
844 /* Make a face cache, if F doesn't have one. */ 827 /* Make a face cache, if F doesn't have one. */
845 if (FRAME_FACE_CACHE (f) == NULL) 828 if (FRAME_FACE_CACHE (f) == NULL)
@@ -877,8 +860,7 @@ init_frame_faces (f)
877/* Free face cache of frame F. Called from delete_frame. */ 860/* Free face cache of frame F. Called from delete_frame. */
878 861
879void 862void
880free_frame_faces (f) 863free_frame_faces (struct frame *f)
881 struct frame *f;
882{ 864{
883 struct face_cache *face_cache = FRAME_FACE_CACHE (f); 865 struct face_cache *face_cache = FRAME_FACE_CACHE (f);
884 866
@@ -909,8 +891,7 @@ free_frame_faces (f)
909 of named faces. */ 891 of named faces. */
910 892
911void 893void
912recompute_basic_faces (f) 894recompute_basic_faces (struct frame *f)
913 struct frame *f;
914{ 895{
915 if (FRAME_FACE_CACHE (f)) 896 if (FRAME_FACE_CACHE (f))
916 { 897 {
@@ -925,8 +906,7 @@ recompute_basic_faces (f)
925 try to free unused fonts, too. */ 906 try to free unused fonts, too. */
926 907
927void 908void
928clear_face_cache (clear_fonts_p) 909clear_face_cache (int clear_fonts_p)
929 int clear_fonts_p;
930{ 910{
931#ifdef HAVE_WINDOW_SYSTEM 911#ifdef HAVE_WINDOW_SYSTEM
932 Lisp_Object tail, frame; 912 Lisp_Object tail, frame;
@@ -1045,10 +1025,7 @@ the pixmap. Bits are stored row by row, each row occupies
1045 if these pointers are not null. */ 1025 if these pointers are not null. */
1046 1026
1047static int 1027static int
1048load_pixmap (f, name, w_ptr, h_ptr) 1028load_pixmap (FRAME_PTR f, Lisp_Object name, unsigned int *w_ptr, unsigned int *h_ptr)
1049 FRAME_PTR f;
1050 Lisp_Object name;
1051 unsigned int *w_ptr, *h_ptr;
1052{ 1029{
1053 int bitmap_id; 1030 int bitmap_id;
1054 1031
@@ -1117,9 +1094,7 @@ load_pixmap (f, name, w_ptr, h_ptr)
1117 Return 0 if there's a problem with RGB_LIST, otherwise return 1. */ 1094 Return 0 if there's a problem with RGB_LIST, otherwise return 1. */
1118 1095
1119static int 1096static int
1120parse_rgb_list (rgb_list, color) 1097parse_rgb_list (Lisp_Object rgb_list, XColor *color)
1121 Lisp_Object rgb_list;
1122 XColor *color;
1123{ 1098{
1124#define PARSE_RGB_LIST_FIELD(field) \ 1099#define PARSE_RGB_LIST_FIELD(field) \
1125 if (CONSP (rgb_list) && INTEGERP (XCAR (rgb_list))) \ 1100 if (CONSP (rgb_list) && INTEGERP (XCAR (rgb_list))) \
@@ -1144,10 +1119,7 @@ parse_rgb_list (rgb_list, color)
1144 returned in it. */ 1119 returned in it. */
1145 1120
1146static int 1121static int
1147tty_lookup_color (f, color, tty_color, std_color) 1122tty_lookup_color (struct frame *f, Lisp_Object color, XColor *tty_color, XColor *std_color)
1148 struct frame *f;
1149 Lisp_Object color;
1150 XColor *tty_color, *std_color;
1151{ 1123{
1152 Lisp_Object frame, color_desc; 1124 Lisp_Object frame, color_desc;
1153 1125
@@ -1207,11 +1179,7 @@ tty_lookup_color (f, color, tty_color, std_color)
1207/* A version of defined_color for non-X frames. */ 1179/* A version of defined_color for non-X frames. */
1208 1180
1209int 1181int
1210tty_defined_color (f, color_name, color_def, alloc) 1182tty_defined_color (struct frame *f, char *color_name, XColor *color_def, int alloc)
1211 struct frame *f;
1212 char *color_name;
1213 XColor *color_def;
1214 int alloc;
1215{ 1183{
1216 int status = 1; 1184 int status = 1;
1217 1185
@@ -1246,11 +1214,7 @@ tty_defined_color (f, color_name, color_def, alloc)
1246 This does the right thing for any type of frame. */ 1214 This does the right thing for any type of frame. */
1247 1215
1248int 1216int
1249defined_color (f, color_name, color_def, alloc) 1217defined_color (struct frame *f, char *color_name, XColor *color_def, int alloc)
1250 struct frame *f;
1251 char *color_name;
1252 XColor *color_def;
1253 int alloc;
1254{ 1218{
1255 if (!FRAME_WINDOW_P (f)) 1219 if (!FRAME_WINDOW_P (f))
1256 return tty_defined_color (f, color_name, color_def, alloc); 1220 return tty_defined_color (f, color_name, color_def, alloc);
@@ -1275,9 +1239,7 @@ defined_color (f, color_name, color_def, alloc)
1275 Lisp string. */ 1239 Lisp string. */
1276 1240
1277Lisp_Object 1241Lisp_Object
1278tty_color_name (f, idx) 1242tty_color_name (struct frame *f, int idx)
1279 struct frame *f;
1280 int idx;
1281{ 1243{
1282 if (idx >= 0 && !NILP (Ffboundp (Qtty_color_by_index))) 1244 if (idx >= 0 && !NILP (Ffboundp (Qtty_color_by_index)))
1283 { 1245 {
@@ -1312,9 +1274,7 @@ tty_color_name (f, idx)
1312 The criterion implemented here is not a terribly sophisticated one. */ 1274 The criterion implemented here is not a terribly sophisticated one. */
1313 1275
1314static int 1276static int
1315face_color_gray_p (f, color_name) 1277face_color_gray_p (struct frame *f, char *color_name)
1316 struct frame *f;
1317 char *color_name;
1318{ 1278{
1319 XColor color; 1279 XColor color;
1320 int gray_p; 1280 int gray_p;
@@ -1341,10 +1301,7 @@ face_color_gray_p (f, color_name)
1341 color. */ 1301 color. */
1342 1302
1343static int 1303static int
1344face_color_supported_p (f, color_name, background_p) 1304face_color_supported_p (struct frame *f, char *color_name, int background_p)
1345 struct frame *f;
1346 char *color_name;
1347 int background_p;
1348{ 1305{
1349 Lisp_Object frame; 1306 Lisp_Object frame;
1350 XColor not_used; 1307 XColor not_used;
@@ -1419,11 +1376,7 @@ COLOR must be a valid color name. */)
1419 these colors. */ 1376 these colors. */
1420 1377
1421unsigned long 1378unsigned long
1422load_color (f, face, name, target_index) 1379load_color (struct frame *f, struct face *face, Lisp_Object name, enum lface_attribute_index target_index)
1423 struct frame *f;
1424 struct face *face;
1425 Lisp_Object name;
1426 enum lface_attribute_index target_index;
1427{ 1380{
1428 XColor color; 1381 XColor color;
1429 1382
@@ -1494,10 +1447,7 @@ load_color (f, face, name, target_index)
1494 try to emulate gray colors with a stipple from Vface_default_stipple. */ 1447 try to emulate gray colors with a stipple from Vface_default_stipple. */
1495 1448
1496static void 1449static void
1497load_face_colors (f, face, attrs) 1450load_face_colors (struct frame *f, struct face *face, Lisp_Object *attrs)
1498 struct frame *f;
1499 struct face *face;
1500 Lisp_Object *attrs;
1501{ 1451{
1502 Lisp_Object fg, bg; 1452 Lisp_Object fg, bg;
1503 1453
@@ -1533,9 +1483,7 @@ load_face_colors (f, face, attrs)
1533/* Free color PIXEL on frame F. */ 1483/* Free color PIXEL on frame F. */
1534 1484
1535void 1485void
1536unload_color (f, pixel) 1486unload_color (struct frame *f, long unsigned int pixel)
1537 struct frame *f;
1538 unsigned long pixel;
1539{ 1487{
1540#ifdef HAVE_X_WINDOWS 1488#ifdef HAVE_X_WINDOWS
1541 if (pixel != -1) 1489 if (pixel != -1)
@@ -1551,9 +1499,7 @@ unload_color (f, pixel)
1551/* Free colors allocated for FACE. */ 1499/* Free colors allocated for FACE. */
1552 1500
1553static void 1501static void
1554free_face_colors (f, face) 1502free_face_colors (struct frame *f, struct face *face)
1555 struct frame *f;
1556 struct face *face;
1557{ 1503{
1558/* PENDING(NS): need to do something here? */ 1504/* PENDING(NS): need to do something here? */
1559#ifdef HAVE_X_WINDOWS 1505#ifdef HAVE_X_WINDOWS
@@ -1693,8 +1639,7 @@ static int font_sort_order[4];
1693static enum font_property_index font_props_for_sorting[FONT_SIZE_INDEX]; 1639static enum font_property_index font_props_for_sorting[FONT_SIZE_INDEX];
1694 1640
1695static int 1641static int
1696compare_fonts_by_sort_order (v1, v2) 1642compare_fonts_by_sort_order (const void *v1, const void *v2)
1697 const void *v1, *v2;
1698{ 1643{
1699 Lisp_Object font1 = *(Lisp_Object *) v1; 1644 Lisp_Object font1 = *(Lisp_Object *) v1;
1700 Lisp_Object font2 = *(Lisp_Object *) v2; 1645 Lisp_Object font2 = *(Lisp_Object *) v2;
@@ -2150,9 +2095,7 @@ resolve_face_name_error (ignore)
2150 Return default face in case of errors. */ 2095 Return default face in case of errors. */
2151 2096
2152static Lisp_Object 2097static Lisp_Object
2153resolve_face_name (face_name, signal_p) 2098resolve_face_name (Lisp_Object face_name, int signal_p)
2154 Lisp_Object face_name;
2155 int signal_p;
2156{ 2099{
2157 Lisp_Object orig_face; 2100 Lisp_Object orig_face;
2158 Lisp_Object tortoise, hare; 2101 Lisp_Object tortoise, hare;
@@ -2198,10 +2141,7 @@ resolve_face_name (face_name, signal_p)
2198 signal an error if FACE_NAME is not a valid face name. If SIGNAL_P 2141 signal an error if FACE_NAME is not a valid face name. If SIGNAL_P
2199 is zero, value is nil if FACE_NAME is not a valid face name. */ 2142 is zero, value is nil if FACE_NAME is not a valid face name. */
2200static INLINE Lisp_Object 2143static INLINE Lisp_Object
2201lface_from_face_name_no_resolve (f, face_name, signal_p) 2144lface_from_face_name_no_resolve (struct frame *f, Lisp_Object face_name, int signal_p)
2202 struct frame *f;
2203 Lisp_Object face_name;
2204 int signal_p;
2205{ 2145{
2206 Lisp_Object lface; 2146 Lisp_Object lface;
2207 2147
@@ -2229,10 +2169,7 @@ lface_from_face_name_no_resolve (f, face_name, signal_p)
2229 If SIGNAL_P is zero, value is nil if FACE_NAME is not a valid face 2169 If SIGNAL_P is zero, value is nil if FACE_NAME is not a valid face
2230 name. */ 2170 name. */
2231static INLINE Lisp_Object 2171static INLINE Lisp_Object
2232lface_from_face_name (f, face_name, signal_p) 2172lface_from_face_name (struct frame *f, Lisp_Object face_name, int signal_p)
2233 struct frame *f;
2234 Lisp_Object face_name;
2235 int signal_p;
2236{ 2173{
2237 face_name = resolve_face_name (face_name, signal_p); 2174 face_name = resolve_face_name (face_name, signal_p);
2238 return lface_from_face_name_no_resolve (f, face_name, signal_p); 2175 return lface_from_face_name_no_resolve (f, face_name, signal_p);
@@ -2246,11 +2183,7 @@ lface_from_face_name (f, face_name, signal_p)
2246 Otherwise, value is zero if FACE_NAME is not a face. */ 2183 Otherwise, value is zero if FACE_NAME is not a face. */
2247 2184
2248static INLINE int 2185static INLINE int
2249get_lface_attributes_no_remap (f, face_name, attrs, signal_p) 2186get_lface_attributes_no_remap (struct frame *f, Lisp_Object face_name, Lisp_Object *attrs, int signal_p)
2250 struct frame *f;
2251 Lisp_Object face_name;
2252 Lisp_Object *attrs;
2253 int signal_p;
2254{ 2187{
2255 Lisp_Object lface; 2188 Lisp_Object lface;
2256 2189
@@ -2271,12 +2204,7 @@ get_lface_attributes_no_remap (f, face_name, attrs, signal_p)
2271 Otherwise, value is zero if FACE_NAME is not a face. */ 2204 Otherwise, value is zero if FACE_NAME is not a face. */
2272 2205
2273static INLINE int 2206static INLINE int
2274get_lface_attributes (f, face_name, attrs, signal_p, named_merge_points) 2207get_lface_attributes (struct frame *f, Lisp_Object face_name, Lisp_Object *attrs, int signal_p, struct named_merge_point *named_merge_points)
2275 struct frame *f;
2276 Lisp_Object face_name;
2277 Lisp_Object *attrs;
2278 int signal_p;
2279 struct named_merge_point *named_merge_points;
2280{ 2208{
2281 Lisp_Object face_remapping; 2209 Lisp_Object face_remapping;
2282 2210
@@ -2312,8 +2240,7 @@ get_lface_attributes (f, face_name, attrs, signal_p, named_merge_points)
2312 specified, i.e. are non-nil. */ 2240 specified, i.e. are non-nil. */
2313 2241
2314static int 2242static int
2315lface_fully_specified_p (attrs) 2243lface_fully_specified_p (Lisp_Object *attrs)
2316 Lisp_Object *attrs;
2317{ 2244{
2318 int i; 2245 int i;
2319 2246
@@ -2333,10 +2260,7 @@ lface_fully_specified_p (attrs)
2333 of FORCE_P. */ 2260 of FORCE_P. */
2334 2261
2335static int 2262static int
2336set_lface_from_font (f, lface, font_object, force_p) 2263set_lface_from_font (struct frame *f, Lisp_Object lface, Lisp_Object font_object, int force_p)
2337 struct frame *f;
2338 Lisp_Object lface, font_object;
2339 int force_p;
2340{ 2264{
2341 Lisp_Object val; 2265 Lisp_Object val;
2342 struct font *font = XFONT_OBJECT (font_object); 2266 struct font *font = XFONT_OBJECT (font_object);
@@ -2397,8 +2321,7 @@ set_lface_from_font (f, lface, font_object, force_p)
2397 unless both FROM and TO are relative. */ 2321 unless both FROM and TO are relative. */
2398 2322
2399Lisp_Object 2323Lisp_Object
2400merge_face_heights (from, to, invalid) 2324merge_face_heights (Lisp_Object from, Lisp_Object to, Lisp_Object invalid)
2401 Lisp_Object from, to, invalid;
2402{ 2325{
2403 Lisp_Object result = invalid; 2326 Lisp_Object result = invalid;
2404 2327
@@ -2447,10 +2370,7 @@ merge_face_heights (from, to, invalid)
2447 other places. */ 2370 other places. */
2448 2371
2449static INLINE void 2372static INLINE void
2450merge_face_vectors (f, from, to, named_merge_points) 2373merge_face_vectors (struct frame *f, Lisp_Object *from, Lisp_Object *to, struct named_merge_point *named_merge_points)
2451 struct frame *f;
2452 Lisp_Object *from, *to;
2453 struct named_merge_point *named_merge_points;
2454{ 2374{
2455 int i; 2375 int i;
2456 2376
@@ -2517,11 +2437,7 @@ merge_face_vectors (f, from, to, named_merge_points)
2517 merging succeeded. */ 2437 merging succeeded. */
2518 2438
2519static int 2439static int
2520merge_named_face (f, face_name, to, named_merge_points) 2440merge_named_face (struct frame *f, Lisp_Object face_name, Lisp_Object *to, struct named_merge_point *named_merge_points)
2521 struct frame *f;
2522 Lisp_Object face_name;
2523 Lisp_Object *to;
2524 struct named_merge_point *named_merge_points;
2525{ 2441{
2526 struct named_merge_point named_merge_point; 2442 struct named_merge_point named_merge_point;
2527 2443
@@ -2571,12 +2487,7 @@ merge_named_face (f, face_name, to, named_merge_points)
2571 specifications. */ 2487 specifications. */
2572 2488
2573static int 2489static int
2574merge_face_ref (f, face_ref, to, err_msgs, named_merge_points) 2490merge_face_ref (struct frame *f, Lisp_Object face_ref, Lisp_Object *to, int err_msgs, struct named_merge_point *named_merge_points)
2575 struct frame *f;
2576 Lisp_Object face_ref;
2577 Lisp_Object *to;
2578 int err_msgs;
2579 struct named_merge_point *named_merge_points;
2580{ 2491{
2581 int ok = 1; /* Succeed without an error? */ 2492 int ok = 1; /* Succeed without an error? */
2582 2493
@@ -3494,9 +3405,7 @@ FRAME 0 means change the face on all frames, and change the default
3494 has been assigned the value NEW_VALUE. */ 3405 has been assigned the value NEW_VALUE. */
3495 3406
3496void 3407void
3497update_face_from_frame_parameter (f, param, new_value) 3408update_face_from_frame_parameter (struct frame *f, Lisp_Object param, Lisp_Object new_value)
3498 struct frame *f;
3499 Lisp_Object param, new_value;
3500{ 3409{
3501 Lisp_Object face = Qnil; 3410 Lisp_Object face = Qnil;
3502 Lisp_Object lface; 3411 Lisp_Object lface;
@@ -3575,8 +3484,7 @@ update_face_from_frame_parameter (f, param, new_value)
3575 font-object set in `default' face attributes LFACE. */ 3484 font-object set in `default' face attributes LFACE. */
3576 3485
3577static void 3486static void
3578set_font_frame_param (frame, lface) 3487set_font_frame_param (Lisp_Object frame, Lisp_Object lface)
3579 Lisp_Object frame, lface;
3580{ 3488{
3581 struct frame *f = XFRAME (frame); 3489 struct frame *f = XFRAME (frame);
3582 Lisp_Object font; 3490 Lisp_Object font;
@@ -3627,9 +3535,7 @@ DEFUN ("internal-face-x-get-resource", Finternal_face_x_get_resource,
3627 error; if SIGNAL_P is zero, return 0. */ 3535 error; if SIGNAL_P is zero, return 0. */
3628 3536
3629static Lisp_Object 3537static Lisp_Object
3630face_boolean_x_resource_value (value, signal_p) 3538face_boolean_x_resource_value (Lisp_Object value, int signal_p)
3631 Lisp_Object value;
3632 int signal_p;
3633{ 3539{
3634 Lisp_Object result = make_number (0); 3540 Lisp_Object result = make_number (0);
3635 3541
@@ -4075,8 +3981,7 @@ return the font name used for CHARACTER. */)
4075 is called quite often. */ 3981 is called quite often. */
4076 3982
4077static INLINE int 3983static INLINE int
4078face_attr_equal_p (v1, v2) 3984face_attr_equal_p (Lisp_Object v1, Lisp_Object v2)
4079 Lisp_Object v1, v2;
4080{ 3985{
4081 /* Type can differ, e.g. when one attribute is unspecified, i.e. nil, 3986 /* Type can differ, e.g. when one attribute is unspecified, i.e. nil,
4082 and the other is specified. */ 3987 and the other is specified. */
@@ -4109,8 +4014,7 @@ face_attr_equal_p (v1, v2)
4109 is called quite often. */ 4014 is called quite often. */
4110 4015
4111static INLINE int 4016static INLINE int
4112lface_equal_p (v1, v2) 4017lface_equal_p (Lisp_Object *v1, Lisp_Object *v2)
4113 Lisp_Object *v1, *v2;
4114{ 4018{
4115 int i, equal_p = 1; 4019 int i, equal_p = 1;
4116 4020
@@ -4198,8 +4102,7 @@ For internal use only. */)
4198 below in computing a hash value for a Lisp face. */ 4102 below in computing a hash value for a Lisp face. */
4199 4103
4200static INLINE unsigned 4104static INLINE unsigned
4201hash_string_case_insensitive (string) 4105hash_string_case_insensitive (Lisp_Object string)
4202 Lisp_Object string;
4203{ 4106{
4204 const unsigned char *s; 4107 const unsigned char *s;
4205 unsigned hash = 0; 4108 unsigned hash = 0;
@@ -4213,8 +4116,7 @@ hash_string_case_insensitive (string)
4213/* Return a hash code for face attribute vector V. */ 4116/* Return a hash code for face attribute vector V. */
4214 4117
4215static INLINE unsigned 4118static INLINE unsigned
4216lface_hash (v) 4119lface_hash (Lisp_Object *v)
4217 Lisp_Object *v;
4218{ 4120{
4219 return (hash_string_case_insensitive (v[LFACE_FAMILY_INDEX]) 4121 return (hash_string_case_insensitive (v[LFACE_FAMILY_INDEX])
4220 ^ hash_string_case_insensitive (v[LFACE_FOUNDRY_INDEX]) 4122 ^ hash_string_case_insensitive (v[LFACE_FOUNDRY_INDEX])
@@ -4233,8 +4135,7 @@ lface_hash (v)
4233 LFACE1 and LFACE2 must be fully-specified. */ 4135 LFACE1 and LFACE2 must be fully-specified. */
4234 4136
4235static INLINE int 4137static INLINE int
4236lface_same_font_attributes_p (lface1, lface2) 4138lface_same_font_attributes_p (Lisp_Object *lface1, Lisp_Object *lface2)
4237 Lisp_Object *lface1, *lface2;
4238{ 4139{
4239 xassert (lface_fully_specified_p (lface1) 4140 xassert (lface_fully_specified_p (lface1)
4240 && lface_fully_specified_p (lface2)); 4141 && lface_fully_specified_p (lface2));
@@ -4265,8 +4166,7 @@ lface_same_font_attributes_p (lface1, lface2)
4265 vector ATTR. */ 4166 vector ATTR. */
4266 4167
4267static struct face * 4168static struct face *
4268make_realized_face (attr) 4169make_realized_face (Lisp_Object *attr)
4269 Lisp_Object *attr;
4270{ 4170{
4271 struct face *face = (struct face *) xmalloc (sizeof *face); 4171 struct face *face = (struct face *) xmalloc (sizeof *face);
4272 bzero (face, sizeof *face); 4172 bzero (face, sizeof *face);
@@ -4280,9 +4180,7 @@ make_realized_face (attr)
4280 be null. */ 4180 be null. */
4281 4181
4282void 4182void
4283free_realized_face (f, face) 4183free_realized_face (struct frame *f, struct face *face)
4284 struct frame *f;
4285 struct face *face;
4286{ 4184{
4287 if (face) 4185 if (face)
4288 { 4186 {
@@ -4317,9 +4215,7 @@ free_realized_face (f, face)
4317 by clearing the face cache. */ 4215 by clearing the face cache. */
4318 4216
4319void 4217void
4320prepare_face_for_display (f, face) 4218prepare_face_for_display (struct frame *f, struct face *face)
4321 struct frame *f;
4322 struct face *face;
4323{ 4219{
4324#ifdef HAVE_WINDOW_SYSTEM 4220#ifdef HAVE_WINDOW_SYSTEM
4325 xassert (FRAME_WINDOW_P (f)); 4221 xassert (FRAME_WINDOW_P (f));
@@ -4356,8 +4252,7 @@ prepare_face_for_display (f, face)
4356/* Returns the `distance' between the colors X and Y. */ 4252/* Returns the `distance' between the colors X and Y. */
4357 4253
4358static int 4254static int
4359color_distance (x, y) 4255color_distance (XColor *x, XColor *y)
4360 XColor *x, *y;
4361{ 4256{
4362 /* This formula is from a paper title `Colour metric' by Thiadmer Riemersma. 4257 /* This formula is from a paper title `Colour metric' by Thiadmer Riemersma.
4363 Quoting from that paper: 4258 Quoting from that paper:
@@ -4415,8 +4310,7 @@ If FRAME is unspecified or nil, the current frame is used. */)
4415/* Return a new face cache for frame F. */ 4310/* Return a new face cache for frame F. */
4416 4311
4417static struct face_cache * 4312static struct face_cache *
4418make_face_cache (f) 4313make_face_cache (struct frame *f)
4419 struct frame *f;
4420{ 4314{
4421 struct face_cache *c; 4315 struct face_cache *c;
4422 int size; 4316 int size;
@@ -4439,8 +4333,7 @@ make_face_cache (f)
4439 keeping too many graphics contexts that are no longer needed. */ 4333 keeping too many graphics contexts that are no longer needed. */
4440 4334
4441static void 4335static void
4442clear_face_gcs (c) 4336clear_face_gcs (struct face_cache *c)
4443 struct face_cache *c;
4444{ 4337{
4445 if (c && FRAME_WINDOW_P (c->f)) 4338 if (c && FRAME_WINDOW_P (c->f))
4446 { 4339 {
@@ -4470,8 +4363,7 @@ clear_face_gcs (c)
4470 event doesn't try to use faces we destroyed. */ 4363 event doesn't try to use faces we destroyed. */
4471 4364
4472static void 4365static void
4473free_realized_faces (c) 4366free_realized_faces (struct face_cache *c)
4474 struct face_cache *c;
4475{ 4367{
4476 if (c && c->used) 4368 if (c && c->used)
4477 { 4369 {
@@ -4511,9 +4403,7 @@ free_realized_faces (c)
4511/* Free all realized faces that are using FONTSET on frame F. */ 4403/* Free all realized faces that are using FONTSET on frame F. */
4512 4404
4513void 4405void
4514free_realized_faces_for_fontset (f, fontset) 4406free_realized_faces_for_fontset (struct frame *f, int fontset)
4515 struct frame *f;
4516 int fontset;
4517{ 4407{
4518 struct face_cache *cache = FRAME_FACE_CACHE (f); 4408 struct face_cache *cache = FRAME_FACE_CACHE (f);
4519 struct face *face; 4409 struct face *face;
@@ -4554,8 +4444,7 @@ free_realized_faces_for_fontset (f, fontset)
4554 because we can't tell which realized faces depend on that face. */ 4444 because we can't tell which realized faces depend on that face. */
4555 4445
4556void 4446void
4557free_all_realized_faces (frame) 4447free_all_realized_faces (Lisp_Object frame)
4558 Lisp_Object frame;
4559{ 4448{
4560 if (NILP (frame)) 4449 if (NILP (frame))
4561 { 4450 {
@@ -4571,8 +4460,7 @@ free_all_realized_faces (frame)
4571/* Free face cache C and faces in it, including their X resources. */ 4460/* Free face cache C and faces in it, including their X resources. */
4572 4461
4573static void 4462static void
4574free_face_cache (c) 4463free_face_cache (struct face_cache *c)
4575 struct face_cache *c;
4576{ 4464{
4577 if (c) 4465 if (c)
4578 { 4466 {
@@ -4592,10 +4480,7 @@ free_face_cache (c)
4592 that a requested face is not cached. */ 4480 that a requested face is not cached. */
4593 4481
4594static void 4482static void
4595cache_face (c, face, hash) 4483cache_face (struct face_cache *c, struct face *face, unsigned int hash)
4596 struct face_cache *c;
4597 struct face *face;
4598 unsigned hash;
4599{ 4484{
4600 int i = hash % FACE_CACHE_BUCKETS_SIZE; 4485 int i = hash % FACE_CACHE_BUCKETS_SIZE;
4601 4486
@@ -4672,9 +4557,7 @@ cache_face (c, face, hash)
4672/* Remove face FACE from cache C. */ 4557/* Remove face FACE from cache C. */
4673 4558
4674static void 4559static void
4675uncache_face (c, face) 4560uncache_face (struct face_cache *c, struct face *face)
4676 struct face_cache *c;
4677 struct face *face;
4678{ 4561{
4679 int i = face->hash % FACE_CACHE_BUCKETS_SIZE; 4562 int i = face->hash % FACE_CACHE_BUCKETS_SIZE;
4680 4563
@@ -4698,9 +4581,7 @@ uncache_face (c, face)
4698 realize a new one. */ 4581 realize a new one. */
4699 4582
4700INLINE int 4583INLINE int
4701lookup_face (f, attr) 4584lookup_face (struct frame *f, Lisp_Object *attr)
4702 struct frame *f;
4703 Lisp_Object *attr;
4704{ 4585{
4705 struct face_cache *cache = FRAME_FACE_CACHE (f); 4586 struct face_cache *cache = FRAME_FACE_CACHE (f);
4706 unsigned hash; 4587 unsigned hash;
@@ -4746,10 +4627,7 @@ lookup_face (f, attr)
4746 suitable face is found, realize a new one. */ 4627 suitable face is found, realize a new one. */
4747 4628
4748int 4629int
4749face_for_font (f, font_object, base_face) 4630face_for_font (struct frame *f, Lisp_Object font_object, struct face *base_face)
4750 struct frame *f;
4751 Lisp_Object font_object;
4752 struct face *base_face;
4753{ 4631{
4754 struct face_cache *cache = FRAME_FACE_CACHE (f); 4632 struct face_cache *cache = FRAME_FACE_CACHE (f);
4755 unsigned hash; 4633 unsigned hash;
@@ -4784,10 +4662,7 @@ face_for_font (f, font_object, base_face)
4784 face isn't realized and cannot be realized. */ 4662 face isn't realized and cannot be realized. */
4785 4663
4786int 4664int
4787lookup_named_face (f, symbol, signal_p) 4665lookup_named_face (struct frame *f, Lisp_Object symbol, int signal_p)
4788 struct frame *f;
4789 Lisp_Object symbol;
4790 int signal_p;
4791{ 4666{
4792 Lisp_Object attrs[LFACE_VECTOR_SIZE]; 4667 Lisp_Object attrs[LFACE_VECTOR_SIZE];
4793 Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; 4668 Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE];
@@ -4819,9 +4694,7 @@ lookup_named_face (f, symbol, signal_p)
4819 rather than signal an error. */ 4694 rather than signal an error. */
4820 4695
4821int 4696int
4822lookup_basic_face (f, face_id) 4697lookup_basic_face (struct frame *f, int face_id)
4823 struct frame *f;
4824 int face_id;
4825{ 4698{
4826 Lisp_Object name, mapping; 4699 Lisp_Object name, mapping;
4827 int remapped_face_id; 4700 int remapped_face_id;
@@ -4868,9 +4741,7 @@ lookup_basic_face (f, face_id)
4868 LFACE_ID on frame F. Value is -1 if LFACE_ID isn't valid. */ 4741 LFACE_ID on frame F. Value is -1 if LFACE_ID isn't valid. */
4869 4742
4870int 4743int
4871ascii_face_of_lisp_face (f, lface_id) 4744ascii_face_of_lisp_face (struct frame *f, int lface_id)
4872 struct frame *f;
4873 int lface_id;
4874{ 4745{
4875 int face_id; 4746 int face_id;
4876 4747
@@ -4891,9 +4762,7 @@ ascii_face_of_lisp_face (f, lface_id)
4891 STEPS < 0 means larger. Value is the id of the face. */ 4762 STEPS < 0 means larger. Value is the id of the face. */
4892 4763
4893int 4764int
4894smaller_face (f, face_id, steps) 4765smaller_face (struct frame *f, int face_id, int steps)
4895 struct frame *f;
4896 int face_id, steps;
4897{ 4766{
4898#ifdef HAVE_WINDOW_SYSTEM 4767#ifdef HAVE_WINDOW_SYSTEM
4899 struct face *face; 4768 struct face *face;
@@ -4952,10 +4821,7 @@ smaller_face (f, face_id, steps)
4952 FACE_ID on frame F, but has height HEIGHT. */ 4821 FACE_ID on frame F, but has height HEIGHT. */
4953 4822
4954int 4823int
4955face_with_height (f, face_id, height) 4824face_with_height (struct frame *f, int face_id, int height)
4956 struct frame *f;
4957 int face_id;
4958 int height;
4959{ 4825{
4960#ifdef HAVE_WINDOW_SYSTEM 4826#ifdef HAVE_WINDOW_SYSTEM
4961 struct face *face; 4827 struct face *face;
@@ -4984,11 +4850,7 @@ face_with_height (f, face_id, height)
4984 default face. FACE_ID is assumed to be already realized. */ 4850 default face. FACE_ID is assumed to be already realized. */
4985 4851
4986int 4852int
4987lookup_derived_face (f, symbol, face_id, signal_p) 4853lookup_derived_face (struct frame *f, Lisp_Object symbol, int face_id, int signal_p)
4988 struct frame *f;
4989 Lisp_Object symbol;
4990 int face_id;
4991 int signal_p;
4992{ 4854{
4993 Lisp_Object attrs[LFACE_VECTOR_SIZE]; 4855 Lisp_Object attrs[LFACE_VECTOR_SIZE];
4994 Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; 4856 Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE];
@@ -5045,10 +4907,7 @@ DEFUN ("face-attributes-as-vector", Fface_attributes_as_vector,
5045 \(2) `close in spirit' to what the attributes specify, if not exact. */ 4907 \(2) `close in spirit' to what the attributes specify, if not exact. */
5046 4908
5047static int 4909static int
5048x_supports_face_attributes_p (f, attrs, def_face) 4910x_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, struct face *def_face)
5049 struct frame *f;
5050 Lisp_Object *attrs;
5051 struct face *def_face;
5052{ 4911{
5053 Lisp_Object *def_attrs = def_face->lface; 4912 Lisp_Object *def_attrs = def_face->lface;
5054 4913
@@ -5149,10 +5008,7 @@ x_supports_face_attributes_p (f, attrs, def_face)
5149 substitution of a `dim' face for italic. */ 5008 substitution of a `dim' face for italic. */
5150 5009
5151static int 5010static int
5152tty_supports_face_attributes_p (f, attrs, def_face) 5011tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs, struct face *def_face)
5153 struct frame *f;
5154 Lisp_Object *attrs;
5155 struct face *def_face;
5156{ 5012{
5157 int weight; 5013 int weight;
5158 Lisp_Object val, fg, bg; 5014 Lisp_Object val, fg, bg;
@@ -5532,8 +5388,7 @@ be found. Value is ALIST. */)
5532 attribute of ATTRS doesn't name a fontset. */ 5388 attribute of ATTRS doesn't name a fontset. */
5533 5389
5534static int 5390static int
5535face_fontset (attrs) 5391face_fontset (Lisp_Object *attrs)
5536 Lisp_Object *attrs;
5537{ 5392{
5538 Lisp_Object name; 5393 Lisp_Object name;
5539 5394
@@ -5556,8 +5411,7 @@ face_fontset (attrs)
5556 face. */ 5411 face. */
5557 5412
5558static int 5413static int
5559realize_basic_faces (f) 5414realize_basic_faces (struct frame *f)
5560 struct frame *f;
5561{ 5415{
5562 int success_p = 0; 5416 int success_p = 0;
5563 int count = SPECPDL_INDEX (); 5417 int count = SPECPDL_INDEX ();
@@ -5605,8 +5459,7 @@ realize_basic_faces (f)
5605 that are not explicitly specified are taken from frame parameters. */ 5459 that are not explicitly specified are taken from frame parameters. */
5606 5460
5607static int 5461static int
5608realize_default_face (f) 5462realize_default_face (struct frame *f)
5609 struct frame *f;
5610{ 5463{
5611 struct face_cache *c = FRAME_FACE_CACHE (f); 5464 struct face_cache *c = FRAME_FACE_CACHE (f);
5612 Lisp_Object lface; 5465 Lisp_Object lface;
@@ -5729,10 +5582,7 @@ realize_default_face (f)
5729 have. The default face must have been realized already. */ 5582 have. The default face must have been realized already. */
5730 5583
5731static void 5584static void
5732realize_named_face (f, symbol, id) 5585realize_named_face (struct frame *f, Lisp_Object symbol, int id)
5733 struct frame *f;
5734 Lisp_Object symbol;
5735 int id;
5736{ 5586{
5737 struct face_cache *c = FRAME_FACE_CACHE (f); 5587 struct face_cache *c = FRAME_FACE_CACHE (f);
5738 Lisp_Object lface = lface_from_face_name (f, symbol, 0); 5588 Lisp_Object lface = lface_from_face_name (f, symbol, 0);
@@ -5768,10 +5618,7 @@ realize_named_face (f, symbol, id)
5768 face. Value is a pointer to the newly created realized face. */ 5618 face. Value is a pointer to the newly created realized face. */
5769 5619
5770static struct face * 5620static struct face *
5771realize_face (cache, attrs, former_face_id) 5621realize_face (struct face_cache *cache, Lisp_Object *attrs, int former_face_id)
5772 struct face_cache *cache;
5773 Lisp_Object *attrs;
5774 int former_face_id;
5775{ 5622{
5776 struct face *face; 5623 struct face *face;
5777 5624
@@ -5812,10 +5659,7 @@ realize_face (cache, attrs, former_face_id)
5812 no-font. */ 5659 no-font. */
5813 5660
5814static struct face * 5661static struct face *
5815realize_non_ascii_face (f, font_object, base_face) 5662realize_non_ascii_face (struct frame *f, Lisp_Object font_object, struct face *base_face)
5816 struct frame *f;
5817 Lisp_Object font_object;
5818 struct face *base_face;
5819{ 5663{
5820 struct face_cache *cache = FRAME_FACE_CACHE (f); 5664 struct face_cache *cache = FRAME_FACE_CACHE (f);
5821 struct face *face; 5665 struct face *face;
@@ -5849,9 +5693,7 @@ realize_non_ascii_face (f, font_object, base_face)
5849 created realized face. */ 5693 created realized face. */
5850 5694
5851static struct face * 5695static struct face *
5852realize_x_face (cache, attrs) 5696realize_x_face (struct face_cache *cache, Lisp_Object *attrs)
5853 struct face_cache *cache;
5854 Lisp_Object *attrs;
5855{ 5697{
5856 struct face *face = NULL; 5698 struct face *face = NULL;
5857#ifdef HAVE_WINDOW_SYSTEM 5699#ifdef HAVE_WINDOW_SYSTEM
@@ -6058,11 +5900,7 @@ realize_x_face (cache, attrs)
6058 default foreground/background colors. */ 5900 default foreground/background colors. */
6059 5901
6060static void 5902static void
6061map_tty_color (f, face, idx, defaulted) 5903map_tty_color (struct frame *f, struct face *face, enum lface_attribute_index idx, int *defaulted)
6062 struct frame *f;
6063 struct face *face;
6064 enum lface_attribute_index idx;
6065 int *defaulted;
6066{ 5904{
6067 Lisp_Object frame, color, def; 5905 Lisp_Object frame, color, def;
6068 int foreground_p = idx == LFACE_FOREGROUND_INDEX; 5906 int foreground_p = idx == LFACE_FOREGROUND_INDEX;
@@ -6139,9 +5977,7 @@ map_tty_color (f, face, idx, defaulted)
6139 Value is a pointer to the newly created realized face. */ 5977 Value is a pointer to the newly created realized face. */
6140 5978
6141static struct face * 5979static struct face *
6142realize_tty_face (cache, attrs) 5980realize_tty_face (struct face_cache *cache, Lisp_Object *attrs)
6143 struct face_cache *cache;
6144 Lisp_Object *attrs;
6145{ 5981{
6146 struct face *face; 5982 struct face *face;
6147 int weight, slant; 5983 int weight, slant;
@@ -6222,10 +6058,7 @@ is non-nil. */)
6222 property PROP on frame F in current_buffer. */ 6058 property PROP on frame F in current_buffer. */
6223 6059
6224int 6060int
6225compute_char_face (f, ch, prop) 6061compute_char_face (struct frame *f, int ch, Lisp_Object prop)
6226 struct frame *f;
6227 int ch;
6228 Lisp_Object prop;
6229{ 6062{
6230 int face_id; 6063 int face_id;
6231 6064
@@ -6559,10 +6392,7 @@ face_at_string_position (w, string, pos, bufpos, region_beg,
6559*/ 6392*/
6560 6393
6561int 6394int
6562merge_faces (f, face_name, face_id, base_face_id) 6395merge_faces (struct frame *f, Lisp_Object face_name, int face_id, int base_face_id)
6563 struct frame *f;
6564 Lisp_Object face_name;
6565 int face_id, base_face_id;
6566{ 6396{
6567 Lisp_Object attrs[LFACE_VECTOR_SIZE]; 6397 Lisp_Object attrs[LFACE_VECTOR_SIZE];
6568 struct face *base_face; 6398 struct face *base_face;
@@ -6751,7 +6581,7 @@ DEFUN ("show-face-resources", Fshow_face_resources, Sshow_face_resources,
6751 ***********************************************************************/ 6581 ***********************************************************************/
6752 6582
6753void 6583void
6754syms_of_xfaces () 6584syms_of_xfaces (void)
6755{ 6585{
6756 Qface = intern_c_string ("face"); 6586 Qface = intern_c_string ("face");
6757 staticpro (&Qface); 6587 staticpro (&Qface);