Mercurial > emacs
comparison src/xterm.c @ 25646:9154af188477
Use XCAR and XCDR instead of explicit member references.
author | Ken Raeburn <raeburn@raeburn.org> |
---|---|
date | Sun, 12 Sep 1999 07:05:34 +0000 |
parents | ddf2e1fef00b |
children | f8543a6d88ca |
comparison
equal
deleted
inserted
replaced
25645:a14111a2a100 | 25646:9154af188477 |
---|---|
7060 { | 7060 { |
7061 Lisp_Object tail; | 7061 Lisp_Object tail; |
7062 | 7062 |
7063 for (tail = Vframe_list; | 7063 for (tail = Vframe_list; |
7064 XGCTYPE (tail) == Lisp_Cons; | 7064 XGCTYPE (tail) == Lisp_Cons; |
7065 tail = XCONS (tail)->cdr) | 7065 tail = XCDR (tail)) |
7066 { | 7066 { |
7067 Lisp_Object frame, bar, condemned; | 7067 Lisp_Object frame, bar, condemned; |
7068 | 7068 |
7069 frame = XCONS (tail)->car; | 7069 frame = XCAR (tail); |
7070 /* All elements of Vframe_list should be frames. */ | 7070 /* All elements of Vframe_list should be frames. */ |
7071 if (! GC_FRAMEP (frame)) | 7071 if (! GC_FRAMEP (frame)) |
7072 abort (); | 7072 abort (); |
7073 | 7073 |
7074 /* Scan this frame's scroll bar list for a scroll bar with the | 7074 /* Scan this frame's scroll bar list for a scroll bar with the |
9059 bufp++; | 9059 bufp++; |
9060 count++; | 9060 count++; |
9061 numchars--; | 9061 numchars--; |
9062 } | 9062 } |
9063 else if (! NILP (Vframe_list) | 9063 else if (! NILP (Vframe_list) |
9064 && ! NILP (XCONS (Vframe_list)->cdr)) | 9064 && ! NILP (XCDR (Vframe_list))) |
9065 /* Force a redisplay sooner or later | 9065 /* Force a redisplay sooner or later |
9066 to update the frame titles | 9066 to update the frame titles |
9067 in case this is the second frame. */ | 9067 in case this is the second frame. */ |
9068 record_asynch_buffer_change (); | 9068 record_asynch_buffer_change (); |
9069 } | 9069 } |
11726 | 11726 |
11727 if (maxnames == 1 && !size) | 11727 if (maxnames == 1 && !size) |
11728 /* We can return any single font matching PATTERN. */ | 11728 /* We can return any single font matching PATTERN. */ |
11729 try_XLoadQueryFont = 1; | 11729 try_XLoadQueryFont = 1; |
11730 | 11730 |
11731 for (; CONSP (patterns); patterns = XCONS (patterns)->cdr) | 11731 for (; CONSP (patterns); patterns = XCDR (patterns)) |
11732 { | 11732 { |
11733 int num_fonts; | 11733 int num_fonts; |
11734 char **names; | 11734 char **names; |
11735 | 11735 |
11736 pattern = XCONS (patterns)->car; | 11736 pattern = XCAR (patterns); |
11737 /* See if we cached the result for this particular query. | 11737 /* See if we cached the result for this particular query. |
11738 The cache is an alist of the form: | 11738 The cache is an alist of the form: |
11739 (((PATTERN . MAXNAMES) (FONTNAME . WIDTH) ...) ...) | 11739 (((PATTERN . MAXNAMES) (FONTNAME . WIDTH) ...) ...) |
11740 */ | 11740 */ |
11741 if (f && (tem = XCONS (FRAME_X_DISPLAY_INFO (f)->name_list_element)->cdr, | 11741 if (f && (tem = XCDR (FRAME_X_DISPLAY_INFO (f)->name_list_element), |
11742 key = Fcons (pattern, make_number (maxnames)), | 11742 key = Fcons (pattern, make_number (maxnames)), |
11743 !NILP (list = Fassoc (key, tem)))) | 11743 !NILP (list = Fassoc (key, tem)))) |
11744 { | 11744 { |
11745 list = Fcdr_safe (list); | 11745 list = Fcdr_safe (list); |
11746 /* We have a cashed list. Don't have to get the list again. */ | 11746 /* We have a cashed list. Don't have to get the list again. */ |
11862 XFreeFontNames (names); | 11862 XFreeFontNames (names); |
11863 } | 11863 } |
11864 | 11864 |
11865 /* Now store the result in the cache. */ | 11865 /* Now store the result in the cache. */ |
11866 if (f != NULL) | 11866 if (f != NULL) |
11867 XCONS (FRAME_X_DISPLAY_INFO (f)->name_list_element)->cdr | 11867 XCDR (FRAME_X_DISPLAY_INFO (f)->name_list_element) |
11868 = Fcons (Fcons (key, list), | 11868 = Fcons (Fcons (key, list), |
11869 XCONS (FRAME_X_DISPLAY_INFO (f)->name_list_element)->cdr); | 11869 XCDR (FRAME_X_DISPLAY_INFO (f)->name_list_element)); |
11870 | 11870 |
11871 label_cached: | 11871 label_cached: |
11872 if (NILP (list)) continue; /* Try the remaining alternatives. */ | 11872 if (NILP (list)) continue; /* Try the remaining alternatives. */ |
11873 | 11873 |
11874 newlist = second_best = Qnil; | 11874 newlist = second_best = Qnil; |
11875 /* Make a list of the fonts that have the right width. */ | 11875 /* Make a list of the fonts that have the right width. */ |
11876 for (; CONSP (list); list = XCONS (list)->cdr) | 11876 for (; CONSP (list); list = XCDR (list)) |
11877 { | 11877 { |
11878 int found_size; | 11878 int found_size; |
11879 | 11879 |
11880 tem = XCONS (list)->car; | 11880 tem = XCAR (list); |
11881 | 11881 |
11882 if (!CONSP (tem) || NILP (XCONS (tem)->car)) | 11882 if (!CONSP (tem) || NILP (XCAR (tem))) |
11883 continue; | 11883 continue; |
11884 if (!size) | 11884 if (!size) |
11885 { | 11885 { |
11886 newlist = Fcons (XCONS (tem)->car, newlist); | 11886 newlist = Fcons (XCAR (tem), newlist); |
11887 continue; | 11887 continue; |
11888 } | 11888 } |
11889 | 11889 |
11890 if (!INTEGERP (XCONS (tem)->cdr)) | 11890 if (!INTEGERP (XCDR (tem))) |
11891 { | 11891 { |
11892 /* Since we have not yet known the size of this font, we | 11892 /* Since we have not yet known the size of this font, we |
11893 must try slow function call XLoadQueryFont. */ | 11893 must try slow function call XLoadQueryFont. */ |
11894 XFontStruct *thisinfo; | 11894 XFontStruct *thisinfo; |
11895 | 11895 |
11896 BLOCK_INPUT; | 11896 BLOCK_INPUT; |
11897 count = x_catch_errors (dpy); | 11897 count = x_catch_errors (dpy); |
11898 thisinfo = XLoadQueryFont (dpy, | 11898 thisinfo = XLoadQueryFont (dpy, |
11899 XSTRING (XCONS (tem)->car)->data); | 11899 XSTRING (XCAR (tem))->data); |
11900 if (x_had_errors_p (dpy)) | 11900 if (x_had_errors_p (dpy)) |
11901 { | 11901 { |
11902 /* This error is perhaps due to insufficient memory on X | 11902 /* This error is perhaps due to insufficient memory on X |
11903 server. Let's just ignore it. */ | 11903 server. Let's just ignore it. */ |
11904 thisinfo = NULL; | 11904 thisinfo = NULL; |
11907 x_uncatch_errors (dpy, count); | 11907 x_uncatch_errors (dpy, count); |
11908 UNBLOCK_INPUT; | 11908 UNBLOCK_INPUT; |
11909 | 11909 |
11910 if (thisinfo) | 11910 if (thisinfo) |
11911 { | 11911 { |
11912 XCONS (tem)->cdr | 11912 XCDR (tem) |
11913 = (thisinfo->min_bounds.width == 0 | 11913 = (thisinfo->min_bounds.width == 0 |
11914 ? make_number (0) | 11914 ? make_number (0) |
11915 : make_number (thisinfo->max_bounds.width)); | 11915 : make_number (thisinfo->max_bounds.width)); |
11916 XFreeFont (dpy, thisinfo); | 11916 XFreeFont (dpy, thisinfo); |
11917 } | 11917 } |
11918 else | 11918 else |
11919 /* For unknown reason, the previous call of XListFont had | 11919 /* For unknown reason, the previous call of XListFont had |
11920 returned a font which can't be opened. Record the size | 11920 returned a font which can't be opened. Record the size |
11921 as 0 not to try to open it again. */ | 11921 as 0 not to try to open it again. */ |
11922 XCONS (tem)->cdr = make_number (0); | 11922 XCDR (tem) = make_number (0); |
11923 } | 11923 } |
11924 | 11924 |
11925 found_size = XINT (XCONS (tem)->cdr); | 11925 found_size = XINT (XCDR (tem)); |
11926 if (found_size == size) | 11926 if (found_size == size) |
11927 newlist = Fcons (XCONS (tem)->car, newlist); | 11927 newlist = Fcons (XCAR (tem), newlist); |
11928 else if (found_size > 0) | 11928 else if (found_size > 0) |
11929 { | 11929 { |
11930 if (NILP (second_best)) | 11930 if (NILP (second_best)) |
11931 second_best = tem; | 11931 second_best = tem; |
11932 else if (found_size < size) | 11932 else if (found_size < size) |
11933 { | 11933 { |
11934 if (XINT (XCONS (second_best)->cdr) > size | 11934 if (XINT (XCDR (second_best)) > size |
11935 || XINT (XCONS (second_best)->cdr) < found_size) | 11935 || XINT (XCDR (second_best)) < found_size) |
11936 second_best = tem; | 11936 second_best = tem; |
11937 } | 11937 } |
11938 else | 11938 else |
11939 { | 11939 { |
11940 if (XINT (XCONS (second_best)->cdr) > size | 11940 if (XINT (XCDR (second_best)) > size |
11941 && XINT (XCONS (second_best)->cdr) > found_size) | 11941 && XINT (XCDR (second_best)) > found_size) |
11942 second_best = tem; | 11942 second_best = tem; |
11943 } | 11943 } |
11944 } | 11944 } |
11945 } | 11945 } |
11946 if (!NILP (newlist)) | 11946 if (!NILP (newlist)) |
11947 break; | 11947 break; |
11948 else if (!NILP (second_best)) | 11948 else if (!NILP (second_best)) |
11949 { | 11949 { |
11950 newlist = Fcons (XCONS (second_best)->car, Qnil); | 11950 newlist = Fcons (XCAR (second_best), Qnil); |
11951 break; | 11951 break; |
11952 } | 11952 } |
11953 } | 11953 } |
11954 | 11954 |
11955 return newlist; | 11955 return newlist; |
12069 { | 12069 { |
12070 Lisp_Object tail; | 12070 Lisp_Object tail; |
12071 int i; | 12071 int i; |
12072 | 12072 |
12073 for (i = 0; i < dpyinfo->n_fonts; i++) | 12073 for (i = 0; i < dpyinfo->n_fonts; i++) |
12074 for (tail = font_names; CONSP (tail); tail = XCONS (tail)->cdr) | 12074 for (tail = font_names; CONSP (tail); tail = XCDR (tail)) |
12075 if (dpyinfo->font_table[i].name | 12075 if (dpyinfo->font_table[i].name |
12076 && (!strcmp (dpyinfo->font_table[i].name, | 12076 && (!strcmp (dpyinfo->font_table[i].name, |
12077 XSTRING (XCONS (tail)->car)->data) | 12077 XSTRING (XCAR (tail))->data) |
12078 || !strcmp (dpyinfo->font_table[i].full_name, | 12078 || !strcmp (dpyinfo->font_table[i].full_name, |
12079 XSTRING (XCONS (tail)->car)->data))) | 12079 XSTRING (XCAR (tail))->data))) |
12080 return (dpyinfo->font_table + i); | 12080 return (dpyinfo->font_table + i); |
12081 } | 12081 } |
12082 | 12082 |
12083 /* Load the font and add it to the table. */ | 12083 /* Load the font and add it to the table. */ |
12084 { | 12084 { |
12092 not, we still try to load a font by the name given as FONTNAME | 12092 not, we still try to load a font by the name given as FONTNAME |
12093 because XListFonts (called in x_list_font) of some X server has | 12093 because XListFonts (called in x_list_font) of some X server has |
12094 a bug of not finding a font even if the font surely exists and | 12094 a bug of not finding a font even if the font surely exists and |
12095 is loadable by XLoadQueryFont. */ | 12095 is loadable by XLoadQueryFont. */ |
12096 if (size > 0 && !NILP (font_names)) | 12096 if (size > 0 && !NILP (font_names)) |
12097 fontname = (char *) XSTRING (XCONS (font_names)->car)->data; | 12097 fontname = (char *) XSTRING (XCAR (font_names))->data; |
12098 | 12098 |
12099 BLOCK_INPUT; | 12099 BLOCK_INPUT; |
12100 count = x_catch_errors (FRAME_X_DISPLAY (f)); | 12100 count = x_catch_errors (FRAME_X_DISPLAY (f)); |
12101 font = (XFontStruct *) XLoadQueryFont (FRAME_X_DISPLAY (f), fontname); | 12101 font = (XFontStruct *) XLoadQueryFont (FRAME_X_DISPLAY (f), fontname); |
12102 if (x_had_errors_p (FRAME_X_DISPLAY (f))) | 12102 if (x_had_errors_p (FRAME_X_DISPLAY (f))) |
12188 the head of this block. Let's store this information in | 12188 the head of this block. Let's store this information in |
12189 the cache for x_list_fonts. */ | 12189 the cache for x_list_fonts. */ |
12190 Lisp_Object lispy_name = build_string (fontname); | 12190 Lisp_Object lispy_name = build_string (fontname); |
12191 Lisp_Object lispy_full_name = build_string (fontp->full_name); | 12191 Lisp_Object lispy_full_name = build_string (fontp->full_name); |
12192 | 12192 |
12193 XCONS (dpyinfo->name_list_element)->cdr | 12193 XCDR (dpyinfo->name_list_element) |
12194 = Fcons (Fcons (Fcons (lispy_name, make_number (256)), | 12194 = Fcons (Fcons (Fcons (lispy_name, make_number (256)), |
12195 Fcons (Fcons (lispy_full_name, | 12195 Fcons (Fcons (lispy_full_name, |
12196 make_number (fontp->size)), | 12196 make_number (fontp->size)), |
12197 Qnil)), | 12197 Qnil)), |
12198 XCONS (dpyinfo->name_list_element)->cdr); | 12198 XCDR (dpyinfo->name_list_element)); |
12199 if (full_name) | 12199 if (full_name) |
12200 XCONS (dpyinfo->name_list_element)->cdr | 12200 XCDR (dpyinfo->name_list_element) |
12201 = Fcons (Fcons (Fcons (lispy_full_name, make_number (256)), | 12201 = Fcons (Fcons (Fcons (lispy_full_name, make_number (256)), |
12202 Fcons (Fcons (lispy_full_name, | 12202 Fcons (Fcons (lispy_full_name, |
12203 make_number (fontp->size)), | 12203 make_number (fontp->size)), |
12204 Qnil)), | 12204 Qnil)), |
12205 XCONS (dpyinfo->name_list_element)->cdr); | 12205 XCDR (dpyinfo->name_list_element)); |
12206 } | 12206 } |
12207 | 12207 |
12208 /* The slot `encoding' specifies how to map a character | 12208 /* The slot `encoding' specifies how to map a character |
12209 code-points (0x20..0x7F or 0x2020..0x7F7F) of each charset to | 12209 code-points (0x20..0x7F or 0x2020..0x7F7F) of each charset to |
12210 the font code-points (0:0x20..0x7F, 1:0xA0..0xFF, 0:0x2020..0x7F7F, | 12210 the font code-points (0:0x20..0x7F, 1:0xA0..0xFF, 0:0x2020..0x7F7F, |
12286 x_find_ccl_program (fontp) | 12286 x_find_ccl_program (fontp) |
12287 struct font_info *fontp; | 12287 struct font_info *fontp; |
12288 { | 12288 { |
12289 Lisp_Object list, elt; | 12289 Lisp_Object list, elt; |
12290 | 12290 |
12291 for (list = Vfont_ccl_encoder_alist; CONSP (list); list = XCONS (list)->cdr) | 12291 for (list = Vfont_ccl_encoder_alist; CONSP (list); list = XCDR (list)) |
12292 { | 12292 { |
12293 elt = XCONS (list)->car; | 12293 elt = XCAR (list); |
12294 if (CONSP (elt) | 12294 if (CONSP (elt) |
12295 && STRINGP (XCONS (elt)->car) | 12295 && STRINGP (XCAR (elt)) |
12296 && (fast_c_string_match_ignore_case (XCONS (elt)->car, fontp->name) | 12296 && (fast_c_string_match_ignore_case (XCAR (elt), fontp->name) |
12297 >= 0)) | 12297 >= 0)) |
12298 break; | 12298 break; |
12299 } | 12299 } |
12300 if (! NILP (list)) | 12300 if (! NILP (list)) |
12301 { | 12301 { |
12302 struct ccl_program *ccl | 12302 struct ccl_program *ccl |
12303 = (struct ccl_program *) xmalloc (sizeof (struct ccl_program)); | 12303 = (struct ccl_program *) xmalloc (sizeof (struct ccl_program)); |
12304 | 12304 |
12305 if (setup_ccl_program (ccl, XCONS (elt)->cdr) < 0) | 12305 if (setup_ccl_program (ccl, XCDR (elt)) < 0) |
12306 xfree (ccl); | 12306 xfree (ccl); |
12307 else | 12307 else |
12308 fontp->font_encoder = ccl; | 12308 fontp->font_encoder = ccl; |
12309 } | 12309 } |
12310 } | 12310 } |
12485 { | 12485 { |
12486 struct x_display_info *share; | 12486 struct x_display_info *share; |
12487 Lisp_Object tail; | 12487 Lisp_Object tail; |
12488 | 12488 |
12489 for (share = x_display_list, tail = x_display_name_list; share; | 12489 for (share = x_display_list, tail = x_display_name_list; share; |
12490 share = share->next, tail = XCONS (tail)->cdr) | 12490 share = share->next, tail = XCDR (tail)) |
12491 if (same_x_server (XSTRING (XCONS (XCONS (tail)->car)->car)->data, | 12491 if (same_x_server (XSTRING (XCAR (XCAR (tail)))->data, |
12492 XSTRING (display_name)->data)) | 12492 XSTRING (display_name)->data)) |
12493 break; | 12493 break; |
12494 if (share) | 12494 if (share) |
12495 dpyinfo->kboard = share->kboard; | 12495 dpyinfo->kboard = share->kboard; |
12496 else | 12496 else |
12522 x_display_list = dpyinfo; | 12522 x_display_list = dpyinfo; |
12523 | 12523 |
12524 /* Put it on x_display_name_list as well, to keep them parallel. */ | 12524 /* Put it on x_display_name_list as well, to keep them parallel. */ |
12525 x_display_name_list = Fcons (Fcons (display_name, Qnil), | 12525 x_display_name_list = Fcons (Fcons (display_name, Qnil), |
12526 x_display_name_list); | 12526 x_display_name_list); |
12527 dpyinfo->name_list_element = XCONS (x_display_name_list)->car; | 12527 dpyinfo->name_list_element = XCAR (x_display_name_list); |
12528 | 12528 |
12529 dpyinfo->display = dpy; | 12529 dpyinfo->display = dpy; |
12530 | 12530 |
12531 #if 0 | 12531 #if 0 |
12532 XSetAfterFunction (x_current_display, x_trace_wire); | 12532 XSetAfterFunction (x_current_display, x_trace_wire); |
12741 delete_keyboard_wait_descriptor (dpyinfo->connection); | 12741 delete_keyboard_wait_descriptor (dpyinfo->connection); |
12742 | 12742 |
12743 /* Discard this display from x_display_name_list and x_display_list. | 12743 /* Discard this display from x_display_name_list and x_display_list. |
12744 We can't use Fdelq because that can quit. */ | 12744 We can't use Fdelq because that can quit. */ |
12745 if (! NILP (x_display_name_list) | 12745 if (! NILP (x_display_name_list) |
12746 && EQ (XCONS (x_display_name_list)->car, dpyinfo->name_list_element)) | 12746 && EQ (XCAR (x_display_name_list), dpyinfo->name_list_element)) |
12747 x_display_name_list = XCONS (x_display_name_list)->cdr; | 12747 x_display_name_list = XCDR (x_display_name_list); |
12748 else | 12748 else |
12749 { | 12749 { |
12750 Lisp_Object tail; | 12750 Lisp_Object tail; |
12751 | 12751 |
12752 tail = x_display_name_list; | 12752 tail = x_display_name_list; |
12753 while (CONSP (tail) && CONSP (XCONS (tail)->cdr)) | 12753 while (CONSP (tail) && CONSP (XCDR (tail))) |
12754 { | 12754 { |
12755 if (EQ (XCONS (XCONS (tail)->cdr)->car, | 12755 if (EQ (XCAR (XCDR (tail)), |
12756 dpyinfo->name_list_element)) | 12756 dpyinfo->name_list_element)) |
12757 { | 12757 { |
12758 XCONS (tail)->cdr = XCONS (XCONS (tail)->cdr)->cdr; | 12758 XCDR (tail) = XCDR (XCDR (tail)); |
12759 break; | 12759 break; |
12760 } | 12760 } |
12761 tail = XCONS (tail)->cdr; | 12761 tail = XCDR (tail); |
12762 } | 12762 } |
12763 } | 12763 } |
12764 | 12764 |
12765 if (x_display_list == dpyinfo) | 12765 if (x_display_list == dpyinfo) |
12766 x_display_list = dpyinfo->next; | 12766 x_display_list = dpyinfo->next; |