Mercurial > emacs
comparison src/xdisp.c @ 43783:284b3c395ed4
Use new string macros.
(update_echo_area): Pass number of bytes to message3 instead of
number of chars.
(set_message_1): Don't access a string's size_byte directly.
(decode_mode_spec_coding): Use number of bytes of eoltype string
instead number of chars.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Fri, 08 Mar 2002 11:03:53 +0000 |
parents | e959a4317633 |
children | 56636e0f3b9d |
comparison
equal
deleted
inserted
replaced
43782:6878894428ba | 43783:284b3c395ed4 |
---|---|
1167 { | 1167 { |
1168 xassert (STRINGP (string) && nchars >= 0); | 1168 xassert (STRINGP (string) && nchars >= 0); |
1169 | 1169 |
1170 if (STRING_MULTIBYTE (string)) | 1170 if (STRING_MULTIBYTE (string)) |
1171 { | 1171 { |
1172 int rest = STRING_BYTES (XSTRING (string)) - BYTEPOS (pos); | 1172 int rest = SBYTES (string) - BYTEPOS (pos); |
1173 unsigned char *p = XSTRING (string)->data + BYTEPOS (pos); | 1173 unsigned char *p = SDATA (string) + BYTEPOS (pos); |
1174 int len; | 1174 int len; |
1175 | 1175 |
1176 while (nchars--) | 1176 while (nchars--) |
1177 { | 1177 { |
1178 string_char_and_length (p, rest, &len); | 1178 string_char_and_length (p, rest, &len); |
1862 after-string. */ | 1862 after-string. */ |
1863 init_iterator (it, w, charpos, bytepos, NULL, DEFAULT_FACE_ID); | 1863 init_iterator (it, w, charpos, bytepos, NULL, DEFAULT_FACE_ID); |
1864 | 1864 |
1865 for (i = 0; i < it->n_overlay_strings; ++i) | 1865 for (i = 0; i < it->n_overlay_strings; ++i) |
1866 { | 1866 { |
1867 char *s = XSTRING (it->overlay_strings[i])->data; | 1867 char *s = SDATA (it->overlay_strings[i]); |
1868 char *e = s + STRING_BYTES (XSTRING (it->overlay_strings[i])); | 1868 char *e = s + SBYTES (it->overlay_strings[i]); |
1869 | 1869 |
1870 while (s < e && *s != '\n') | 1870 while (s < e && *s != '\n') |
1871 ++s; | 1871 ++s; |
1872 | 1872 |
1873 if (s < e) | 1873 if (s < e) |
2433 int bufpos, base_face_id; | 2433 int bufpos, base_face_id; |
2434 | 2434 |
2435 /* No face change past the end of the string (for the case | 2435 /* No face change past the end of the string (for the case |
2436 we are padding with spaces). No face change before the | 2436 we are padding with spaces). No face change before the |
2437 string start. */ | 2437 string start. */ |
2438 if (IT_STRING_CHARPOS (*it) >= XSTRING (it->string)->size | 2438 if (IT_STRING_CHARPOS (*it) >= SCHARS (it->string) |
2439 || (IT_STRING_CHARPOS (*it) == 0 && before_p)) | 2439 || (IT_STRING_CHARPOS (*it) == 0 && before_p)) |
2440 return it->face_id; | 2440 return it->face_id; |
2441 | 2441 |
2442 /* Set pos to the position before or after IT's current position. */ | 2442 /* Set pos to the position before or after IT's current position. */ |
2443 if (before_p) | 2443 if (before_p) |
2469 /* Correct the face for charsets different from ASCII. Do it | 2469 /* Correct the face for charsets different from ASCII. Do it |
2470 for the multibyte case only. The face returned above is | 2470 for the multibyte case only. The face returned above is |
2471 suitable for unibyte text if IT->string is unibyte. */ | 2471 suitable for unibyte text if IT->string is unibyte. */ |
2472 if (STRING_MULTIBYTE (it->string)) | 2472 if (STRING_MULTIBYTE (it->string)) |
2473 { | 2473 { |
2474 unsigned char *p = XSTRING (it->string)->data + BYTEPOS (pos); | 2474 unsigned char *p = SDATA (it->string) + BYTEPOS (pos); |
2475 int rest = STRING_BYTES (XSTRING (it->string)) - BYTEPOS (pos); | 2475 int rest = SBYTES (it->string) - BYTEPOS (pos); |
2476 int c, len; | 2476 int c, len; |
2477 struct face *face = FACE_FROM_ID (it->f, face_id); | 2477 struct face *face = FACE_FROM_ID (it->f, face_id); |
2478 | 2478 |
2479 c = string_char_and_length (p, rest, &len); | 2479 c = string_char_and_length (p, rest, &len); |
2480 face_id = FACE_FOR_CHAR (it->f, face, c); | 2480 face_id = FACE_FOR_CHAR (it->f, face, c); |
2556 | 2556 |
2557 /* Get the position at which the next change of the | 2557 /* Get the position at which the next change of the |
2558 invisible text property can be found in IT->string. | 2558 invisible text property can be found in IT->string. |
2559 Value will be nil if the property value is the same for | 2559 Value will be nil if the property value is the same for |
2560 all the rest of IT->string. */ | 2560 all the rest of IT->string. */ |
2561 XSETINT (limit, XSTRING (it->string)->size); | 2561 XSETINT (limit, SCHARS (it->string)); |
2562 end_charpos = Fnext_single_property_change (charpos, Qinvisible, | 2562 end_charpos = Fnext_single_property_change (charpos, Qinvisible, |
2563 it->string, limit); | 2563 it->string, limit); |
2564 | 2564 |
2565 /* Text at current position is invisible. The next | 2565 /* Text at current position is invisible. The next |
2566 change in the property is at position end_charpos. | 2566 change in the property is at position end_charpos. |
2567 Move IT's current position to that position. */ | 2567 Move IT's current position to that position. */ |
2568 if (INTEGERP (end_charpos) | 2568 if (INTEGERP (end_charpos) |
2585 finished processing them. */ | 2585 finished processing them. */ |
2586 handled = HANDLED_OVERLAY_STRING_CONSUMED; | 2586 handled = HANDLED_OVERLAY_STRING_CONSUMED; |
2587 } | 2587 } |
2588 else | 2588 else |
2589 { | 2589 { |
2590 struct Lisp_String *s = XSTRING (it->string); | 2590 IT_STRING_CHARPOS (*it) = SCHARS (it->string); |
2591 IT_STRING_CHARPOS (*it) = s->size; | 2591 IT_STRING_BYTEPOS (*it) = SBYTES (it->string); |
2592 IT_STRING_BYTEPOS (*it) = STRING_BYTES (s); | |
2593 } | 2592 } |
2594 } | 2593 } |
2595 } | 2594 } |
2596 } | 2595 } |
2597 else | 2596 else |
3043 { | 3042 { |
3044 it->string = value; | 3043 it->string = value; |
3045 it->multibyte_p = STRING_MULTIBYTE (it->string); | 3044 it->multibyte_p = STRING_MULTIBYTE (it->string); |
3046 it->current.overlay_string_index = -1; | 3045 it->current.overlay_string_index = -1; |
3047 IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0; | 3046 IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0; |
3048 it->end_charpos = it->string_nchars | 3047 it->end_charpos = it->string_nchars = SCHARS (it->string); |
3049 = XSTRING (it->string)->size; | |
3050 it->method = next_element_from_string; | 3048 it->method = next_element_from_string; |
3051 it->stop_charpos = 0; | 3049 it->stop_charpos = 0; |
3052 it->string_from_display_prop_p = 1; | 3050 it->string_from_display_prop_p = 1; |
3053 /* Say that we haven't consumed the characters with | 3051 /* Say that we haven't consumed the characters with |
3054 `display' property yet. The call to pop_it in | 3052 `display' property yet. The call to pop_it in |
3572 invis_p = TEXT_PROP_MEANS_INVISIBLE (invisible); | 3570 invis_p = TEXT_PROP_MEANS_INVISIBLE (invisible); |
3573 | 3571 |
3574 /* If overlay has a non-empty before-string, record it. */ | 3572 /* If overlay has a non-empty before-string, record it. */ |
3575 if ((start == charpos || (end == charpos && invis_p)) | 3573 if ((start == charpos || (end == charpos && invis_p)) |
3576 && (str = Foverlay_get (overlay, Qbefore_string), STRINGP (str)) | 3574 && (str = Foverlay_get (overlay, Qbefore_string), STRINGP (str)) |
3577 && XSTRING (str)->size) | 3575 && SCHARS (str)) |
3578 RECORD_OVERLAY_STRING (overlay, str, 0); | 3576 RECORD_OVERLAY_STRING (overlay, str, 0); |
3579 | 3577 |
3580 /* If overlay has a non-empty after-string, record it. */ | 3578 /* If overlay has a non-empty after-string, record it. */ |
3581 if ((end == charpos || (start == charpos && invis_p)) | 3579 if ((end == charpos || (start == charpos && invis_p)) |
3582 && (str = Foverlay_get (overlay, Qafter_string), STRINGP (str)) | 3580 && (str = Foverlay_get (overlay, Qafter_string), STRINGP (str)) |
3583 && XSTRING (str)->size) | 3581 && SCHARS (str)) |
3584 RECORD_OVERLAY_STRING (overlay, str, 1); | 3582 RECORD_OVERLAY_STRING (overlay, str, 1); |
3585 } | 3583 } |
3586 | 3584 |
3587 /* Process overlays after the overlay center. */ | 3585 /* Process overlays after the overlay center. */ |
3588 for (ov = current_buffer->overlays_after; CONSP (ov); ov = XCDR (ov)) | 3586 for (ov = current_buffer->overlays_after; CONSP (ov); ov = XCDR (ov)) |
3611 invis_p = TEXT_PROP_MEANS_INVISIBLE (invisible); | 3609 invis_p = TEXT_PROP_MEANS_INVISIBLE (invisible); |
3612 | 3610 |
3613 /* If overlay has a non-empty before-string, record it. */ | 3611 /* If overlay has a non-empty before-string, record it. */ |
3614 if ((start == charpos || (end == charpos && invis_p)) | 3612 if ((start == charpos || (end == charpos && invis_p)) |
3615 && (str = Foverlay_get (overlay, Qbefore_string), STRINGP (str)) | 3613 && (str = Foverlay_get (overlay, Qbefore_string), STRINGP (str)) |
3616 && XSTRING (str)->size) | 3614 && SCHARS (str)) |
3617 RECORD_OVERLAY_STRING (overlay, str, 0); | 3615 RECORD_OVERLAY_STRING (overlay, str, 0); |
3618 | 3616 |
3619 /* If overlay has a non-empty after-string, record it. */ | 3617 /* If overlay has a non-empty after-string, record it. */ |
3620 if ((end == charpos || (start == charpos && invis_p)) | 3618 if ((end == charpos || (start == charpos && invis_p)) |
3621 && (str = Foverlay_get (overlay, Qafter_string), STRINGP (str)) | 3619 && (str = Foverlay_get (overlay, Qafter_string), STRINGP (str)) |
3622 && XSTRING (str)->size) | 3620 && SCHARS (str)) |
3623 RECORD_OVERLAY_STRING (overlay, str, 1); | 3621 RECORD_OVERLAY_STRING (overlay, str, 1); |
3624 } | 3622 } |
3625 | 3623 |
3626 #undef RECORD_OVERLAY_STRING | 3624 #undef RECORD_OVERLAY_STRING |
3627 | 3625 |
3682 /* Set up IT to deliver display elements from the first overlay | 3680 /* Set up IT to deliver display elements from the first overlay |
3683 string. */ | 3681 string. */ |
3684 IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0; | 3682 IT_STRING_CHARPOS (*it) = IT_STRING_BYTEPOS (*it) = 0; |
3685 it->string = it->overlay_strings[0]; | 3683 it->string = it->overlay_strings[0]; |
3686 it->stop_charpos = 0; | 3684 it->stop_charpos = 0; |
3687 it->end_charpos = XSTRING (it->string)->size; | |
3688 it->multibyte_p = STRING_MULTIBYTE (it->string); | |
3689 xassert (STRINGP (it->string)); | 3685 xassert (STRINGP (it->string)); |
3686 it->end_charpos = SCHARS (it->string); | |
3687 it->multibyte_p = SMBP (it->string); | |
3690 it->method = next_element_from_string; | 3688 it->method = next_element_from_string; |
3691 } | 3689 } |
3692 else | 3690 else |
3693 { | 3691 { |
3694 it->string = Qnil; | 3692 it->string = Qnil; |
4110 if (s == NULL) | 4108 if (s == NULL) |
4111 { | 4109 { |
4112 xassert (STRINGP (string)); | 4110 xassert (STRINGP (string)); |
4113 it->string = string; | 4111 it->string = string; |
4114 it->s = NULL; | 4112 it->s = NULL; |
4115 it->end_charpos = it->string_nchars = XSTRING (string)->size; | 4113 it->end_charpos = it->string_nchars = SCHARS (string); |
4116 it->method = next_element_from_string; | 4114 it->method = next_element_from_string; |
4117 it->current.string_pos = string_pos (charpos, string); | 4115 it->current.string_pos = string_pos (charpos, string); |
4118 } | 4116 } |
4119 else | 4117 else |
4120 { | 4118 { |
4463 | 4461 |
4464 if (it->current.overlay_string_index >= 0) | 4462 if (it->current.overlay_string_index >= 0) |
4465 { | 4463 { |
4466 /* IT->string is an overlay string. Advance to the | 4464 /* IT->string is an overlay string. Advance to the |
4467 next, if there is one. */ | 4465 next, if there is one. */ |
4468 if (IT_STRING_CHARPOS (*it) >= XSTRING (it->string)->size) | 4466 if (IT_STRING_CHARPOS (*it) >= SCHARS (it->string)) |
4469 next_overlay_string (it); | 4467 next_overlay_string (it); |
4470 } | 4468 } |
4471 else | 4469 else |
4472 { | 4470 { |
4473 /* IT->string is not an overlay string. If we reached | 4471 /* IT->string is not an overlay string. If we reached |
4474 its end, and there is something on IT->stack, proceed | 4472 its end, and there is something on IT->stack, proceed |
4475 with what is on the stack. This can be either another | 4473 with what is on the stack. This can be either another |
4476 string, this time an overlay string, or a buffer. */ | 4474 string, this time an overlay string, or a buffer. */ |
4477 if (IT_STRING_CHARPOS (*it) == XSTRING (it->string)->size | 4475 if (IT_STRING_CHARPOS (*it) == SCHARS (it->string) |
4478 && it->sp > 0) | 4476 && it->sp > 0) |
4479 { | 4477 { |
4480 pop_it (it); | 4478 pop_it (it); |
4481 if (!STRINGP (it->string)) | 4479 if (!STRINGP (it->string)) |
4482 it->method = next_element_from_buffer; | 4480 it->method = next_element_from_buffer; |
4590 if (it->current.overlay_string_index >= 0) | 4588 if (it->current.overlay_string_index >= 0) |
4591 { | 4589 { |
4592 /* Get the next character from an overlay string. In overlay | 4590 /* Get the next character from an overlay string. In overlay |
4593 strings, There is no field width or padding with spaces to | 4591 strings, There is no field width or padding with spaces to |
4594 do. */ | 4592 do. */ |
4595 if (IT_STRING_CHARPOS (*it) >= XSTRING (it->string)->size) | 4593 if (IT_STRING_CHARPOS (*it) >= SCHARS (it->string)) |
4596 { | 4594 { |
4597 it->what = IT_EOB; | 4595 it->what = IT_EOB; |
4598 return 0; | 4596 return 0; |
4599 } | 4597 } |
4600 else if (STRING_MULTIBYTE (it->string)) | 4598 else if (STRING_MULTIBYTE (it->string)) |
4601 { | 4599 { |
4602 int remaining = (STRING_BYTES (XSTRING (it->string)) | 4600 int remaining = SBYTES (it->string) - IT_STRING_BYTEPOS (*it); |
4603 - IT_STRING_BYTEPOS (*it)); | 4601 unsigned char *s = SDATA (it->string) + IT_STRING_BYTEPOS (*it); |
4604 unsigned char *s = (XSTRING (it->string)->data | |
4605 + IT_STRING_BYTEPOS (*it)); | |
4606 it->c = string_char_and_length (s, remaining, &it->len); | 4602 it->c = string_char_and_length (s, remaining, &it->len); |
4607 } | 4603 } |
4608 else | 4604 else |
4609 { | 4605 { |
4610 it->c = XSTRING (it->string)->data[IT_STRING_BYTEPOS (*it)]; | 4606 it->c = SREF (it->string, IT_STRING_BYTEPOS (*it)); |
4611 it->len = 1; | 4607 it->len = 1; |
4612 } | 4608 } |
4613 } | 4609 } |
4614 else | 4610 else |
4615 { | 4611 { |
4628 it->c = ' ', it->len = 1; | 4624 it->c = ' ', it->len = 1; |
4629 CHARPOS (position) = BYTEPOS (position) = -1; | 4625 CHARPOS (position) = BYTEPOS (position) = -1; |
4630 } | 4626 } |
4631 else if (STRING_MULTIBYTE (it->string)) | 4627 else if (STRING_MULTIBYTE (it->string)) |
4632 { | 4628 { |
4633 int maxlen = (STRING_BYTES (XSTRING (it->string)) | 4629 int maxlen = SBYTES (it->string) - IT_STRING_BYTEPOS (*it); |
4634 - IT_STRING_BYTEPOS (*it)); | 4630 unsigned char *s = SDATA (it->string) + IT_STRING_BYTEPOS (*it); |
4635 unsigned char *s = (XSTRING (it->string)->data | |
4636 + IT_STRING_BYTEPOS (*it)); | |
4637 it->c = string_char_and_length (s, maxlen, &it->len); | 4631 it->c = string_char_and_length (s, maxlen, &it->len); |
4638 } | 4632 } |
4639 else | 4633 else |
4640 { | 4634 { |
4641 it->c = XSTRING (it->string)->data[IT_STRING_BYTEPOS (*it)]; | 4635 it->c = SREF (it->string, IT_STRING_BYTEPOS (*it)); |
4642 it->len = 1; | 4636 it->len = 1; |
4643 } | 4637 } |
4644 } | 4638 } |
4645 | 4639 |
4646 /* Record what we have and where it came from. Note that we store a | 4640 /* Record what we have and where it came from. Note that we store a |
5601 args[0] = fmt = build_string (format); | 5595 args[0] = fmt = build_string (format); |
5602 args[1] = arg1; | 5596 args[1] = arg1; |
5603 args[2] = arg2; | 5597 args[2] = arg2; |
5604 msg = Fformat (3, args); | 5598 msg = Fformat (3, args); |
5605 | 5599 |
5606 len = STRING_BYTES (XSTRING (msg)) + 1; | 5600 len = SBYTES (msg) + 1; |
5607 buffer = (char *) alloca (len); | 5601 buffer = (char *) alloca (len); |
5608 bcopy (XSTRING (msg)->data, buffer, len); | 5602 bcopy (SDATA (msg), buffer, len); |
5609 | 5603 |
5610 message_dolog (buffer, len - 1, 1, 0); | 5604 message_dolog (buffer, len - 1, 1, 0); |
5611 UNGCPRO; | 5605 UNGCPRO; |
5612 } | 5606 } |
5613 | 5607 |
5928 GCPRO1 (m); | 5922 GCPRO1 (m); |
5929 | 5923 |
5930 /* First flush out any partial line written with print. */ | 5924 /* First flush out any partial line written with print. */ |
5931 message_log_maybe_newline (); | 5925 message_log_maybe_newline (); |
5932 if (STRINGP (m)) | 5926 if (STRINGP (m)) |
5933 message_dolog (XSTRING (m)->data, nbytes, 1, multibyte); | 5927 message_dolog (SDATA (m), nbytes, 1, multibyte); |
5934 message3_nolog (m, nbytes, multibyte); | 5928 message3_nolog (m, nbytes, multibyte); |
5935 | 5929 |
5936 UNGCPRO; | 5930 UNGCPRO; |
5937 } | 5931 } |
5938 | 5932 |
5951 { | 5945 { |
5952 if (noninteractive_need_newline) | 5946 if (noninteractive_need_newline) |
5953 putc ('\n', stderr); | 5947 putc ('\n', stderr); |
5954 noninteractive_need_newline = 0; | 5948 noninteractive_need_newline = 0; |
5955 if (STRINGP (m)) | 5949 if (STRINGP (m)) |
5956 fwrite (XSTRING (m)->data, nbytes, 1, stderr); | 5950 fwrite (SDATA (m), nbytes, 1, stderr); |
5957 if (cursor_in_echo_area == 0) | 5951 if (cursor_in_echo_area == 0) |
5958 fprintf (stderr, "\n"); | 5952 fprintf (stderr, "\n"); |
5959 fflush (stderr); | 5953 fflush (stderr); |
5960 } | 5954 } |
5961 /* A null message buffer means that the frame hasn't really been | 5955 /* A null message buffer means that the frame hasn't really been |
5978 FRAME_SAMPLE_VISIBILITY (f); | 5972 FRAME_SAMPLE_VISIBILITY (f); |
5979 if (FRAME_VISIBLE_P (sf) | 5973 if (FRAME_VISIBLE_P (sf) |
5980 && !FRAME_VISIBLE_P (f)) | 5974 && !FRAME_VISIBLE_P (f)) |
5981 Fmake_frame_visible (frame); | 5975 Fmake_frame_visible (frame); |
5982 | 5976 |
5983 if (STRINGP (m) && XSTRING (m)->size) | 5977 if (STRINGP (m) && SCHARS (m) > 0) |
5984 { | 5978 { |
5985 set_message (NULL, m, nbytes, multibyte); | 5979 set_message (NULL, m, nbytes, multibyte); |
5986 if (minibuffer_auto_raise) | 5980 if (minibuffer_auto_raise) |
5987 Fraise_frame (frame); | 5981 Fraise_frame (frame); |
5988 } | 5982 } |
6037 if (m) | 6031 if (m) |
6038 { | 6032 { |
6039 if (noninteractive_need_newline) | 6033 if (noninteractive_need_newline) |
6040 putc ('\n', stderr); | 6034 putc ('\n', stderr); |
6041 noninteractive_need_newline = 0; | 6035 noninteractive_need_newline = 0; |
6042 fprintf (stderr, m, XSTRING (string)->data); | 6036 fprintf (stderr, m, SDATA (string)); |
6043 if (cursor_in_echo_area == 0) | 6037 if (cursor_in_echo_area == 0) |
6044 fprintf (stderr, "\n"); | 6038 fprintf (stderr, "\n"); |
6045 fflush (stderr); | 6039 fflush (stderr); |
6046 } | 6040 } |
6047 } | 6041 } |
6072 gcpro1.nvars = 2; | 6066 gcpro1.nvars = 2; |
6073 | 6067 |
6074 message = Fformat (2, args); | 6068 message = Fformat (2, args); |
6075 | 6069 |
6076 if (log) | 6070 if (log) |
6077 message3 (message, STRING_BYTES (XSTRING (message)), | 6071 message3 (message, SBYTES (message), SMBP (message)); |
6078 STRING_MULTIBYTE (message)); | |
6079 else | 6072 else |
6080 message3_nolog (message, STRING_BYTES (XSTRING (message)), | 6073 message3_nolog (message, SBYTES (message), SMBP (message)); |
6081 STRING_MULTIBYTE (message)); | |
6082 | 6074 |
6083 UNGCPRO; | 6075 UNGCPRO; |
6084 | 6076 |
6085 /* Print should start at the beginning of the message | 6077 /* Print should start at the beginning of the message |
6086 buffer next time. */ | 6078 buffer next time. */ |
6185 { | 6177 { |
6186 if (!NILP (echo_area_buffer[0])) | 6178 if (!NILP (echo_area_buffer[0])) |
6187 { | 6179 { |
6188 Lisp_Object string; | 6180 Lisp_Object string; |
6189 string = Fcurrent_message (); | 6181 string = Fcurrent_message (); |
6190 message3 (string, XSTRING (string)->size, | 6182 message3 (string, SBYTES (string), |
6191 !NILP (current_buffer->enable_multibyte_characters)); | 6183 !NILP (current_buffer->enable_multibyte_characters)); |
6192 } | 6184 } |
6193 } | 6185 } |
6194 | 6186 |
6195 | 6187 |
6795 Lisp_Object msg; | 6787 Lisp_Object msg; |
6796 | 6788 |
6797 xassert (CONSP (Vmessage_stack)); | 6789 xassert (CONSP (Vmessage_stack)); |
6798 msg = XCAR (Vmessage_stack); | 6790 msg = XCAR (Vmessage_stack); |
6799 if (STRINGP (msg)) | 6791 if (STRINGP (msg)) |
6800 message3_nolog (msg, STRING_BYTES (XSTRING (msg)), STRING_MULTIBYTE (msg)); | 6792 message3_nolog (msg, SBYTES (msg), SMBP (msg)); |
6801 else | 6793 else |
6802 message3_nolog (msg, 0, 0); | 6794 message3_nolog (msg, 0, 0); |
6803 } | 6795 } |
6804 | 6796 |
6805 | 6797 |
6921 if (STRINGP (string)) | 6913 if (STRINGP (string)) |
6922 { | 6914 { |
6923 int nchars; | 6915 int nchars; |
6924 | 6916 |
6925 if (nbytes == 0) | 6917 if (nbytes == 0) |
6926 nbytes = XSTRING (string)->size_byte; | 6918 nbytes = SBYTES (string); |
6927 nchars = string_byte_to_char (string, nbytes); | 6919 nchars = string_byte_to_char (string, nbytes); |
6928 | 6920 |
6929 /* This function takes care of single/multibyte conversion. We | 6921 /* This function takes care of single/multibyte conversion. We |
6930 just have to ensure that the echo area buffer has the right | 6922 just have to ensure that the echo area buffer has the right |
6931 setting of enable_multibyte_characters. */ | 6923 setting of enable_multibyte_characters. */ |
7270 the common case where it hasn't. (If it turns out that we've | 7262 the common case where it hasn't. (If it turns out that we've |
7271 already wasted too much time by walking through the list with | 7263 already wasted too much time by walking through the list with |
7272 display_mode_element, then we might need to optimize at a | 7264 display_mode_element, then we might need to optimize at a |
7273 higher level than this.) */ | 7265 higher level than this.) */ |
7274 if (! STRINGP (f->name) | 7266 if (! STRINGP (f->name) |
7275 || STRING_BYTES (XSTRING (f->name)) != len | 7267 || SBYTES (f->name) != len |
7276 || bcmp (frame_title_buf, XSTRING (f->name)->data, len) != 0) | 7268 || bcmp (frame_title_buf, SDATA (f->name), len) != 0) |
7277 x_implicitly_set_name (f, make_string (frame_title_buf, len), Qnil); | 7269 x_implicitly_set_name (f, make_string (frame_title_buf, len), Qnil); |
7278 } | 7270 } |
7279 } | 7271 } |
7280 | 7272 |
7281 #else /* not HAVE_WINDOW_SYSTEM */ | 7273 #else /* not HAVE_WINDOW_SYSTEM */ |
7590 /* Prepare F->desired_tool_bar_string. If we can reuse it, do so. | 7582 /* Prepare F->desired_tool_bar_string. If we can reuse it, do so. |
7591 Otherwise, make a new string. */ | 7583 Otherwise, make a new string. */ |
7592 | 7584 |
7593 /* The size of the string we might be able to reuse. */ | 7585 /* The size of the string we might be able to reuse. */ |
7594 size = (STRINGP (f->desired_tool_bar_string) | 7586 size = (STRINGP (f->desired_tool_bar_string) |
7595 ? XSTRING (f->desired_tool_bar_string)->size | 7587 ? SCHARS (f->desired_tool_bar_string) |
7596 : 0); | 7588 : 0); |
7597 | 7589 |
7598 /* We need one space in the string for each image. */ | 7590 /* We need one space in the string for each image. */ |
7599 size_needed = f->n_tool_bar_items; | 7591 size_needed = f->n_tool_bar_items; |
7600 | 7592 |
7722 | 7714 |
7723 /* Let the last image hide all remaining spaces in the tool bar | 7715 /* Let the last image hide all remaining spaces in the tool bar |
7724 string. The string can be longer than needed when we reuse a | 7716 string. The string can be longer than needed when we reuse a |
7725 previous string. */ | 7717 previous string. */ |
7726 if (i + 1 == f->n_tool_bar_items) | 7718 if (i + 1 == f->n_tool_bar_items) |
7727 end = XSTRING (f->desired_tool_bar_string)->size; | 7719 end = SCHARS (f->desired_tool_bar_string); |
7728 else | 7720 else |
7729 end = i + 1; | 7721 end = i + 1; |
7730 Fadd_text_properties (make_number (i), make_number (end), | 7722 Fadd_text_properties (make_number (i), make_number (end), |
7731 props, f->desired_tool_bar_string); | 7723 props, f->desired_tool_bar_string); |
7732 #undef PROP | 7724 #undef PROP |
7986 int charpos; | 7978 int charpos; |
7987 | 7979 |
7988 /* This function can be called asynchronously, which means we must | 7980 /* This function can be called asynchronously, which means we must |
7989 exclude any possibility that Fget_text_property signals an | 7981 exclude any possibility that Fget_text_property signals an |
7990 error. */ | 7982 error. */ |
7991 charpos = min (XSTRING (f->current_tool_bar_string)->size, glyph->charpos); | 7983 charpos = min (SCHARS (f->current_tool_bar_string), glyph->charpos); |
7992 charpos = max (0, charpos); | 7984 charpos = max (0, charpos); |
7993 | 7985 |
7994 /* Get the text property `menu-item' at pos. The value of that | 7986 /* Get the text property `menu-item' at pos. The value of that |
7995 property is the start index of this item's properties in | 7987 property is the start index of this item's properties in |
7996 F->tool_bar_items. */ | 7988 F->tool_bar_items. */ |
8241 if (trace_redisplay_p) | 8233 if (trace_redisplay_p) |
8242 fprintf (stderr, "%p (%s): %s\n", | 8234 fprintf (stderr, "%p (%s): %s\n", |
8243 w, | 8235 w, |
8244 ((BUFFERP (w->buffer) | 8236 ((BUFFERP (w->buffer) |
8245 && STRINGP (XBUFFER (w->buffer)->name)) | 8237 && STRINGP (XBUFFER (w->buffer)->name)) |
8246 ? (char *) XSTRING (XBUFFER (w->buffer)->name)->data | 8238 ? (char *) SDATA (XBUFFER (w->buffer)->name) |
8247 : "no buffer"), | 8239 : "no buffer"), |
8248 buffer); | 8240 buffer); |
8249 } | 8241 } |
8250 | 8242 |
8251 #endif /* GLYPH_DEBUG */ | 8243 #endif /* GLYPH_DEBUG */ |
12391 (nargs, args) | 12383 (nargs, args) |
12392 int nargs; | 12384 int nargs; |
12393 Lisp_Object *args; | 12385 Lisp_Object *args; |
12394 { | 12386 { |
12395 Lisp_Object s = Fformat (nargs, args); | 12387 Lisp_Object s = Fformat (nargs, args); |
12396 fprintf (stderr, "%s", XSTRING (s)->data); | 12388 fprintf (stderr, "%s", SDATA (s)); |
12397 return Qnil; | 12389 return Qnil; |
12398 } | 12390 } |
12399 | 12391 |
12400 #endif /* GLYPH_DEBUG */ | 12392 #endif /* GLYPH_DEBUG */ |
12401 | 12393 |
12413 struct window *w; | 12405 struct window *w; |
12414 { | 12406 { |
12415 struct frame *f = XFRAME (WINDOW_FRAME (w)); | 12407 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
12416 struct buffer *buffer = XBUFFER (w->buffer); | 12408 struct buffer *buffer = XBUFFER (w->buffer); |
12417 struct buffer *old = current_buffer; | 12409 struct buffer *old = current_buffer; |
12418 unsigned char *arrow_string = XSTRING (Voverlay_arrow_string)->data; | 12410 unsigned char *arrow_string = SDATA (Voverlay_arrow_string); |
12419 int arrow_len = XSTRING (Voverlay_arrow_string)->size; | 12411 int arrow_len = SCHARS (Voverlay_arrow_string); |
12420 unsigned char *arrow_end = arrow_string + arrow_len; | 12412 unsigned char *arrow_end = arrow_string + arrow_len; |
12421 unsigned char *p; | 12413 unsigned char *p; |
12422 struct it it; | 12414 struct it it; |
12423 int multibyte_p; | 12415 int multibyte_p; |
12424 int n_glyphs_before; | 12416 int n_glyphs_before; |
13386 AREF (items, i + 3) = make_number (it.hpos); | 13378 AREF (items, i + 3) = make_number (it.hpos); |
13387 | 13379 |
13388 /* Display the item, pad with one space. */ | 13380 /* Display the item, pad with one space. */ |
13389 if (it.current_x < it.last_visible_x) | 13381 if (it.current_x < it.last_visible_x) |
13390 display_string (NULL, string, Qnil, 0, 0, &it, | 13382 display_string (NULL, string, Qnil, 0, 0, &it, |
13391 XSTRING (string)->size + 1, 0, 0, -1); | 13383 SCHARS (string) + 1, 0, 0, -1); |
13392 } | 13384 } |
13393 | 13385 |
13394 /* Fill out the line with spaces. */ | 13386 /* Fill out the line with spaces. */ |
13395 if (it.current_x < it.last_visible_x) | 13387 if (it.current_x < it.last_visible_x) |
13396 display_string ("", Qnil, Qnil, 0, 0, &it, -1, 0, 0, -1); | 13388 display_string ("", Qnil, Qnil, 0, 0, &it, -1, 0, 0, -1); |
13642 mode_line_proptrans_alist); | 13634 mode_line_proptrans_alist); |
13643 } | 13635 } |
13644 } | 13636 } |
13645 } | 13637 } |
13646 | 13638 |
13647 this = XSTRING (elt)->data; | 13639 this = SDATA (elt); |
13648 lisp_string = this; | 13640 lisp_string = this; |
13649 | 13641 |
13650 if (literal) | 13642 if (literal) |
13651 { | 13643 { |
13652 prec = precision - n; | 13644 prec = precision - n; |
13653 if (frame_title_ptr) | 13645 if (frame_title_ptr) |
13654 n += store_frame_title (XSTRING (elt)->data, -1, prec); | 13646 n += store_frame_title (SDATA (elt), -1, prec); |
13655 else | 13647 else |
13656 n += display_string (NULL, elt, Qnil, 0, 0, it, | 13648 n += display_string (NULL, elt, Qnil, 0, 0, it, |
13657 0, prec, 0, STRING_MULTIBYTE (elt)); | 13649 0, prec, 0, STRING_MULTIBYTE (elt)); |
13658 | 13650 |
13659 break; | 13651 break; |
14014 if (eol_flag) | 14006 if (eol_flag) |
14015 { | 14007 { |
14016 /* Mention the EOL conversion if it is not the usual one. */ | 14008 /* Mention the EOL conversion if it is not the usual one. */ |
14017 if (STRINGP (eoltype)) | 14009 if (STRINGP (eoltype)) |
14018 { | 14010 { |
14019 eol_str = XSTRING (eoltype)->data; | 14011 eol_str = SDATA (eoltype); |
14020 eol_str_len = XSTRING (eoltype)->size; | 14012 eol_str_len = SBYTES (eoltype); |
14021 } | 14013 } |
14022 else if (INTEGERP (eoltype) | 14014 else if (INTEGERP (eoltype) |
14023 && CHAR_VALID_P (XINT (eoltype), 0)) | 14015 && CHAR_VALID_P (XINT (eoltype), 0)) |
14024 { | 14016 { |
14025 eol_str = (unsigned char *) alloca (MAX_MULTIBYTE_LENGTH); | 14017 eol_str = (unsigned char *) alloca (MAX_MULTIBYTE_LENGTH); |
14144 } | 14136 } |
14145 | 14137 |
14146 case 'F': | 14138 case 'F': |
14147 /* %F displays the frame name. */ | 14139 /* %F displays the frame name. */ |
14148 if (!NILP (f->title)) | 14140 if (!NILP (f->title)) |
14149 return (char *) XSTRING (f->title)->data; | 14141 return (char *) SDATA (f->title); |
14150 if (f->explicit_name || ! FRAME_WINDOW_P (f)) | 14142 if (f->explicit_name || ! FRAME_WINDOW_P (f)) |
14151 return (char *) XSTRING (f->name)->data; | 14143 return (char *) SDATA (f->name); |
14152 return "Emacs"; | 14144 return "Emacs"; |
14153 | 14145 |
14154 case 'f': | 14146 case 'f': |
14155 obj = b->filename; | 14147 obj = b->filename; |
14156 break; | 14148 break; |
14392 } | 14384 } |
14393 | 14385 |
14394 if (STRINGP (obj)) | 14386 if (STRINGP (obj)) |
14395 { | 14387 { |
14396 *multibyte = STRING_MULTIBYTE (obj); | 14388 *multibyte = STRING_MULTIBYTE (obj); |
14397 return (char *) XSTRING (obj)->data; | 14389 return (char *) SDATA (obj); |
14398 } | 14390 } |
14399 else | 14391 else |
14400 return ""; | 14392 return ""; |
14401 } | 14393 } |
14402 | 14394 |