diff options
| author | Ken Raeburn | 2000-04-01 12:59:53 +0000 |
|---|---|---|
| committer | Ken Raeburn | 2000-04-01 12:59:53 +0000 |
| commit | 6fc556fdb41c112247d113d46cc215e73c9e2b3c (patch) | |
| tree | a20ad3402c54ab221bcb86ca383107f584e237d6 /src | |
| parent | 3578db3c162c8a5b948ca7936bdaf596a83e49a4 (diff) | |
| download | emacs-6fc556fdb41c112247d113d46cc215e73c9e2b3c.tar.gz emacs-6fc556fdb41c112247d113d46cc215e73c9e2b3c.zip | |
Fix Lisp_Object/int type confusion revealed by making Lisp_Object a union type:
* xdisp.c (compute_string_pos): Fix order of arguments to
string_pos_nchars_ahead.
(handle_fontified_prop, add_to_log): Pass int, not Lisp_Object, as
count arg to variable-arg routines like Frun_hook_with_args and Fformat.
(back_to_previous_visible_line_start, build_desired_tool_bar_string):
Pass Lisp_Object, not int, to fixed-arg routines like
Fget_char_property and Fmake_string.
(reconsider_clip_changes): Use XINT when comparing integer lisp
objects, or passing them as int arguments.
(mark_window_display_accurate, insert_left_trunc_glyphs, append_space,
extend_face_to_end_of_line): Use make_number when storing or passing
integer values as lisp objects.
(set_cursor_from_row, highlight_trailing_whitespace): Use INTEGERP,
not implicit test against zero, for glyph object.
(try_window_id): Don't use make_number when we want an int value.
* xfaces.c (xlfd_symbolic_value): Make last argument a Lisp_Object, to
be consistent with callers.
(Fbitmap_spec_p): Use XINT to get numeric value of height.
(lface_hash): Apply XFASTINT to lisp values before folding in.
* xfns.c (Fx_show_tip): Use make_number to get lisp objects to fill in window
width and height. Pass an int, not a lisp object, as first arg to Finsert.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 26 | ||||
| -rw-r--r-- | src/xdisp.c | 38 | ||||
| -rw-r--r-- | src/xfaces.c | 13 | ||||
| -rw-r--r-- | src/xfns.c | 6 |
4 files changed, 56 insertions, 27 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 4d493cc7ae1..1bfc02e5d8b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -8,6 +8,32 @@ | |||
| 8 | (shrink_window_lowest_first): w->top is Lisp_Object; use XINT. | 8 | (shrink_window_lowest_first): w->top is Lisp_Object; use XINT. |
| 9 | (grow_mini_window): Fix typo getting int value of root->height. | 9 | (grow_mini_window): Fix typo getting int value of root->height. |
| 10 | 10 | ||
| 11 | * xdisp.c (compute_string_pos): Fix order of arguments to | ||
| 12 | string_pos_nchars_ahead. | ||
| 13 | (handle_fontified_prop, add_to_log): Pass int, not Lisp_Object, as | ||
| 14 | count arg to variable-arg routines like Frun_hook_with_args and | ||
| 15 | Fformat. | ||
| 16 | (back_to_previous_visible_line_start, | ||
| 17 | build_desired_tool_bar_string): Pass Lisp_Object, not int, to | ||
| 18 | fixed-arg routines like Fget_char_property and Fmake_string. | ||
| 19 | (reconsider_clip_changes): Use XINT when comparing integer lisp | ||
| 20 | objects, or passing them as int arguments. | ||
| 21 | (mark_window_display_accurate, insert_left_trunc_glyphs, | ||
| 22 | append_space, extend_face_to_end_of_line): Use make_number when | ||
| 23 | storing or passing integer values as lisp objects. | ||
| 24 | (set_cursor_from_row, highlight_trailing_whitespace): Use | ||
| 25 | INTEGERP, not implicit test against zero, for glyph object. | ||
| 26 | (try_window_id): Don't use make_number when we want an int value. | ||
| 27 | |||
| 28 | * xfaces.c (xlfd_symbolic_value): Make last argument a | ||
| 29 | Lisp_Object, to be consistent with callers. | ||
| 30 | (Fbitmap_spec_p): Use XINT to get numeric value of height. | ||
| 31 | (lface_hash): Apply XFASTINT to lisp values before folding in. | ||
| 32 | |||
| 33 | * xfns.c (Fx_show_tip): Use make_number to get lisp objects to | ||
| 34 | fill in window width and height. Pass an int, not a lisp object, | ||
| 35 | as first arg to Finsert. | ||
| 36 | |||
| 11 | 2000-04-01 Gerd Moellmann <gerd@gnu.org> | 37 | 2000-04-01 Gerd Moellmann <gerd@gnu.org> |
| 12 | 38 | ||
| 13 | * xfaces.c (realize_basic_faces): Block input while realizing | 39 | * xfaces.c (realize_basic_faces): Block input while realizing |
diff --git a/src/xdisp.c b/src/xdisp.c index 16ab84c9cb7..975a431dd8c 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -1021,8 +1021,8 @@ compute_string_pos (newpos, pos, string) | |||
| 1021 | xassert (CHARPOS (*newpos) >= CHARPOS (pos)); | 1021 | xassert (CHARPOS (*newpos) >= CHARPOS (pos)); |
| 1022 | 1022 | ||
| 1023 | if (STRING_MULTIBYTE (string)) | 1023 | if (STRING_MULTIBYTE (string)) |
| 1024 | *newpos = string_pos_nchars_ahead (pos, CHARPOS (*newpos) - CHARPOS (pos), | 1024 | *newpos = string_pos_nchars_ahead (pos, string, |
| 1025 | string); | 1025 | CHARPOS (*newpos) - CHARPOS (pos)); |
| 1026 | else | 1026 | else |
| 1027 | BYTEPOS (*newpos) = CHARPOS (*newpos); | 1027 | BYTEPOS (*newpos) = CHARPOS (*newpos); |
| 1028 | } | 1028 | } |
| @@ -1786,7 +1786,7 @@ handle_fontified_prop (it) | |||
| 1786 | /* Run the hook functions. */ | 1786 | /* Run the hook functions. */ |
| 1787 | args[0] = Qfontification_functions; | 1787 | args[0] = Qfontification_functions; |
| 1788 | args[1] = pos; | 1788 | args[1] = pos; |
| 1789 | Frun_hook_with_args (make_number (2), args); | 1789 | Frun_hook_with_args (2, args); |
| 1790 | 1790 | ||
| 1791 | /* Return HANDLED_RECOMPUTE_PROPS only if function fontified | 1791 | /* Return HANDLED_RECOMPUTE_PROPS only if function fontified |
| 1792 | something. This avoids an endless loop if they failed to | 1792 | something. This avoids an endless loop if they failed to |
| @@ -3033,7 +3033,8 @@ back_to_previous_visible_line_start (it) | |||
| 3033 | { | 3033 | { |
| 3034 | Lisp_Object prop; | 3034 | Lisp_Object prop; |
| 3035 | 3035 | ||
| 3036 | prop = Fget_char_property (IT_CHARPOS (*it), Qinvisible, it->window); | 3036 | prop = Fget_char_property (make_number (IT_CHARPOS (*it)), |
| 3037 | Qinvisible, it->window); | ||
| 3037 | if (TEXT_PROP_MEANS_INVISIBLE (prop)) | 3038 | if (TEXT_PROP_MEANS_INVISIBLE (prop)) |
| 3038 | visible_p = 0; | 3039 | visible_p = 0; |
| 3039 | } | 3040 | } |
| @@ -4669,7 +4670,7 @@ add_to_log (format, arg1, arg2) | |||
| 4669 | args[0] = fmt = build_string (format); | 4670 | args[0] = fmt = build_string (format); |
| 4670 | args[1] = arg1; | 4671 | args[1] = arg1; |
| 4671 | args[2] = arg2; | 4672 | args[2] = arg2; |
| 4672 | msg = Fformat (make_number (3), args); | 4673 | msg = Fformat (3, args); |
| 4673 | 4674 | ||
| 4674 | len = STRING_BYTES (XSTRING (msg)) + 1; | 4675 | len = STRING_BYTES (XSTRING (msg)) + 1; |
| 4675 | buffer = (char *) alloca (len); | 4676 | buffer = (char *) alloca (len); |
| @@ -6463,7 +6464,8 @@ build_desired_tool_bar_string (f) | |||
| 6463 | 6464 | ||
| 6464 | /* Reuse f->desired_tool_bar_string, if possible. */ | 6465 | /* Reuse f->desired_tool_bar_string, if possible. */ |
| 6465 | if (size < size_needed) | 6466 | if (size < size_needed) |
| 6466 | f->desired_tool_bar_string = Fmake_string (make_number (size_needed), ' '); | 6467 | f->desired_tool_bar_string = Fmake_string (make_number (size_needed), |
| 6468 | make_number (' ')); | ||
| 6467 | else | 6469 | else |
| 6468 | { | 6470 | { |
| 6469 | props = list4 (Qdisplay, Qnil, Qmenu_item, Qnil); | 6471 | props = list4 (Qdisplay, Qnil, Qmenu_item, Qnil); |
| @@ -7115,9 +7117,9 @@ reconsider_clip_changes (w, b) | |||
| 7115 | pt = marker_position (w->pointm); | 7117 | pt = marker_position (w->pointm); |
| 7116 | 7118 | ||
| 7117 | if ((w->current_matrix->buffer != XBUFFER (w->buffer) | 7119 | if ((w->current_matrix->buffer != XBUFFER (w->buffer) |
| 7118 | || pt != w->last_point) | 7120 | || pt != XINT (w->last_point)) |
| 7119 | && check_point_in_composition (w->current_matrix->buffer, | 7121 | && check_point_in_composition (w->current_matrix->buffer, |
| 7120 | w->last_point, | 7122 | XINT (w->last_point), |
| 7121 | XBUFFER (w->buffer), pt)) | 7123 | XBUFFER (w->buffer), pt)) |
| 7122 | b->clip_changed = 1; | 7124 | b->clip_changed = 1; |
| 7123 | } | 7125 | } |
| @@ -7893,9 +7895,9 @@ mark_window_display_accurate (window, accurate_p) | |||
| 7893 | w->last_cursor = w->cursor; | 7895 | w->last_cursor = w->cursor; |
| 7894 | w->last_cursor_off_p = w->cursor_off_p; | 7896 | w->last_cursor_off_p = w->cursor_off_p; |
| 7895 | if (w == XWINDOW (selected_window)) | 7897 | if (w == XWINDOW (selected_window)) |
| 7896 | w->last_point = BUF_PT (b); | 7898 | w->last_point = make_number (BUF_PT (b)); |
| 7897 | else | 7899 | else |
| 7898 | w->last_point = XMARKER (w->pointm)->charpos; | 7900 | w->last_point = make_number (XMARKER (w->pointm)->charpos); |
| 7899 | } | 7901 | } |
| 7900 | } | 7902 | } |
| 7901 | 7903 | ||
| @@ -8014,7 +8016,7 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | |||
| 8014 | frames. */ | 8016 | frames. */ |
| 8015 | if (row->displays_text_p) | 8017 | if (row->displays_text_p) |
| 8016 | while (glyph < end | 8018 | while (glyph < end |
| 8017 | && !glyph->object | 8019 | && INTEGERP (glyph->object) |
| 8018 | && glyph->charpos < 0) | 8020 | && glyph->charpos < 0) |
| 8019 | { | 8021 | { |
| 8020 | x += glyph->pixel_width; | 8022 | x += glyph->pixel_width; |
| @@ -8022,7 +8024,7 @@ set_cursor_from_row (w, row, matrix, delta, delta_bytes, dy, dvpos) | |||
| 8022 | } | 8024 | } |
| 8023 | 8025 | ||
| 8024 | while (glyph < end | 8026 | while (glyph < end |
| 8025 | && glyph->object | 8027 | && !INTEGERP (glyph->object) |
| 8026 | && (!BUFFERP (glyph->object) | 8028 | && (!BUFFERP (glyph->object) |
| 8027 | || glyph->charpos < pt_old)) | 8029 | || glyph->charpos < pt_old)) |
| 8028 | { | 8030 | { |
| @@ -10033,7 +10035,7 @@ try_window_id (w) | |||
| 10033 | w->window_end_pos | 10035 | w->window_end_pos |
| 10034 | = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); | 10036 | = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); |
| 10035 | w->window_end_bytepos | 10037 | w->window_end_bytepos |
| 10036 | = make_number (Z_BYTE - MATRIX_ROW_END_BYTEPOS (row)); | 10038 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); |
| 10037 | return 1; | 10039 | return 1; |
| 10038 | } | 10040 | } |
| 10039 | 10041 | ||
| @@ -10047,7 +10049,7 @@ try_window_id (w) | |||
| 10047 | w->window_end_pos | 10049 | w->window_end_pos |
| 10048 | = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); | 10050 | = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); |
| 10049 | w->window_end_bytepos | 10051 | w->window_end_bytepos |
| 10050 | = make_number (Z_BYTE - MATRIX_ROW_END_BYTEPOS (row)); | 10052 | = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); |
| 10051 | return 1; | 10053 | return 1; |
| 10052 | } | 10054 | } |
| 10053 | 10055 | ||
| @@ -10778,7 +10780,7 @@ insert_left_trunc_glyphs (it) | |||
| 10778 | truncate_it.glyph_row = &scratch_glyph_row; | 10780 | truncate_it.glyph_row = &scratch_glyph_row; |
| 10779 | truncate_it.glyph_row->used[TEXT_AREA] = 0; | 10781 | truncate_it.glyph_row->used[TEXT_AREA] = 0; |
| 10780 | CHARPOS (truncate_it.position) = BYTEPOS (truncate_it.position) = -1; | 10782 | CHARPOS (truncate_it.position) = BYTEPOS (truncate_it.position) = -1; |
| 10781 | truncate_it.object = 0; | 10783 | truncate_it.object = make_number (0); |
| 10782 | produce_special_glyphs (&truncate_it, IT_TRUNCATION); | 10784 | produce_special_glyphs (&truncate_it, IT_TRUNCATION); |
| 10783 | 10785 | ||
| 10784 | /* Overwrite glyphs from IT with truncation glyphs. */ | 10786 | /* Overwrite glyphs from IT with truncation glyphs. */ |
| @@ -10936,7 +10938,7 @@ append_space (it, default_face_p) | |||
| 10936 | 10938 | ||
| 10937 | it->what = IT_CHARACTER; | 10939 | it->what = IT_CHARACTER; |
| 10938 | bzero (&it->position, sizeof it->position); | 10940 | bzero (&it->position, sizeof it->position); |
| 10939 | it->object = 0; | 10941 | it->object = make_number (0); |
| 10940 | it->c = ' '; | 10942 | it->c = ' '; |
| 10941 | it->len = 1; | 10943 | it->len = 1; |
| 10942 | 10944 | ||
| @@ -11023,7 +11025,7 @@ extend_face_to_end_of_line (it) | |||
| 11023 | 11025 | ||
| 11024 | it->what = IT_CHARACTER; | 11026 | it->what = IT_CHARACTER; |
| 11025 | bzero (&it->position, sizeof it->position); | 11027 | bzero (&it->position, sizeof it->position); |
| 11026 | it->object = 0; | 11028 | it->object = make_number (0); |
| 11027 | it->c = ' '; | 11029 | it->c = ' '; |
| 11028 | it->len = 1; | 11030 | it->len = 1; |
| 11029 | 11031 | ||
| @@ -11084,7 +11086,7 @@ highlight_trailing_whitespace (f, row) | |||
| 11084 | cursor at the end of a line. */ | 11086 | cursor at the end of a line. */ |
| 11085 | if (glyph->type == CHAR_GLYPH | 11087 | if (glyph->type == CHAR_GLYPH |
| 11086 | && glyph->u.ch == ' ' | 11088 | && glyph->u.ch == ' ' |
| 11087 | && glyph->object == 0) | 11089 | && INTEGERP (glyph->object)) |
| 11088 | --glyph; | 11090 | --glyph; |
| 11089 | 11091 | ||
| 11090 | /* If last glyph is a space or stretch, and it's trailing | 11092 | /* If last glyph is a space or stretch, and it's trailing |
diff --git a/src/xfaces.c b/src/xfaces.c index c585515497a..00697cdee29 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -499,7 +499,8 @@ static int xlfd_fixed_p P_ ((struct font_name *)); | |||
| 499 | static int xlfd_numeric_value P_ ((struct table_entry *, int, struct font_name *, | 499 | static int xlfd_numeric_value P_ ((struct table_entry *, int, struct font_name *, |
| 500 | int, int)); | 500 | int, int)); |
| 501 | static Lisp_Object xlfd_symbolic_value P_ ((struct table_entry *, int, | 501 | static Lisp_Object xlfd_symbolic_value P_ ((struct table_entry *, int, |
| 502 | struct font_name *, int, int)); | 502 | struct font_name *, int, |
| 503 | Lisp_Object)); | ||
| 503 | static struct table_entry *xlfd_lookup_field_contents P_ ((struct table_entry *, int, | 504 | static struct table_entry *xlfd_lookup_field_contents P_ ((struct table_entry *, int, |
| 504 | struct font_name *, int)); | 505 | struct font_name *, int)); |
| 505 | 506 | ||
| @@ -1008,7 +1009,7 @@ the pixmap. Bits are stored row by row, each row occupies\n\ | |||
| 1008 | { | 1009 | { |
| 1009 | int bytes_per_row = ((XFASTINT (width) + BITS_PER_CHAR - 1) | 1010 | int bytes_per_row = ((XFASTINT (width) + BITS_PER_CHAR - 1) |
| 1010 | / BITS_PER_CHAR); | 1011 | / BITS_PER_CHAR); |
| 1011 | if (STRING_BYTES (XSTRING (data)) >= bytes_per_row * height) | 1012 | if (STRING_BYTES (XSTRING (data)) >= bytes_per_row * XINT (height)) |
| 1012 | pixmap_p = 1; | 1013 | pixmap_p = 1; |
| 1013 | } | 1014 | } |
| 1014 | } | 1015 | } |
| @@ -1824,7 +1825,7 @@ xlfd_symbolic_value (table, dim, font, field_index, dflt) | |||
| 1824 | int dim; | 1825 | int dim; |
| 1825 | struct font_name *font; | 1826 | struct font_name *font; |
| 1826 | int field_index; | 1827 | int field_index; |
| 1827 | int dflt; | 1828 | Lisp_Object dflt; |
| 1828 | { | 1829 | { |
| 1829 | struct table_entry *p; | 1830 | struct table_entry *p; |
| 1830 | p = xlfd_lookup_field_contents (table, dim, font, field_index); | 1831 | p = xlfd_lookup_field_contents (table, dim, font, field_index); |
| @@ -4455,9 +4456,9 @@ lface_hash (v) | |||
| 4455 | return (hash_string_case_insensitive (v[LFACE_FAMILY_INDEX]) | 4456 | return (hash_string_case_insensitive (v[LFACE_FAMILY_INDEX]) |
| 4456 | ^ hash_string_case_insensitive (v[LFACE_FOREGROUND_INDEX]) | 4457 | ^ hash_string_case_insensitive (v[LFACE_FOREGROUND_INDEX]) |
| 4457 | ^ hash_string_case_insensitive (v[LFACE_BACKGROUND_INDEX]) | 4458 | ^ hash_string_case_insensitive (v[LFACE_BACKGROUND_INDEX]) |
| 4458 | ^ (unsigned) v[LFACE_WEIGHT_INDEX] | 4459 | ^ XFASTINT (v[LFACE_WEIGHT_INDEX]) |
| 4459 | ^ (unsigned) v[LFACE_SLANT_INDEX] | 4460 | ^ XFASTINT (v[LFACE_SLANT_INDEX]) |
| 4460 | ^ (unsigned) v[LFACE_SWIDTH_INDEX] | 4461 | ^ XFASTINT (v[LFACE_SWIDTH_INDEX]) |
| 4461 | ^ XFASTINT (v[LFACE_HEIGHT_INDEX])); | 4462 | ^ XFASTINT (v[LFACE_HEIGHT_INDEX])); |
| 4462 | } | 4463 | } |
| 4463 | 4464 | ||
diff --git a/src/xfns.c b/src/xfns.c index d23d4f0f384..9bc400627ec 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -9727,8 +9727,8 @@ TIMEOUT nil means use the default timeout of 5 seconds.") | |||
| 9727 | will loose. I don't think this is a realistic case. */ | 9727 | will loose. I don't think this is a realistic case. */ |
| 9728 | w = XWINDOW (FRAME_ROOT_WINDOW (f)); | 9728 | w = XWINDOW (FRAME_ROOT_WINDOW (f)); |
| 9729 | w->left = w->top = make_number (0); | 9729 | w->left = w->top = make_number (0); |
| 9730 | w->width = 80; | 9730 | w->width = make_number (80); |
| 9731 | w->height = 40; | 9731 | w->height = make_number (40); |
| 9732 | adjust_glyphs (f); | 9732 | adjust_glyphs (f); |
| 9733 | w->pseudo_window_p = 1; | 9733 | w->pseudo_window_p = 1; |
| 9734 | 9734 | ||
| @@ -9738,7 +9738,7 @@ TIMEOUT nil means use the default timeout of 5 seconds.") | |||
| 9738 | old_buffer = current_buffer; | 9738 | old_buffer = current_buffer; |
| 9739 | set_buffer_internal_1 (XBUFFER (buffer)); | 9739 | set_buffer_internal_1 (XBUFFER (buffer)); |
| 9740 | Ferase_buffer (); | 9740 | Ferase_buffer (); |
| 9741 | Finsert (make_number (1), &string); | 9741 | Finsert (1, &string); |
| 9742 | clear_glyph_matrix (w->desired_matrix); | 9742 | clear_glyph_matrix (w->desired_matrix); |
| 9743 | clear_glyph_matrix (w->current_matrix); | 9743 | clear_glyph_matrix (w->current_matrix); |
| 9744 | SET_TEXT_POS (pos, BEGV, BEGV_BYTE); | 9744 | SET_TEXT_POS (pos, BEGV, BEGV_BYTE); |