comparison src/xdisp.c @ 9104:610e18fd64a9

(redisplay, mark_window_display_accurate, try_window_id, display_text_line, display_mode_element, decode_mode_spec, display_string): Use type test macros.
author Karl Heuer <kwzh@gnu.org>
date Tue, 27 Sep 1994 00:37:04 +0000
parents f29b14d21b26
children db4473eb2265
comparison
equal deleted inserted replaced
9103:948e8acb6990 9104:610e18fd64a9
636 && (XFASTINT (w->last_modified) >= MODIFF 636 && (XFASTINT (w->last_modified) >= MODIFF
637 || (beg_unchanged >= tlbufpos - 1 637 || (beg_unchanged >= tlbufpos - 1
638 && GPT >= tlbufpos 638 && GPT >= tlbufpos
639 /* If selective display, can't optimize 639 /* If selective display, can't optimize
640 if the changes start at the beginning of the line. */ 640 if the changes start at the beginning of the line. */
641 && ((XTYPE (current_buffer->selective_display) == Lisp_Int 641 && ((INTEGERP (current_buffer->selective_display)
642 && XINT (current_buffer->selective_display) > 0 642 && XINT (current_buffer->selective_display) > 0
643 ? (beg_unchanged >= tlbufpos 643 ? (beg_unchanged >= tlbufpos
644 && GPT > tlbufpos) 644 && GPT > tlbufpos)
645 : 1)) 645 : 1))
646 && end_unchanged >= tlendpos 646 && end_unchanged >= tlendpos
788 788
789 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) 789 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr)
790 { 790 {
791 FRAME_PTR f; 791 FRAME_PTR f;
792 792
793 if (XTYPE (XCONS (tail)->car) != Lisp_Frame) 793 if (!FRAMEP (XCONS (tail)->car))
794 continue; 794 continue;
795 795
796 f = XFRAME (XCONS (tail)->car); 796 f = XFRAME (XCONS (tail)->car);
797 if (FRAME_VISIBLE_P (f)) 797 if (FRAME_VISIBLE_P (f))
798 { 798 {
926 { 926 {
927 register struct window *w; 927 register struct window *w;
928 928
929 for (;!NILP (window); window = w->next) 929 for (;!NILP (window); window = w->next)
930 { 930 {
931 if (XTYPE (window) != Lisp_Window) abort (); 931 if (!WINDOWP (window)) abort ();
932 w = XWINDOW (window); 932 w = XWINDOW (window);
933 933
934 if (!NILP (w->buffer)) 934 if (!NILP (w->buffer))
935 { 935 {
936 XFASTINT (w->last_modified) 936 XFASTINT (w->last_modified)
1461 int lmargin = hscroll > 0 ? 1 - hscroll : 0; 1461 int lmargin = hscroll > 0 ? 1 - hscroll : 0;
1462 register int vpos; 1462 register int vpos;
1463 register int i, tem; 1463 register int i, tem;
1464 int last_text_vpos = 0; 1464 int last_text_vpos = 0;
1465 int stop_vpos; 1465 int stop_vpos;
1466 int selective 1466 int selective = (INTEGERP (current_buffer->selective_display)
1467 = XTYPE (current_buffer->selective_display) == Lisp_Int 1467 ? XINT (current_buffer->selective_display)
1468 ? XINT (current_buffer->selective_display) 1468 : !NILP (current_buffer->selective_display) ? -1 : 0);
1469 : !NILP (current_buffer->selective_display) ? -1 : 0;
1470 1469
1471 struct position val, bp, ep, xp, pp; 1470 struct position val, bp, ep, xp, pp;
1472 int scroll_amount = 0; 1471 int scroll_amount = 0;
1473 int delta; 1472 int delta;
1474 int tab_offset, epto; 1473 int tab_offset, epto;
2031 /* 1 if we should highlight the region. */ 2030 /* 1 if we should highlight the region. */
2032 int highlight_region 2031 int highlight_region
2033 = !NILP (Vtransient_mark_mode) && !NILP (current_buffer->mark_active); 2032 = !NILP (Vtransient_mark_mode) && !NILP (current_buffer->mark_active);
2034 int region_beg, region_end; 2033 int region_beg, region_end;
2035 2034
2036 int selective 2035 int selective = (INTEGERP (current_buffer->selective_display)
2037 = XTYPE (current_buffer->selective_display) == Lisp_Int 2036 ? XINT (current_buffer->selective_display)
2038 ? XINT (current_buffer->selective_display) 2037 : !NILP (current_buffer->selective_display) ? -1 : 0);
2039 : !NILP (current_buffer->selective_display) ? -1 : 0;
2040 register struct frame_glyphs *desired_glyphs = FRAME_DESIRED_GLYPHS (f); 2038 register struct frame_glyphs *desired_glyphs = FRAME_DESIRED_GLYPHS (f);
2041 register struct Lisp_Vector *dp = window_display_table (w); 2039 register struct Lisp_Vector *dp = window_display_table (w);
2042 2040
2043 Lisp_Object default_invis_vector[3]; 2041 Lisp_Object default_invis_vector[3];
2044 /* Nonzero means display something where there are invisible lines. 2042 /* Nonzero means display something where there are invisible lines.
2045 The precise value is the number of glyphs to display. */ 2043 The precise value is the number of glyphs to display. */
2046 int selective_rlen 2044 int selective_rlen
2047 = (selective && dp && XTYPE (DISP_INVIS_VECTOR (dp)) == Lisp_Vector 2045 = (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp))
2048 ? XVECTOR (DISP_INVIS_VECTOR (dp))->size 2046 ? XVECTOR (DISP_INVIS_VECTOR (dp))->size
2049 : selective && !NILP (current_buffer->selective_display_ellipses) 2047 : selective && !NILP (current_buffer->selective_display_ellipses)
2050 ? 3 : 0); 2048 ? 3 : 0);
2051 /* This is the sequence of Lisp objects to display 2049 /* This is the sequence of Lisp objects to display
2052 when there are invisible lines. */ 2050 when there are invisible lines. */
2053 Lisp_Object *invis_vector_contents 2051 Lisp_Object *invis_vector_contents
2054 = (dp && XTYPE (DISP_INVIS_VECTOR (dp)) == Lisp_Vector 2052 = (dp && VECTORP (DISP_INVIS_VECTOR (dp))
2055 ? XVECTOR (DISP_INVIS_VECTOR (dp))->contents 2053 ? XVECTOR (DISP_INVIS_VECTOR (dp))->contents
2056 : default_invis_vector); 2054 : default_invis_vector);
2057 2055
2058 GLYPH truncator = (dp == 0 || XTYPE (DISP_TRUNC_GLYPH (dp)) != Lisp_Int 2056 GLYPH truncator = (dp == 0 || !INTEGERP (DISP_TRUNC_GLYPH (dp))
2059 ? '$' : XINT (DISP_TRUNC_GLYPH (dp))); 2057 ? '$' : XINT (DISP_TRUNC_GLYPH (dp)));
2060 GLYPH continuer = (dp == 0 || XTYPE (DISP_CONTINUE_GLYPH (dp)) != Lisp_Int 2058 GLYPH continuer = (dp == 0 || !INTEGERP (DISP_CONTINUE_GLYPH (dp))
2061 ? '\\' : XINT (DISP_CONTINUE_GLYPH (dp))); 2059 ? '\\' : XINT (DISP_CONTINUE_GLYPH (dp)));
2062 2060
2063 /* The next buffer location at which the face should change, due 2061 /* The next buffer location at which the face should change, due
2064 to overlays or text property changes. */ 2062 to overlays or text property changes. */
2065 int next_face_change; 2063 int next_face_change;
2229 2227
2230 p = &FETCH_CHAR (pos); 2228 p = &FETCH_CHAR (pos);
2231 } 2229 }
2232 c = *p++; 2230 c = *p++;
2233 if (c >= 040 && c < 0177 2231 if (c >= 040 && c < 0177
2234 && (dp == 0 || XTYPE (DISP_CHAR_VECTOR (dp, c)) != Lisp_Vector)) 2232 && (dp == 0 || !VECTORP (DISP_CHAR_VECTOR (dp, c))))
2235 { 2233 {
2236 if (p1 >= leftmargin) 2234 if (p1 >= leftmargin)
2237 *p1 = MAKE_GLYPH (f, c, current_face); 2235 *p1 = MAKE_GLYPH (f, c, current_face);
2238 p1++; 2236 p1++;
2239 } 2237 }
2305 *p1++ = FAST_MAKE_GLYPH (' ', current_face); 2303 *p1++ = FAST_MAKE_GLYPH (' ', current_face);
2306 } 2304 }
2307 #endif 2305 #endif
2308 break; 2306 break;
2309 } 2307 }
2310 else if (dp != 0 && XTYPE (DISP_CHAR_VECTOR (dp, c)) == Lisp_Vector) 2308 else if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c)))
2311 { 2309 {
2312 p1 = copy_part_of_rope (f, p1, leftmargin, 2310 p1 = copy_part_of_rope (f, p1, leftmargin,
2313 XVECTOR (DISP_CHAR_VECTOR (dp, c))->contents, 2311 XVECTOR (DISP_CHAR_VECTOR (dp, c))->contents,
2314 XVECTOR (DISP_CHAR_VECTOR (dp, c))->size, 2312 XVECTOR (DISP_CHAR_VECTOR (dp, c))->size,
2315 current_face); 2313 current_face);
2316 } 2314 }
2317 else if (c < 0200 && ctl_arrow) 2315 else if (c < 0200 && ctl_arrow)
2318 { 2316 {
2319 if (p1 >= leftmargin) 2317 if (p1 >= leftmargin)
2320 *p1 = fix_glyph (f, (dp && XTYPE (DISP_CTRL_GLYPH (dp)) == Lisp_Int 2318 *p1 = fix_glyph (f, (dp && INTEGERP (DISP_CTRL_GLYPH (dp))
2321 ? XINT (DISP_CTRL_GLYPH (dp)) : '^'), 2319 ? XINT (DISP_CTRL_GLYPH (dp)) : '^'),
2322 current_face); 2320 current_face);
2323 p1++; 2321 p1++;
2324 if (p1 >= leftmargin && p1 < endp) 2322 if (p1 >= leftmargin && p1 < endp)
2325 *p1 = MAKE_GLYPH (f, c ^ 0100, current_face); 2323 *p1 = MAKE_GLYPH (f, c ^ 0100, current_face);
2326 p1++; 2324 p1++;
2327 } 2325 }
2328 else 2326 else
2329 { 2327 {
2330 if (p1 >= leftmargin) 2328 if (p1 >= leftmargin)
2331 *p1 = fix_glyph (f, (dp && XTYPE (DISP_ESCAPE_GLYPH (dp)) == Lisp_Int 2329 *p1 = fix_glyph (f, (dp && INTEGERP (DISP_ESCAPE_GLYPH (dp))
2332 ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'), 2330 ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'),
2333 current_face); 2331 current_face);
2334 p1++; 2332 p1++;
2335 if (p1 >= leftmargin && p1 < endp) 2333 if (p1 >= leftmargin && p1 < endp)
2336 *p1 = MAKE_GLYPH (f, (c >> 6) + '0', current_face); 2334 *p1 = MAKE_GLYPH (f, (c >> 6) + '0', current_face);
2520 desired_glyphs->glyphs[vpos][desired_glyphs->used[vpos]] = 0; 2518 desired_glyphs->glyphs[vpos][desired_glyphs->used[vpos]] = 0;
2521 2519
2522 /* If the start of this line is the overlay arrow-position, 2520 /* If the start of this line is the overlay arrow-position,
2523 then put the arrow string into the display-line. */ 2521 then put the arrow string into the display-line. */
2524 2522
2525 if (XTYPE (Voverlay_arrow_position) == Lisp_Marker 2523 if (MARKERP (Voverlay_arrow_position)
2526 && current_buffer == XMARKER (Voverlay_arrow_position)->buffer 2524 && current_buffer == XMARKER (Voverlay_arrow_position)->buffer
2527 && start == marker_position (Voverlay_arrow_position) 2525 && start == marker_position (Voverlay_arrow_position)
2528 && XTYPE (Voverlay_arrow_string) == Lisp_String 2526 && STRINGP (Voverlay_arrow_string)
2529 && ! overlay_arrow_seen) 2527 && ! overlay_arrow_seen)
2530 { 2528 {
2531 unsigned char *p = XSTRING (Voverlay_arrow_string)->data; 2529 unsigned char *p = XSTRING (Voverlay_arrow_string)->data;
2532 int i; 2530 int i;
2533 int len = XSTRING (Voverlay_arrow_string)->size; 2531 int len = XSTRING (Voverlay_arrow_string)->size;
2780 if (!NILP (tem)) 2778 if (!NILP (tem))
2781 { 2779 {
2782 tem = Fsymbol_value (elt); 2780 tem = Fsymbol_value (elt);
2783 /* If value is a string, output that string literally: 2781 /* If value is a string, output that string literally:
2784 don't check for % within it. */ 2782 don't check for % within it. */
2785 if (XTYPE (tem) == Lisp_String) 2783 if (STRINGP (tem))
2786 { 2784 {
2787 if (frame_title_ptr) 2785 if (frame_title_ptr)
2788 hpos = store_frame_title (XSTRING (tem)->data, 2786 hpos = store_frame_title (XSTRING (tem)->data,
2789 minendcol, maxendcol); 2787 minendcol, maxendcol);
2790 else 2788 else
2810 at most that many characters. If positive, pad (with spaces) 2808 at most that many characters. If positive, pad (with spaces)
2811 to at least that many characters. 2809 to at least that many characters.
2812 If first element is a symbol, process the cadr or caddr recursively 2810 If first element is a symbol, process the cadr or caddr recursively
2813 according to whether the symbol's value is non-nil or nil. */ 2811 according to whether the symbol's value is non-nil or nil. */
2814 car = XCONS (elt)->car; 2812 car = XCONS (elt)->car;
2815 if (XTYPE (car) == Lisp_Symbol) 2813 if (SYMBOLP (car))
2816 { 2814 {
2817 tem = Fboundp (car); 2815 tem = Fboundp (car);
2818 elt = XCONS (elt)->cdr; 2816 elt = XCONS (elt)->cdr;
2819 if (XTYPE (elt) != Lisp_Cons) 2817 if (!CONSP (elt))
2820 goto invalid; 2818 goto invalid;
2821 /* elt is now the cdr, and we know it is a cons cell. 2819 /* elt is now the cdr, and we know it is a cons cell.
2822 Use its car if CAR has a non-nil value. */ 2820 Use its car if CAR has a non-nil value. */
2823 if (!NILP (tem)) 2821 if (!NILP (tem))
2824 { 2822 {
2830 Get the cddr of the original list 2828 Get the cddr of the original list
2831 and if possible find the caddr and use that. */ 2829 and if possible find the caddr and use that. */
2832 elt = XCONS (elt)->cdr; 2830 elt = XCONS (elt)->cdr;
2833 if (NILP (elt)) 2831 if (NILP (elt))
2834 break; 2832 break;
2835 else if (XTYPE (elt) != Lisp_Cons) 2833 else if (!CONSP (elt))
2836 goto invalid; 2834 goto invalid;
2837 elt = XCONS (elt)->car; 2835 elt = XCONS (elt)->car;
2838 goto tail_recurse; 2836 goto tail_recurse;
2839 } 2837 }
2840 else if (XTYPE (car) == Lisp_Int) 2838 else if (INTEGERP (car))
2841 { 2839 {
2842 register int lim = XINT (car); 2840 register int lim = XINT (car);
2843 elt = XCONS (elt)->cdr; 2841 elt = XCONS (elt)->cdr;
2844 if (lim < 0) 2842 if (lim < 0)
2845 /* Negative int means reduce maximum width. 2843 /* Negative int means reduce maximum width.
2860 if (lim > minendcol) 2858 if (lim > minendcol)
2861 minendcol = lim; 2859 minendcol = lim;
2862 } 2860 }
2863 goto tail_recurse; 2861 goto tail_recurse;
2864 } 2862 }
2865 else if (XTYPE (car) == Lisp_String || XTYPE (car) == Lisp_Cons) 2863 else if (STRINGP (car) || CONSP (car))
2866 { 2864 {
2867 register int limit = 50; 2865 register int limit = 50;
2868 /* LIMIT is to protect against circular lists. */ 2866 /* LIMIT is to protect against circular lists. */
2869 while (XTYPE (elt) == Lisp_Cons && --limit > 0 2867 while (CONSP (elt) && --limit > 0
2870 && hpos < maxendcol) 2868 && hpos < maxendcol)
2871 { 2869 {
2872 hpos = display_mode_element (w, vpos, hpos, depth, 2870 hpos = display_mode_element (w, vpos, hpos, depth,
2873 hpos, maxendcol, 2871 hpos, maxendcol,
2874 XCONS (elt)->car); 2872 XCONS (elt)->car);
2934 case 'f': 2932 case 'f':
2935 obj = b->filename; 2933 obj = b->filename;
2936 #if 0 2934 #if 0
2937 if (NILP (obj)) 2935 if (NILP (obj))
2938 return "[none]"; 2936 return "[none]";
2939 else if (XTYPE (obj) == Lisp_String && XSTRING (obj)->size > maxwidth) 2937 else if (STRINGP (obj) && XSTRING (obj)->size > maxwidth)
2940 { 2938 {
2941 bcopy ("...", decode_mode_spec_buf, 3); 2939 bcopy ("...", decode_mode_spec_buf, 3);
2942 bcopy (XSTRING (obj)->data + XSTRING (obj)->size - maxwidth + 3, 2940 bcopy (XSTRING (obj)->data + XSTRING (obj)->size - maxwidth + 3,
2943 decode_mode_spec_buf + 3, maxwidth - 3); 2941 decode_mode_spec_buf + 3, maxwidth - 3);
2944 return decode_mode_spec_buf; 2942 return decode_mode_spec_buf;
3181 } 3179 }
3182 return decode_mode_spec_buf; 3180 return decode_mode_spec_buf;
3183 } 3181 }
3184 } 3182 }
3185 3183
3186 if (XTYPE (obj) == Lisp_String) 3184 if (STRINGP (obj))
3187 return (char *) XSTRING (obj)->data; 3185 return (char *) XSTRING (obj)->data;
3188 else 3186 else
3189 return ""; 3187 return "";
3190 } 3188 }
3191 3189
3367 /* Use the standard display table, not the window's display table. 3365 /* Use the standard display table, not the window's display table.
3368 We don't want the mode line in rot13. */ 3366 We don't want the mode line in rot13. */
3369 register struct Lisp_Vector *dp = 0; 3367 register struct Lisp_Vector *dp = 0;
3370 int i; 3368 int i;
3371 3369
3372 if (XTYPE (Vstandard_display_table) == Lisp_Vector 3370 if (VECTORP (Vstandard_display_table)
3373 && XVECTOR (Vstandard_display_table)->size == DISP_TABLE_SIZE) 3371 && XVECTOR (Vstandard_display_table)->size == DISP_TABLE_SIZE)
3374 dp = XVECTOR (Vstandard_display_table); 3372 dp = XVECTOR (Vstandard_display_table);
3375 3373
3376 if (tab_width <= 0 || tab_width > 1000) tab_width = 8; 3374 if (tab_width <= 0 || tab_width > 1000) tab_width = 8;
3377 3375
3418 /* Unspecified length (null-terminated string). */ 3416 /* Unspecified length (null-terminated string). */
3419 else if (c == 0) 3417 else if (c == 0)
3420 break; 3418 break;
3421 3419
3422 if (c >= 040 && c < 0177 3420 if (c >= 040 && c < 0177
3423 && (dp == 0 || XTYPE (DISP_CHAR_VECTOR (dp, c)) != Lisp_Vector)) 3421 && (dp == 0 || !VECTORP (DISP_CHAR_VECTOR (dp, c))))
3424 { 3422 {
3425 if (p1 >= start) 3423 if (p1 >= start)
3426 *p1 = c; 3424 *p1 = c;
3427 p1++; 3425 p1++;
3428 } 3426 }
3434 *p1 = SPACEGLYPH; 3432 *p1 = SPACEGLYPH;
3435 p1++; 3433 p1++;
3436 } 3434 }
3437 while ((p1 - start + hscroll - (hscroll > 0)) % tab_width); 3435 while ((p1 - start + hscroll - (hscroll > 0)) % tab_width);
3438 } 3436 }
3439 else if (dp != 0 && XTYPE (DISP_CHAR_VECTOR (dp, c)) == Lisp_Vector) 3437 else if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c)))
3440 { 3438 {
3441 p1 = copy_part_of_rope (f, p1, start, 3439 p1 = copy_part_of_rope (f, p1, start,
3442 XVECTOR (DISP_CHAR_VECTOR (dp, c))->contents, 3440 XVECTOR (DISP_CHAR_VECTOR (dp, c))->contents,
3443 XVECTOR (DISP_CHAR_VECTOR (dp, c))->size, 3441 XVECTOR (DISP_CHAR_VECTOR (dp, c))->size,
3444 0); 3442 0);
3445 } 3443 }
3446 else if (c < 0200 && ! NILP (buffer_defaults.ctl_arrow)) 3444 else if (c < 0200 && ! NILP (buffer_defaults.ctl_arrow))
3447 { 3445 {
3448 if (p1 >= start) 3446 if (p1 >= start)
3449 *p1 = fix_glyph (f, (dp && XTYPE (DISP_CTRL_GLYPH (dp)) == Lisp_Int 3447 *p1 = fix_glyph (f, (dp && INTEGERP (DISP_CTRL_GLYPH (dp))
3450 ? XINT (DISP_CTRL_GLYPH (dp)) : '^'), 3448 ? XINT (DISP_CTRL_GLYPH (dp)) : '^'),
3451 0); 3449 0);
3452 p1++; 3450 p1++;
3453 if (p1 >= start && p1 < end) 3451 if (p1 >= start && p1 < end)
3454 *p1 = c ^ 0100; 3452 *p1 = c ^ 0100;
3455 p1++; 3453 p1++;
3456 } 3454 }
3457 else 3455 else
3458 { 3456 {
3459 if (p1 >= start) 3457 if (p1 >= start)
3460 *p1 = fix_glyph (f, (dp && XTYPE (DISP_ESCAPE_GLYPH (dp)) == Lisp_Int 3458 *p1 = fix_glyph (f, (dp && INTEGERP (DISP_ESCAPE_GLYPH (dp))
3461 ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'), 3459 ? XINT (DISP_ESCAPE_GLYPH (dp)) : '\\'),
3462 0); 3460 0);
3463 p1++; 3461 p1++;
3464 if (p1 >= start && p1 < end) 3462 if (p1 >= start && p1 < end)
3465 *p1 = (c >> 6) + '0'; 3463 *p1 = (c >> 6) + '0';