comparison src/redisplay.c @ 867:804517e16990

[xemacs-hg @ 2002-06-05 09:54:39 by ben] Textual renaming: text/char names abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, callint.c, casefiddle.c, casetab.c, charset.h, chartab.c, chartab.h, cmds.c, console-gtk.h, console-msw.c, console-msw.h, console-stream.c, console-tty.c, console-x.c, console-x.h, console.h, data.c, device-msw.c, device-x.c, dialog-msw.c, dired-msw.c, dired.c, doc.c, doprnt.c, editfns.c, eldap.c, emodules.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-unixoid.c, events.c, events.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, font-lock.c, frame-gtk.c, frame-msw.c, frame-x.c, frame.c, glyphs-eimage.c, glyphs-msw.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gui-x.c, gui-x.h, gui.c, gui.h, hpplay.c, indent.c, insdel.c, insdel.h, intl-win32.c, keymap.c, line-number.c, line-number.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, md5.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-ccl.c, mule-charset.c, mule-coding.c, mule-wnnfns.c, ndir.h, nt.c, objects-gtk.c, objects-gtk.h, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, postgresql.c, print.c, process-nt.c, process-unix.c, process.c, procimpl.h, realpath.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, redisplay.h, regex.c, search.c, select-common.h, select-gtk.c, select-x.c, sound.h, symbols.c, syntax.c, syntax.h, sysdep.c, sysdep.h, sysdir.h, sysfile.h, sysproc.h, syspwd.h, systime.h, syswindows.h, termcap.c, tests.c, text.c, text.h, toolbar-common.c, tooltalk.c, ui-gtk.c, unexnt.c, unicode.c, win32.c: Text/char naming rationalization. [a] distinguish between "charptr" when it refers to operations on the pointer itself and when it refers to operations on text; and [b] use consistent naming for everything referring to internal format, i.e. Itext == text in internal format Ibyte == a byte in such text Ichar == a char as represented in internal character format thus e.g. set_charptr_emchar -> set_itext_ichar The pre and post tags on either side of this change are: pre-internal-format-textual-renaming post-internal-format-textual-renaming See the Internals Manual for details of exactly how this was done, how to handle the change in your workspace, etc.
author ben
date Wed, 05 Jun 2002 09:58:45 +0000
parents 2b6fa2618f76
children 79c6ff3eef26
comparison
equal deleted inserted replaced
866:613552a02607 867:804517e16990
80 #ifdef HAVE_TTY 80 #ifdef HAVE_TTY
81 #include "console-tty.h" 81 #include "console-tty.h"
82 #endif /* HAVE_TTY */ 82 #endif /* HAVE_TTY */
83 83
84 /* Note: We have to be careful throughout this code to properly handle 84 /* Note: We have to be careful throughout this code to properly handle
85 and differentiate between Intbytes and Emchars. 85 and differentiate between Ibytes and Ichars.
86 86
87 Since strings are generally composed of Intbytes, I've taken the tack 87 Since strings are generally composed of Ibytes, I've taken the tack
88 that any contiguous set of Intbytes is called a "string", while 88 that any contiguous set of Ibytes is called a "string", while
89 any contiguous set of Emchars is called an "array". */ 89 any contiguous set of Ichars is called an "array". */
90 90
91 /* Return value to indicate a failure by an add_*_rune routine to add 91 /* Return value to indicate a failure by an add_*_rune routine to add
92 a rune, but no propagation information needs to be returned. */ 92 a rune, but no propagation information needs to be returned. */
93 #define ADD_FAILED (prop_block_dynarr *) 1 93 #define ADD_FAILED (prop_block_dynarr *) 1
94 94
116 handle to the string */ 116 handle to the string */
117 Lisp_Object string; 117 Lisp_Object string;
118 struct device *d; 118 struct device *d;
119 struct display_block *db; 119 struct display_block *db;
120 struct display_line *dl; 120 struct display_line *dl;
121 Emchar ch; /* Character that is to be added. This is 121 Ichar ch; /* Character that is to be added. This is
122 used to communicate this information to 122 used to communicate this information to
123 add_emchar_rune(). */ 123 add_ichar_rune(). */
124 Lisp_Object last_charset; /* The charset of the previous character. 124 Lisp_Object last_charset; /* The charset of the previous character.
125 Used to optimize some lookups -- we 125 Used to optimize some lookups -- we
126 only have to do some things when 126 only have to do some things when
127 the charset changes. */ 127 the charset changes. */
128 face_index last_findex; /* The face index of the previous character. 128 face_index last_findex; /* The face index of the previous character.
147 to add_blank_rune(). 147 to add_blank_rune().
148 148
149 This is also used rather cheesily to 149 This is also used rather cheesily to
150 communicate the width of the eol-cursor-size 150 communicate the width of the eol-cursor-size
151 blank that exists at the end of the line. 151 blank that exists at the end of the line.
152 add_emchar_rune() is called cheesily with 152 add_ichar_rune() is called cheesily with
153 the non-printing char '\n', which is stuck 153 the non-printing char '\n', which is stuck
154 in the output routines with its width being 154 in the output routines with its width being
155 BLANK_WIDTH. */ 155 BLANK_WIDTH. */
156 Bytexpos byte_cursor_charpos; /* This stores the buffer position of the 156 Bytexpos byte_cursor_charpos; /* This stores the buffer position of the
157 cursor. */ 157 cursor. */
215 PROP_BLANK, 215 PROP_BLANK,
216 PROP_GLYPH 216 PROP_GLYPH
217 }; 217 };
218 218
219 /* Data that should be propagated to the next line. Either a single 219 /* Data that should be propagated to the next line. Either a single
220 Emchar, a string of Intbyte's or a glyph. 220 Ichar, a string of Ibyte's or a glyph.
221 221
222 The actual data that is propagated ends up as a Dynarr of these 222 The actual data that is propagated ends up as a Dynarr of these
223 blocks. 223 blocks.
224 224
225 prop_blocks are used to indicate that data that was supposed to go 225 prop_blocks are used to indicate that data that was supposed to go
228 wrapping then we need to display the propagation data before moving 228 wrapping then we need to display the propagation data before moving
229 on. Its questionable whether we should wrap or clip glyphs in this 229 on. Its questionable whether we should wrap or clip glyphs in this
230 instance. Most e-lisp relies on clipping so we preserve this 230 instance. Most e-lisp relies on clipping so we preserve this
231 behavior. 231 behavior.
232 232
233 #### It's unclean that both Emchars and Intbytes are here. 233 #### It's unclean that both Ichars and Ibytes are here.
234 */ 234 */
235 235
236 typedef struct prop_block prop_block; 236 typedef struct prop_block prop_block;
237 struct prop_block 237 struct prop_block
238 { 238 {
240 240
241 union data 241 union data
242 { 242 {
243 struct 243 struct
244 { 244 {
245 Intbyte *str; 245 Ibyte *str;
246 Bytecount len; /* length of the string. */ 246 Bytecount len; /* length of the string. */
247 } p_string; 247 } p_string;
248 248
249 struct 249 struct
250 { 250 {
251 Emchar ch; 251 Ichar ch;
252 Bytebpos byte_cursor_charpos; /* NOTE: is in Bytebpos's */ 252 Bytebpos byte_cursor_charpos; /* NOTE: is in Bytebpos's */
253 unsigned int cursor_type :3; 253 unsigned int cursor_type :3;
254 } p_char; 254 } p_char;
255 255
256 struct 256 struct
296 struct display_line *dl, 296 struct display_line *dl,
297 int overlay_width); 297 int overlay_width);
298 static void create_right_glyph_block (struct window *w, 298 static void create_right_glyph_block (struct window *w,
299 struct display_line *dl); 299 struct display_line *dl);
300 static void redisplay_windows (Lisp_Object window, int skip_selected); 300 static void redisplay_windows (Lisp_Object window, int skip_selected);
301 static void decode_mode_spec (struct window *w, Emchar spec, int type); 301 static void decode_mode_spec (struct window *w, Ichar spec, int type);
302 static void free_display_line (struct display_line *dl); 302 static void free_display_line (struct display_line *dl);
303 static void update_line_start_cache (struct window *w, Charbpos from, 303 static void update_line_start_cache (struct window *w, Charbpos from,
304 Charbpos to, Charbpos point, 304 Charbpos to, Charbpos point,
305 int no_regen); 305 int no_regen);
306 static int point_visible (struct window *w, Charbpos point, int type); 306 static int point_visible (struct window *w, Charbpos point, int type);
346 /* #### probably temporary */ 346 /* #### probably temporary */
347 Fixnum cache_adjustment; 347 Fixnum cache_adjustment;
348 348
349 /* This holds a string representing the text corresponding to a single 349 /* This holds a string representing the text corresponding to a single
350 modeline % spec. */ 350 modeline % spec. */
351 static Intbyte_dynarr *mode_spec_intbyte_string; 351 static Ibyte_dynarr *mode_spec_ibyte_string;
352 352
353 int in_display; /* 1 if in redisplay. */ 353 int in_display; /* 1 if in redisplay. */
354 354
355 int disable_preemption; /* Used for debugging redisplay and for 355 int disable_preemption; /* Used for debugging redisplay and for
356 force-redisplay. */ 356 force-redisplay. */
517 /* low-level interfaces onto device routines */ 517 /* low-level interfaces onto device routines */
518 /* */ 518 /* */
519 /***************************************************************************/ 519 /***************************************************************************/
520 520
521 static int 521 static int
522 redisplay_text_width_emchar_string (struct window *w, int findex, 522 redisplay_text_width_ichar_string (struct window *w, int findex,
523 Emchar *str, Charcount len) 523 Ichar *str, Charcount len)
524 { 524 {
525 unsigned char charsets[NUM_LEADING_BYTES]; 525 unsigned char charsets[NUM_LEADING_BYTES];
526 Lisp_Object window; 526 Lisp_Object window;
527 527
528 find_charsets_in_emchar_string (charsets, str, len); 528 find_charsets_in_ichar_string (charsets, str, len);
529 window = wrap_window (w); 529 window = wrap_window (w);
530 ensure_face_cachel_complete (WINDOW_FACE_CACHEL (w, findex), window, 530 ensure_face_cachel_complete (WINDOW_FACE_CACHEL (w, findex), window,
531 charsets); 531 charsets);
532 return DEVMETH (XDEVICE (FRAME_DEVICE (XFRAME (WINDOW_FRAME (w)))), 532 return DEVMETH (XDEVICE (FRAME_DEVICE (XFRAME (WINDOW_FRAME (w)))),
533 text_width, (XFRAME (WINDOW_FRAME (w)), 533 text_width, (XFRAME (WINDOW_FRAME (w)),
534 WINDOW_FACE_CACHEL (w, findex), str, len)); 534 WINDOW_FACE_CACHEL (w, findex), str, len));
535 } 535 }
536 536
537 static Emchar_dynarr *rtw_emchar_dynarr; 537 static Ichar_dynarr *rtw_ichar_dynarr;
538 538
539 int 539 int
540 redisplay_text_width_string (struct window *w, int findex, 540 redisplay_text_width_string (struct window *w, int findex,
541 Intbyte *nonreloc, Lisp_Object reloc, 541 Ibyte *nonreloc, Lisp_Object reloc,
542 Bytecount offset, Bytecount len) 542 Bytecount offset, Bytecount len)
543 { 543 {
544 if (!rtw_emchar_dynarr) 544 if (!rtw_ichar_dynarr)
545 rtw_emchar_dynarr = Dynarr_new (Emchar); 545 rtw_ichar_dynarr = Dynarr_new (Ichar);
546 Dynarr_reset (rtw_emchar_dynarr); 546 Dynarr_reset (rtw_ichar_dynarr);
547 547
548 fixup_internal_substring (nonreloc, reloc, offset, &len); 548 fixup_internal_substring (nonreloc, reloc, offset, &len);
549 if (STRINGP (reloc)) 549 if (STRINGP (reloc))
550 nonreloc = XSTRING_DATA (reloc); 550 nonreloc = XSTRING_DATA (reloc);
551 convert_intbyte_string_into_emchar_dynarr (nonreloc, len, rtw_emchar_dynarr); 551 convert_ibyte_string_into_ichar_dynarr (nonreloc, len, rtw_ichar_dynarr);
552 return redisplay_text_width_emchar_string 552 return redisplay_text_width_ichar_string
553 (w, findex, Dynarr_atp (rtw_emchar_dynarr, 0), 553 (w, findex, Dynarr_atp (rtw_ichar_dynarr, 0),
554 Dynarr_length (rtw_emchar_dynarr)); 554 Dynarr_length (rtw_ichar_dynarr));
555 } 555 }
556 556
557 int 557 int
558 redisplay_frame_text_width_string (struct frame *f, Lisp_Object face, 558 redisplay_frame_text_width_string (struct frame *f, Lisp_Object face,
559 Intbyte *nonreloc, Lisp_Object reloc, 559 Ibyte *nonreloc, Lisp_Object reloc,
560 Bytecount offset, Bytecount len) 560 Bytecount offset, Bytecount len)
561 { 561 {
562 unsigned char charsets[NUM_LEADING_BYTES]; 562 unsigned char charsets[NUM_LEADING_BYTES];
563 Lisp_Object frame; 563 Lisp_Object frame;
564 struct face_cachel cachel; 564 struct face_cachel cachel;
565 565
566 if (!rtw_emchar_dynarr) 566 if (!rtw_ichar_dynarr)
567 rtw_emchar_dynarr = Dynarr_new (Emchar); 567 rtw_ichar_dynarr = Dynarr_new (Ichar);
568 Dynarr_reset (rtw_emchar_dynarr); 568 Dynarr_reset (rtw_ichar_dynarr);
569 569
570 fixup_internal_substring (nonreloc, reloc, offset, &len); 570 fixup_internal_substring (nonreloc, reloc, offset, &len);
571 if (STRINGP (reloc)) 571 if (STRINGP (reloc))
572 nonreloc = XSTRING_DATA (reloc); 572 nonreloc = XSTRING_DATA (reloc);
573 convert_intbyte_string_into_emchar_dynarr (nonreloc, len, rtw_emchar_dynarr); 573 convert_ibyte_string_into_ichar_dynarr (nonreloc, len, rtw_ichar_dynarr);
574 find_charsets_in_intbyte_string (charsets, nonreloc, len); 574 find_charsets_in_ibyte_string (charsets, nonreloc, len);
575 reset_face_cachel (&cachel); 575 reset_face_cachel (&cachel);
576 cachel.face = face; 576 cachel.face = face;
577 frame = wrap_frame (f); 577 frame = wrap_frame (f);
578 ensure_face_cachel_complete (&cachel, frame, charsets); 578 ensure_face_cachel_complete (&cachel, frame, charsets);
579 return DEVMETH (XDEVICE (FRAME_DEVICE (f)), 579 return DEVMETH (XDEVICE (FRAME_DEVICE (f)),
580 text_width, (f, &cachel, Dynarr_atp (rtw_emchar_dynarr, 0), 580 text_width, (f, &cachel, Dynarr_atp (rtw_ichar_dynarr, 0),
581 Dynarr_length (rtw_emchar_dynarr))); 581 Dynarr_length (rtw_ichar_dynarr)));
582 } 582 }
583 583
584 /* Return the display block from DL of the given TYPE. A display line 584 /* Return the display block from DL of the given TYPE. A display line
585 can have only one display block of each possible type. If DL does 585 can have only one display block of each possible type. If DL does
586 not have a block of type TYPE, one will be created and added to DL. */ 586 not have a block of type TYPE, one will be created and added to DL. */
748 display_line as a whole). 748 display_line as a whole).
749 749
750 If the baseline is completely blank, or contains no manually positioned 750 If the baseline is completely blank, or contains no manually positioned
751 glyphs, then the textual baseline is simply the baseline of the default font. 751 glyphs, then the textual baseline is simply the baseline of the default font.
752 (The `contains no manually positioned glyphs' part is actually done for 752 (The `contains no manually positioned glyphs' part is actually done for
753 us by `add_emchar_rune'.) 753 us by `add_ichar_rune'.)
754 754
755 If the baseline contains pixmaps, and they're all manually positioned, then 755 If the baseline contains pixmaps, and they're all manually positioned, then
756 the textual baseline location is constrained that way, and we need do no 756 the textual baseline location is constrained that way, and we need do no
757 work. 757 work.
758 758
959 959
960 /* Adds a character rune to a display block. If there is not enough room 960 /* Adds a character rune to a display block. If there is not enough room
961 to fit the rune on the display block (as determined by the MAX_PIXPOS) 961 to fit the rune on the display block (as determined by the MAX_PIXPOS)
962 then it adds nothing and returns ADD_FAILED. If 962 then it adds nothing and returns ADD_FAILED. If
963 NO_CONTRIBUTE_TO_LINE_HEIGHT is non-zero, don't allow the char's height 963 NO_CONTRIBUTE_TO_LINE_HEIGHT is non-zero, don't allow the char's height
964 to affect the total line height. (See add_intbyte_string_runes()). */ 964 to affect the total line height. (See add_ibyte_string_runes()). */
965 965
966 static prop_block_dynarr * 966 static prop_block_dynarr *
967 add_emchar_rune_1 (pos_data *data, int no_contribute_to_line_height) 967 add_ichar_rune_1 (pos_data *data, int no_contribute_to_line_height)
968 { 968 {
969 struct rune rb, *crb; 969 struct rune rb, *crb;
970 int width, local; 970 int width, local;
971 971
972 if (data->start_col) 972 if (data->start_col)
988 /* Cheesy end-of-line pseudo-character. */ 988 /* Cheesy end-of-line pseudo-character. */
989 width = data->blank_width; 989 width = data->blank_width;
990 } 990 }
991 else 991 else
992 { 992 {
993 Lisp_Object charset = emchar_charset (data->ch); 993 Lisp_Object charset = ichar_charset (data->ch);
994 if (!EQ (charset, data->last_charset) || 994 if (!EQ (charset, data->last_charset) ||
995 data->findex != data->last_findex) 995 data->findex != data->last_findex)
996 { 996 {
997 /* OK, we need to do things the hard way. */ 997 /* OK, we need to do things the hard way. */
998 struct window *w = XWINDOW (data->window); 998 struct window *w = XWINDOW (data->window);
1011 data->font_is_bogus = 0; 1011 data->font_is_bogus = 0;
1012 1012
1013 fi = XFONT_INSTANCE (font_instance); 1013 fi = XFONT_INSTANCE (font_instance);
1014 if (!fi->proportional_p || data->font_is_bogus) 1014 if (!fi->proportional_p || data->font_is_bogus)
1015 { 1015 {
1016 Emchar ch = data->font_is_bogus ? '~' : data->ch; 1016 Ichar ch = data->font_is_bogus ? '~' : data->ch;
1017 1017
1018 data->last_char_width = 1018 data->last_char_width =
1019 redisplay_text_width_emchar_string (XWINDOW (data->window), 1019 redisplay_text_width_ichar_string (XWINDOW (data->window),
1020 data->findex, &ch, 1); 1020 data->findex, &ch, 1);
1021 } 1021 }
1022 else 1022 else
1023 data->last_char_width = -1; 1023 data->last_char_width = -1;
1024 1024
1032 data->last_findex = data->findex; 1032 data->last_findex = data->findex;
1033 } 1033 }
1034 1034
1035 width = data->last_char_width; 1035 width = data->last_char_width;
1036 if (width < 0) /* proportional fonts */ 1036 if (width < 0) /* proportional fonts */
1037 width = redisplay_text_width_emchar_string (XWINDOW (data->window), 1037 width = redisplay_text_width_ichar_string (XWINDOW (data->window),
1038 data->findex, 1038 data->findex,
1039 &data->ch, 1); 1039 &data->ch, 1);
1040 } 1040 }
1041 1041
1042 if (data->max_pixpos != -1 && (data->pixpos + width > data->max_pixpos)) 1042 if (data->max_pixpos != -1 && (data->pixpos + width > data->max_pixpos))
1108 1108
1109 return NULL; 1109 return NULL;
1110 } 1110 }
1111 1111
1112 static prop_block_dynarr * 1112 static prop_block_dynarr *
1113 add_emchar_rune (pos_data *data) 1113 add_ichar_rune (pos_data *data)
1114 { 1114 {
1115 return add_emchar_rune_1 (data, 0); 1115 return add_ichar_rune_1 (data, 0);
1116 } 1116 }
1117 1117
1118 /* Given a string C_STRING of length C_LENGTH, call add_emchar_rune for 1118 /* Given a string C_STRING of length C_LENGTH, call add_ichar_rune for
1119 each character in the string. Propagate any left-over data unless 1119 each character in the string. Propagate any left-over data unless
1120 NO_PROP is non-zero. If NO_CONTRIBUTE_TO_LINE_HEIGHT is non-zero, don't 1120 NO_PROP is non-zero. If NO_CONTRIBUTE_TO_LINE_HEIGHT is non-zero, don't
1121 allow this character to increase the total height of the line. (This is 1121 allow this character to increase the total height of the line. (This is
1122 used when the character is part of a text glyph. In that case, the 1122 used when the character is part of a text glyph. In that case, the
1123 glyph code itself adjusts the line height as necessary, depending on 1123 glyph code itself adjusts the line height as necessary, depending on
1124 whether glyph-contrib-p is true.) */ 1124 whether glyph-contrib-p is true.) */
1125 1125
1126 static prop_block_dynarr * 1126 static prop_block_dynarr *
1127 add_intbyte_string_runes (pos_data *data, Intbyte *c_string, 1127 add_ibyte_string_runes (pos_data *data, Ibyte *c_string,
1128 Bytecount c_length, int no_prop, 1128 Bytecount c_length, int no_prop,
1129 int no_contribute_to_line_height) 1129 int no_contribute_to_line_height)
1130 { 1130 {
1131 Intbyte *pos, *end = c_string + c_length; 1131 Ibyte *pos, *end = c_string + c_length;
1132 prop_block_dynarr *prop; 1132 prop_block_dynarr *prop;
1133 1133
1134 /* #### This function is too simplistic. It needs to do the same 1134 /* #### This function is too simplistic. It needs to do the same
1135 sort of character interpretation (display-table lookup, 1135 sort of character interpretation (display-table lookup,
1136 ctl-arrow checking), etc. that create_text_block() does. 1136 ctl-arrow checking), etc. that create_text_block() does.
1137 The functionality to do this in that routine needs to be 1137 The functionality to do this in that routine needs to be
1138 modularized. */ 1138 modularized. */
1139 1139
1140 for (pos = c_string; pos < end;) 1140 for (pos = c_string; pos < end;)
1141 { 1141 {
1142 Intbyte *old_pos = pos; 1142 Ibyte *old_pos = pos;
1143 1143
1144 data->ch = charptr_emchar (pos); 1144 data->ch = itext_ichar (pos);
1145 1145
1146 prop = add_emchar_rune_1 (data, no_contribute_to_line_height); 1146 prop = add_ichar_rune_1 (data, no_contribute_to_line_height);
1147 1147
1148 if (prop) 1148 if (prop)
1149 { 1149 {
1150 if (no_prop) 1150 if (no_prop)
1151 return ADD_FAILED; 1151 return ADD_FAILED;
1154 struct prop_block pb; 1154 struct prop_block pb;
1155 Bytecount len = end - pos; 1155 Bytecount len = end - pos;
1156 prop = Dynarr_new (prop_block); 1156 prop = Dynarr_new (prop_block);
1157 1157
1158 pb.type = PROP_STRING; 1158 pb.type = PROP_STRING;
1159 pb.data.p_string.str = xnew_array (Intbyte, len); 1159 pb.data.p_string.str = xnew_array (Ibyte, len);
1160 strncpy ((char *) pb.data.p_string.str, (char *) pos, len); 1160 strncpy ((char *) pb.data.p_string.str, (char *) pos, len);
1161 pb.data.p_string.len = len; 1161 pb.data.p_string.len = len;
1162 1162
1163 Dynarr_add (prop, pb); 1163 Dynarr_add (prop, pb);
1164 return prop; 1164 return prop;
1165 } 1165 }
1166 } 1166 }
1167 INC_CHARPTR (pos); 1167 INC_IBYTEPTR (pos);
1168 assert (pos <= end); 1168 assert (pos <= end);
1169 /* #### Duplicate code from add_string_to_fstring_db_runes 1169 /* #### Duplicate code from add_string_to_fstring_db_runes
1170 should we do more?*/ 1170 should we do more?*/
1171 data->bytepos += pos - old_pos; 1171 data->bytepos += pos - old_pos;
1172 } 1172 }
1260 1260
1261 /* Add runes representing a character in octal. */ 1261 /* Add runes representing a character in octal. */
1262 1262
1263 #define ADD_NEXT_OCTAL_RUNE_CHAR do \ 1263 #define ADD_NEXT_OCTAL_RUNE_CHAR do \
1264 { \ 1264 { \
1265 if (add_failed || (add_failed = add_emchar_rune (data))) \ 1265 if (add_failed || (add_failed = add_ichar_rune (data))) \
1266 { \ 1266 { \
1267 struct prop_block pb; \ 1267 struct prop_block pb; \
1268 if (!prop) \ 1268 if (!prop) \
1269 prop = Dynarr_new (prop_block); \ 1269 prop = Dynarr_new (prop_block); \
1270 \ 1270 \
1277 1277
1278 static prop_block_dynarr * 1278 static prop_block_dynarr *
1279 add_octal_runes (pos_data *data) 1279 add_octal_runes (pos_data *data)
1280 { 1280 {
1281 prop_block_dynarr *add_failed, *prop = 0; 1281 prop_block_dynarr *add_failed, *prop = 0;
1282 Emchar orig_char = data->ch; 1282 Ichar orig_char = data->ch;
1283 int orig_cursor_type = data->cursor_type; 1283 int orig_cursor_type = data->cursor_type;
1284 1284
1285 /* Initialize */ 1285 /* Initialize */
1286 add_failed = NULL; 1286 add_failed = NULL;
1287 1287
1353 add_control_char_runes (pos_data *data, struct buffer *b) 1353 add_control_char_runes (pos_data *data, struct buffer *b)
1354 { 1354 {
1355 if (!NILP (b->ctl_arrow)) 1355 if (!NILP (b->ctl_arrow))
1356 { 1356 {
1357 prop_block_dynarr *prop; 1357 prop_block_dynarr *prop;
1358 Emchar orig_char = data->ch; 1358 Ichar orig_char = data->ch;
1359 int old_cursor_type = data->cursor_type; 1359 int old_cursor_type = data->cursor_type;
1360 1360
1361 /* Initialize */ 1361 /* Initialize */
1362 prop = NULL; 1362 prop = NULL;
1363 1363
1394 data->ch = '?'; 1394 data->ch = '?';
1395 else 1395 else
1396 data->ch = orig_char ^ 0100; 1396 data->ch = orig_char ^ 0100;
1397 data->cursor_type = IGNORE_CURSOR; 1397 data->cursor_type = IGNORE_CURSOR;
1398 1398
1399 if (add_emchar_rune (data)) 1399 if (add_ichar_rune (data))
1400 { 1400 {
1401 struct prop_block pb; 1401 struct prop_block pb;
1402 if (!prop) 1402 if (!prop)
1403 prop = Dynarr_new (prop_block); 1403 prop = Dynarr_new (prop_block);
1404 1404
1422 { 1422 {
1423 prop_block_dynarr *prop = NULL; 1423 prop_block_dynarr *prop = NULL;
1424 1424
1425 if (STRINGP (entry)) 1425 if (STRINGP (entry))
1426 { 1426 {
1427 prop = add_intbyte_string_runes (data, 1427 prop = add_ibyte_string_runes (data,
1428 XSTRING_DATA (entry), 1428 XSTRING_DATA (entry),
1429 XSTRING_LENGTH (entry), 1429 XSTRING_LENGTH (entry),
1430 0, 0); 1430 0, 0);
1431 } 1431 }
1432 else if (GLYPHP (entry)) 1432 else if (GLYPHP (entry))
1448 } 1448 }
1449 } 1449 }
1450 else if (CHAR_OR_CHAR_INTP (entry)) 1450 else if (CHAR_OR_CHAR_INTP (entry))
1451 { 1451 {
1452 data->ch = XCHAR_OR_CHAR_INT (entry); 1452 data->ch = XCHAR_OR_CHAR_INT (entry);
1453 prop = add_emchar_rune (data); 1453 prop = add_ichar_rune (data);
1454 } 1454 }
1455 else if (CONSP (entry)) 1455 else if (CONSP (entry))
1456 { 1456 {
1457 if (EQ (XCAR (entry), Qformat) 1457 if (EQ (XCAR (entry), Qformat)
1458 && CONSP (XCDR (entry)) 1458 && CONSP (XCDR (entry))
1459 && STRINGP (XCAR (XCDR (entry)))) 1459 && STRINGP (XCAR (XCDR (entry))))
1460 { 1460 {
1461 Lisp_Object format = XCAR (XCDR (entry)); 1461 Lisp_Object format = XCAR (XCDR (entry));
1462 Bytebpos len = XSTRING_LENGTH (format); 1462 Bytebpos len = XSTRING_LENGTH (format);
1463 Intbyte *src = XSTRING_DATA (format), *end = src + len; 1463 Ibyte *src = XSTRING_DATA (format), *end = src + len;
1464 Intbyte *result = alloca_array (Intbyte, len); 1464 Ibyte *result = alloca_array (Ibyte, len);
1465 Intbyte *dst = result; 1465 Ibyte *dst = result;
1466 1466
1467 while (src < end) 1467 while (src < end)
1468 { 1468 {
1469 Emchar c = charptr_emchar (src); 1469 Ichar c = itext_ichar (src);
1470 INC_CHARPTR (src); 1470 INC_IBYTEPTR (src);
1471 if (c != '%' || src == end) 1471 if (c != '%' || src == end)
1472 dst += set_charptr_emchar (dst, c); 1472 dst += set_itext_ichar (dst, c);
1473 else 1473 else
1474 { 1474 {
1475 c = charptr_emchar (src); 1475 c = itext_ichar (src);
1476 INC_CHARPTR (src); 1476 INC_IBYTEPTR (src);
1477 switch (c) 1477 switch (c)
1478 { 1478 {
1479 /*case 'x': 1479 /*case 'x':
1480 dst += long_to_string_base ((char *)dst, data->ch, 16); 1480 dst += long_to_string_base ((char *)dst, data->ch, 16);
1481 break;*/ 1481 break;*/
1482 case '%': 1482 case '%':
1483 dst += set_charptr_emchar (dst, '%'); 1483 dst += set_itext_ichar (dst, '%');
1484 break; 1484 break;
1485 /* #### unimplemented */ 1485 /* #### unimplemented */
1486 } 1486 }
1487 } 1487 }
1488 } 1488 }
1489 prop = add_intbyte_string_runes (data, result, dst - result, 0, 0); 1489 prop = add_ibyte_string_runes (data, result, dst - result, 0, 0);
1490 } 1490 }
1491 } 1491 }
1492 1492
1493 /* Else blow it off because someone added a bad entry and we don't 1493 /* Else blow it off because someone added a bad entry and we don't
1494 have any safe way of signaling an error. */ 1494 have any safe way of signaling an error. */
1558 { 1558 {
1559 case PROP_CHAR: 1559 case PROP_CHAR:
1560 data->ch = pb->data.p_char.ch; 1560 data->ch = pb->data.p_char.ch;
1561 data->byte_cursor_charpos = pb->data.p_char.byte_cursor_charpos; 1561 data->byte_cursor_charpos = pb->data.p_char.byte_cursor_charpos;
1562 data->cursor_type = pb->data.p_char.cursor_type; 1562 data->cursor_type = pb->data.p_char.cursor_type;
1563 add_failed = add_emchar_rune (data); 1563 add_failed = add_ichar_rune (data);
1564 1564
1565 if (add_failed) 1565 if (add_failed)
1566 goto oops_no_more_space; 1566 goto oops_no_more_space;
1567 break; 1567 break;
1568 case PROP_STRING: 1568 case PROP_STRING:
1569 if (pb->data.p_string.str) 1569 if (pb->data.p_string.str)
1570 xfree (pb->data.p_string.str); 1570 xfree (pb->data.p_string.str);
1571 /* #### bogus bogus -- this doesn't do anything! 1571 /* #### bogus bogus -- this doesn't do anything!
1572 Should probably call add_intbyte_string_runes(), 1572 Should probably call add_ibyte_string_runes(),
1573 once that function is fixed. */ 1573 once that function is fixed. */
1574 break; 1574 break;
1575 case PROP_MINIBUF_PROMPT: 1575 case PROP_MINIBUF_PROMPT:
1576 { 1576 {
1577 face_index old_findex = data->findex; 1577 face_index old_findex = data->findex;
1581 data->byte_charpos = 0; 1581 data->byte_charpos = 0;
1582 data->cursor_type = NO_CURSOR; 1582 data->cursor_type = NO_CURSOR;
1583 1583
1584 while (pb->data.p_string.len > 0) 1584 while (pb->data.p_string.len > 0)
1585 { 1585 {
1586 data->ch = charptr_emchar (pb->data.p_string.str); 1586 data->ch = itext_ichar (pb->data.p_string.str);
1587 add_failed = add_emchar_rune (data); 1587 add_failed = add_ichar_rune (data);
1588 1588
1589 if (add_failed) 1589 if (add_failed)
1590 { 1590 {
1591 data->findex = old_findex; 1591 data->findex = old_findex;
1592 data->byte_charpos = byte_old_charpos; 1592 data->byte_charpos = byte_old_charpos;
1593 goto oops_no_more_space; 1593 goto oops_no_more_space;
1594 } 1594 }
1595 else 1595 else
1596 { 1596 {
1597 /* Complicated equivalent of ptr++, len-- */ 1597 /* Complicated equivalent of ptr++, len-- */
1598 Intbyte *oldpos = pb->data.p_string.str; 1598 Ibyte *oldpos = pb->data.p_string.str;
1599 INC_CHARPTR (pb->data.p_string.str); 1599 INC_IBYTEPTR (pb->data.p_string.str);
1600 pb->data.p_string.len -= pb->data.p_string.str - oldpos; 1600 pb->data.p_string.len -= pb->data.p_string.str - oldpos;
1601 } 1601 }
1602 } 1602 }
1603 1603
1604 data->findex = old_findex; 1604 data->findex = old_findex;
1871 1871
1872 data->findex = findex; 1872 data->findex = findex;
1873 data->byte_start_col_enabled = 0; 1873 data->byte_start_col_enabled = 0;
1874 if (!allow_cursor) 1874 if (!allow_cursor)
1875 data->byte_charpos = 0; 1875 data->byte_charpos = 0;
1876 add_intbyte_string_runes (data, XSTRING_DATA (string), 1876 add_ibyte_string_runes (data, XSTRING_DATA (string),
1877 XSTRING_LENGTH (string), 0, 1); 1877 XSTRING_LENGTH (string), 0, 1);
1878 data->findex = orig_findex; 1878 data->findex = orig_findex;
1879 data->byte_charpos = orig_charpos; 1879 data->byte_charpos = orig_charpos;
1880 data->byte_start_col_enabled = orig_start_col_enabled; 1880 data->byte_start_col_enabled = orig_start_col_enabled;
1881 return retval; 1881 return retval;
2070 2070
2071 #s(range-table data ((256 524288) (format "%x"))) 2071 #s(range-table data ((256 524288) (format "%x")))
2072 2072
2073 Since more than one display table is possible, you have 2073 Since more than one display table is possible, you have
2074 great flexibility in mapping ranges of characters. */ 2074 great flexibility in mapping ranges of characters. */
2075 Emchar printable_min = (CHAR_OR_CHAR_INTP (b->ctl_arrow) 2075 Ichar printable_min = (CHAR_OR_CHAR_INTP (b->ctl_arrow)
2076 ? XCHAR_OR_CHAR_INT (b->ctl_arrow) 2076 ? XCHAR_OR_CHAR_INT (b->ctl_arrow)
2077 : ((EQ (b->ctl_arrow, Qt) || EQ (b->ctl_arrow, Qnil)) 2077 : ((EQ (b->ctl_arrow, Qt) || EQ (b->ctl_arrow, Qnil))
2078 ? 255 : 160)); 2078 ? 255 : 160));
2079 2079
2080 Lisp_Object face_dt, window_dt; 2080 Lisp_Object face_dt, window_dt;
2371 Dynarr_free (*prop); 2371 Dynarr_free (*prop);
2372 *prop = 0; 2372 *prop = 0;
2373 } 2373 }
2374 else { 2374 else {
2375 data.blank_width = DEVMETH (d, eol_cursor_width, ()); 2375 data.blank_width = DEVMETH (d, eol_cursor_width, ());
2376 add_emchar_rune (&data); /* discard prop data. */ 2376 add_ichar_rune (&data); /* discard prop data. */
2377 goto done; 2377 goto done;
2378 } 2378 }
2379 } 2379 }
2380 else 2380 else
2381 goto done; 2381 goto done;
2434 /* Cheesy, cheesy, cheesy. We mark the end of the 2434 /* Cheesy, cheesy, cheesy. We mark the end of the
2435 line with a special "character rune" whose width 2435 line with a special "character rune" whose width
2436 is the EOL cursor width and whose character is 2436 is the EOL cursor width and whose character is
2437 the non-printing character '\n'. */ 2437 the non-printing character '\n'. */
2438 data.blank_width = DEVMETH (d, eol_cursor_width, ()); 2438 data.blank_width = DEVMETH (d, eol_cursor_width, ());
2439 *prop = add_emchar_rune (&data); 2439 *prop = add_ichar_rune (&data);
2440 } 2440 }
2441 2441
2442 /* We need to set data.byte_charpos to the start of the 2442 /* We need to set data.byte_charpos to the start of the
2443 next visible region in order to make this line 2443 next visible region in order to make this line
2444 appear to contain all of the invisible area. 2444 appear to contain all of the invisible area.
2460 DEC_BYTEBPOS (b, data.byte_charpos); 2460 DEC_BYTEBPOS (b, data.byte_charpos);
2461 } 2461 }
2462 else 2462 else
2463 { 2463 {
2464 data.blank_width = DEVMETH (d, eol_cursor_width, ()); 2464 data.blank_width = DEVMETH (d, eol_cursor_width, ());
2465 *prop = add_emchar_rune (&data); 2465 *prop = add_ichar_rune (&data);
2466 } 2466 }
2467 2467
2468 goto done; 2468 goto done;
2469 } 2469 }
2470 2470
2525 data.findex = DEFAULT_INDEX; 2525 data.findex = DEFAULT_INDEX;
2526 data.start_col = 0; 2526 data.start_col = 0;
2527 data.start_col_xoffset = 0; 2527 data.start_col_xoffset = 0;
2528 data.byte_start_col_enabled = 0; 2528 data.byte_start_col_enabled = 0;
2529 2529
2530 add_emchar_rune (&data); 2530 add_ichar_rune (&data);
2531 } 2531 }
2532 2532
2533 /* This had better be a newline but doing it this way 2533 /* This had better be a newline but doing it this way
2534 we'll see obvious incorrect results if it isn't. No 2534 we'll see obvious incorrect results if it isn't. No
2535 need to abort here. */ 2535 need to abort here. */
2540 2540
2541 /* If the current character is considered to be printable, then 2541 /* If the current character is considered to be printable, then
2542 just add it. */ 2542 just add it. */
2543 else if (data.ch >= printable_min) 2543 else if (data.ch >= printable_min)
2544 { 2544 {
2545 *prop = add_emchar_rune (&data); 2545 *prop = add_ichar_rune (&data);
2546 if (*prop) 2546 if (*prop)
2547 goto done; 2547 goto done;
2548 } 2548 }
2549 2549
2550 /* If the current character is a tab, determine the next tab 2550 /* If the current character is a tab, determine the next tab
2600 The is_*() routines have undefined results on 2600 The is_*() routines have undefined results on
2601 arguments outside of the range [-1, 255]. (This 2601 arguments outside of the range [-1, 255]. (This
2602 often bites people who carelessly use `char' instead 2602 often bites people who carelessly use `char' instead
2603 of `unsigned char'.) 2603 of `unsigned char'.)
2604 */ 2604 */
2605 else if (data.ch < 0x100 && iscntrl ((Intbyte) data.ch)) 2605 else if (data.ch < 0x100 && iscntrl ((Ibyte) data.ch))
2606 { 2606 {
2607 *prop = add_control_char_runes (&data, b); 2607 *prop = add_control_char_runes (&data, b);
2608 2608
2609 if (*prop) 2609 if (*prop)
2610 goto done; 2610 goto done;
2622 2622
2623 /* Assume the current character is considered to be printable, 2623 /* Assume the current character is considered to be printable,
2624 then just add it. */ 2624 then just add it. */
2625 else 2625 else
2626 { 2626 {
2627 *prop = add_emchar_rune (&data); 2627 *prop = add_ichar_rune (&data);
2628 if (*prop) 2628 if (*prop)
2629 goto done; 2629 goto done;
2630 } 2630 }
2631 2631
2632 INC_BYTEBPOS (b, data.byte_charpos); 2632 INC_BYTEBPOS (b, data.byte_charpos);
2683 /* This duplicates code down below to add a newline to 2683 /* This duplicates code down below to add a newline to
2684 the end of an otherwise empty line.*/ 2684 the end of an otherwise empty line.*/
2685 data.ch = '\n'; 2685 data.ch = '\n';
2686 data.blank_width = DEVMETH (d, eol_cursor_width, ()); 2686 data.blank_width = DEVMETH (d, eol_cursor_width, ());
2687 2687
2688 add_emchar_rune (&data); 2688 add_ichar_rune (&data);
2689 } 2689 }
2690 } 2690 }
2691 2691
2692 INC_BYTEBPOS (b, data.byte_charpos); 2692 INC_BYTEBPOS (b, data.byte_charpos);
2693 } 2693 }
2769 data.start_col = 0; 2769 data.start_col = 0;
2770 data.start_col_xoffset = 0; 2770 data.start_col_xoffset = 0;
2771 data.byte_start_col_enabled = 0; 2771 data.byte_start_col_enabled = 0;
2772 2772
2773 data.max_pixpos += data.blank_width; 2773 data.max_pixpos += data.blank_width;
2774 add_emchar_rune (&data); 2774 add_ichar_rune (&data);
2775 data.max_pixpos -= data.blank_width; 2775 data.max_pixpos -= data.blank_width;
2776 2776
2777 /* #### urk! Chuck, this shit is bad news. Going around 2777 /* #### urk! Chuck, this shit is bad news. Going around
2778 manipulating invalid positions is guaranteed to result in 2778 manipulating invalid positions is guaranteed to result in
2779 trouble sooner or later. */ 2779 trouble sooner or later. */
2930 2930
2931 Dynarr_reset (data.db->runes); 2931 Dynarr_reset (data.db->runes);
2932 2932
2933 if (STRINGP (Voverlay_arrow_string)) 2933 if (STRINGP (Voverlay_arrow_string))
2934 { 2934 {
2935 add_intbyte_string_runes 2935 add_ibyte_string_runes
2936 (&data, 2936 (&data,
2937 XSTRING_DATA (Voverlay_arrow_string), 2937 XSTRING_DATA (Voverlay_arrow_string),
2938 XSTRING_LENGTH (Voverlay_arrow_string), 2938 XSTRING_LENGTH (Voverlay_arrow_string),
2939 1, 0); 2939 1, 0);
2940 } 2940 }
3769 /* Now create the result string and frob the extents into it. */ 3769 /* Now create the result string and frob the extents into it. */
3770 if (!NILP (result_str)) 3770 if (!NILP (result_str))
3771 { 3771 {
3772 int elt; 3772 int elt;
3773 Bytecount len; 3773 Bytecount len;
3774 Intbyte *strdata; 3774 Ibyte *strdata;
3775 struct buffer *buf = XBUFFER (WINDOW_BUFFER (w)); 3775 struct buffer *buf = XBUFFER (WINDOW_BUFFER (w));
3776 3776
3777 in_modeline_generation = 1; 3777 in_modeline_generation = 1;
3778 3778
3779 sledgehammer_check_ascii_begin (result_str); 3779 sledgehammer_check_ascii_begin (result_str);
3785 3785
3786 for (elt = 0, len = 0; elt < Dynarr_length (db->runes); elt++) 3786 for (elt = 0, len = 0; elt < Dynarr_length (db->runes); elt++)
3787 { 3787 {
3788 if (Dynarr_atp (db->runes, elt)->type == RUNE_CHAR) 3788 if (Dynarr_atp (db->runes, elt)->type == RUNE_CHAR)
3789 { 3789 {
3790 len += (set_charptr_emchar 3790 len += (set_itext_ichar
3791 (strdata + len, Dynarr_atp (db->runes, 3791 (strdata + len, Dynarr_atp (db->runes,
3792 elt)->object.chr.ch)); 3792 elt)->object.chr.ch));
3793 } 3793 }
3794 } 3794 }
3795 3795
3916 for any embedded faces. */ 3916 for any embedded faces. */
3917 dl->ypos = WINDOW_BOTTOM (w) - dl->descent - ypos_adj; 3917 dl->ypos = WINDOW_BOTTOM (w) - dl->descent - ypos_adj;
3918 } 3918 }
3919 3919
3920 static Charcount 3920 static Charcount
3921 add_string_to_fstring_db_runes (pos_data *data, const Intbyte *str, 3921 add_string_to_fstring_db_runes (pos_data *data, const Ibyte *str,
3922 Charcount pos, Charcount min_pos, 3922 Charcount pos, Charcount min_pos,
3923 Charcount max_pos) 3923 Charcount max_pos)
3924 { 3924 {
3925 /* This function has been Mule-ized. */ 3925 /* This function has been Mule-ized. */
3926 Charcount end; 3926 Charcount end;
3927 const Intbyte *cur_pos = str; 3927 const Ibyte *cur_pos = str;
3928 struct display_block *db = data->db; 3928 struct display_block *db = data->db;
3929 3929
3930 data->blank_width = space_width (XWINDOW (data->window)); 3930 data->blank_width = space_width (XWINDOW (data->window));
3931 while (Dynarr_length (db->runes) < pos) 3931 while (Dynarr_length (db->runes) < pos)
3932 add_blank_rune (data, NULL, 0); 3932 add_blank_rune (data, NULL, 0);
3936 if (max_pos != -1) 3936 if (max_pos != -1)
3937 end = min (max_pos, end); 3937 end = min (max_pos, end);
3938 3938
3939 while (pos < end && *cur_pos) 3939 while (pos < end && *cur_pos)
3940 { 3940 {
3941 const Intbyte *old_cur_pos = cur_pos; 3941 const Ibyte *old_cur_pos = cur_pos;
3942 int succeeded; 3942 int succeeded;
3943 3943
3944 data->ch = charptr_emchar (cur_pos); 3944 data->ch = itext_ichar (cur_pos);
3945 succeeded = (add_emchar_rune (data) != ADD_FAILED); 3945 succeeded = (add_ichar_rune (data) != ADD_FAILED);
3946 INC_CHARPTR (cur_pos); 3946 INC_IBYTEPTR (cur_pos);
3947 if (succeeded) 3947 if (succeeded)
3948 { 3948 {
3949 pos++; 3949 pos++;
3950 data->modeline_charpos++; 3950 data->modeline_charpos++;
3951 data->bytepos += cur_pos - old_cur_pos; 3951 data->bytepos += cur_pos - old_cur_pos;
4027 if (STRINGP (elt)) 4027 if (STRINGP (elt))
4028 { 4028 {
4029 /* A string. Add to the display line and check for %-constructs 4029 /* A string. Add to the display line and check for %-constructs
4030 within it. */ 4030 within it. */
4031 4031
4032 Intbyte *this = XSTRING_DATA (elt); 4032 Ibyte *this = XSTRING_DATA (elt);
4033 4033
4034 while ((pos < max_pos || max_pos == -1) && *this) 4034 while ((pos < max_pos || max_pos == -1) && *this)
4035 { 4035 {
4036 Intbyte *last = this; 4036 Ibyte *last = this;
4037 4037
4038 while (*this && *this != '%') 4038 while (*this && *this != '%')
4039 this++; 4039 this++;
4040 4040
4041 if (this != last) 4041 if (this != last)
4048 *offset -= size; 4048 *offset -= size;
4049 else 4049 else
4050 { 4050 {
4051 Charcount tmp_max = (max_pos == -1 ? pos + size - *offset : 4051 Charcount tmp_max = (max_pos == -1 ? pos + size - *offset :
4052 min (pos + size - *offset, max_pos)); 4052 min (pos + size - *offset, max_pos));
4053 const Intbyte *tmp_last = charptr_n_addr (last, *offset); 4053 const Ibyte *tmp_last = itext_n_addr (last, *offset);
4054 4054
4055 pos = add_string_to_fstring_db_runes (data, tmp_last, 4055 pos = add_string_to_fstring_db_runes (data, tmp_last,
4056 pos, pos, tmp_max); 4056 pos, pos, tmp_max);
4057 *offset = 0; 4057 *offset = 0;
4058 } 4058 }
4092 num_to_add = max_pos - pos; 4092 num_to_add = max_pos - pos;
4093 else 4093 else
4094 { 4094 {
4095 int cur_pixsize; 4095 int cur_pixsize;
4096 int dash_pixsize; 4096 int dash_pixsize;
4097 Intbyte ch = '-'; 4097 Ibyte ch = '-';
4098 SET_CURRENT_MODE_CHARS_PIXSIZE; 4098 SET_CURRENT_MODE_CHARS_PIXSIZE;
4099 4099
4100 dash_pixsize = 4100 dash_pixsize =
4101 redisplay_text_width_string (w, findex, &ch, Qnil, 0, 4101 redisplay_text_width_string (w, findex, &ch, Qnil, 0,
4102 1); 4102 1);
4105 num_to_add++; 4105 num_to_add++;
4106 } 4106 }
4107 4107
4108 while (num_to_add--) 4108 while (num_to_add--)
4109 pos = add_string_to_fstring_db_runes 4109 pos = add_string_to_fstring_db_runes
4110 (data, (const Intbyte *) "-", pos, pos, max_pos); 4110 (data, (const Ibyte *) "-", pos, pos, max_pos);
4111 } 4111 }
4112 else if (*this != 0) 4112 else if (*this != 0)
4113 { 4113 {
4114 Emchar ch = charptr_emchar (this); 4114 Ichar ch = itext_ichar (this);
4115 Intbyte *str; 4115 Ibyte *str;
4116 Charcount size; 4116 Charcount size;
4117 4117
4118 decode_mode_spec (w, ch, type); 4118 decode_mode_spec (w, ch, type);
4119 4119
4120 str = Dynarr_atp (mode_spec_intbyte_string, 0); 4120 str = Dynarr_atp (mode_spec_ibyte_string, 0);
4121 size = bytecount_to_charcount 4121 size = bytecount_to_charcount
4122 /* Skip the null character added by `decode_mode_spec' */ 4122 /* Skip the null character added by `decode_mode_spec' */
4123 (str, Dynarr_length (mode_spec_intbyte_string)) - 1; 4123 (str, Dynarr_length (mode_spec_ibyte_string)) - 1;
4124 4124
4125 if (size <= *offset) 4125 if (size <= *offset)
4126 *offset -= size; 4126 *offset -= size;
4127 else 4127 else
4128 { 4128 {
4129 const Intbyte *tmp_str = charptr_n_addr (str, *offset); 4129 const Ibyte *tmp_str = itext_n_addr (str, *offset);
4130 4130
4131 /* #### NOTE: I don't understand why a tmp_max is not 4131 /* #### NOTE: I don't understand why a tmp_max is not
4132 computed and used here as in the plain string case 4132 computed and used here as in the plain string case
4133 above. -- dv */ 4133 above. -- dv */
4134 pos = add_string_to_fstring_db_runes (data, tmp_str, 4134 pos = add_string_to_fstring_db_runes (data, tmp_str,
4138 } 4138 }
4139 } 4139 }
4140 4140
4141 /* NOT this++. There could be any sort of character at 4141 /* NOT this++. There could be any sort of character at
4142 the current position. */ 4142 the current position. */
4143 INC_CHARPTR (this); 4143 INC_IBYTEPTR (this);
4144 } 4144 }
4145 4145
4146 if (max_pixsize > 0) 4146 if (max_pixsize > 0)
4147 { 4147 {
4148 int cur_pixsize; 4148 int cur_pixsize;
4163 { 4163 {
4164 /* If value is a string, output that string literally: 4164 /* If value is a string, output that string literally:
4165 don't check for % within it. */ 4165 don't check for % within it. */
4166 if (STRINGP (tem)) 4166 if (STRINGP (tem))
4167 { 4167 {
4168 Intbyte *str = XSTRING_DATA (tem); 4168 Ibyte *str = XSTRING_DATA (tem);
4169 Charcount size = string_char_length (tem); 4169 Charcount size = string_char_length (tem);
4170 4170
4171 if (size <= *offset) 4171 if (size <= *offset)
4172 *offset -= size; 4172 *offset -= size;
4173 else 4173 else
4174 { 4174 {
4175 const Intbyte *tmp_str = charptr_n_addr (str, *offset); 4175 const Ibyte *tmp_str = itext_n_addr (str, *offset);
4176 4176
4177 /* #### NOTE: I don't understand why a tmp_max is not 4177 /* #### NOTE: I don't understand why a tmp_max is not
4178 computed and used here as in the plain string case 4178 computed and used here as in the plain string case
4179 above. -- dv */ 4179 above. -- dv */
4180 pos = add_string_to_fstring_db_runes (data, tmp_str, pos, 4180 pos = add_string_to_fstring_db_runes (data, tmp_str, pos,
4368 4368
4369 if (size <= *offset) 4369 if (size <= *offset)
4370 *offset -= size; 4370 *offset -= size;
4371 else 4371 else
4372 { 4372 {
4373 const Intbyte *tmp_str = 4373 const Ibyte *tmp_str =
4374 charptr_n_addr ((const Intbyte *) str, *offset); 4374 itext_n_addr ((const Ibyte *) str, *offset);
4375 4375
4376 /* #### NOTE: I don't understand why a tmp_max is not computed and 4376 /* #### NOTE: I don't understand why a tmp_max is not computed and
4377 used here as in the plain string case above. -- dv */ 4377 used here as in the plain string case above. -- dv */
4378 pos = add_string_to_fstring_db_runes (data, tmp_str, pos, 4378 pos = add_string_to_fstring_db_runes (data, tmp_str, pos,
4379 min_pos, max_pos); 4379 min_pos, max_pos);
4382 } 4382 }
4383 } 4383 }
4384 4384
4385 if (min_pos > pos) 4385 if (min_pos > pos)
4386 { 4386 {
4387 add_string_to_fstring_db_runes (data, (const Intbyte *) "", pos, 4387 add_string_to_fstring_db_runes (data, (const Ibyte *) "", pos,
4388 min_pos, -1); 4388 min_pos, -1);
4389 } 4389 }
4390 4390
4391 return pos; 4391 return pos;
4392 } 4392 }
4571 4571
4572 #s(range-table data ((256 524288) (format "%x"))) 4572 #s(range-table data ((256 524288) (format "%x")))
4573 4573
4574 Since more than one display table is possible, you have 4574 Since more than one display table is possible, you have
4575 great flexibility in mapping ranges of characters. */ 4575 great flexibility in mapping ranges of characters. */
4576 Emchar printable_min = b ? (CHAR_OR_CHAR_INTP (b->ctl_arrow) 4576 Ichar printable_min = b ? (CHAR_OR_CHAR_INTP (b->ctl_arrow)
4577 ? XCHAR_OR_CHAR_INT (b->ctl_arrow) 4577 ? XCHAR_OR_CHAR_INT (b->ctl_arrow)
4578 : ((EQ (b->ctl_arrow, Qt) || EQ (b->ctl_arrow, Qnil)) 4578 : ((EQ (b->ctl_arrow, Qt) || EQ (b->ctl_arrow, Qnil))
4579 ? 255 : 160)) : 255; 4579 ? 255 : 160)) : 255;
4580 4580
4581 Lisp_Object face_dt, window_dt; 4581 Lisp_Object face_dt, window_dt;
4790 here rather than doing them at the end of handling the 4790 here rather than doing them at the end of handling the
4791 previous run so that glyphs at the beginning and end of 4791 previous run so that glyphs at the beginning and end of
4792 a line are handled correctly. */ 4792 a line are handled correctly. */
4793 else if (Dynarr_length (data.ef->end_glyphs) > 0) 4793 else if (Dynarr_length (data.ef->end_glyphs) > 0)
4794 { 4794 {
4795 data.ch = string_emchar (disp_string, data.byte_charpos); 4795 data.ch = string_ichar (disp_string, data.byte_charpos);
4796 *prop = add_glyph_runes (&data, END_GLYPHS); 4796 *prop = add_glyph_runes (&data, END_GLYPHS);
4797 4797
4798 if (*prop) { 4798 if (*prop) {
4799 goto done; 4799 goto done;
4800 } 4800 }
4801 } 4801 }
4802 4802
4803 /* If there are begin glyphs, add them to the line. */ 4803 /* If there are begin glyphs, add them to the line. */
4804 else if (Dynarr_length (data.ef->begin_glyphs) > 0) 4804 else if (Dynarr_length (data.ef->begin_glyphs) > 0)
4805 { 4805 {
4806 data.ch = string_emchar (disp_string, data.byte_charpos); 4806 data.ch = string_ichar (disp_string, data.byte_charpos);
4807 *prop = add_glyph_runes (&data, BEGIN_GLYPHS); 4807 *prop = add_glyph_runes (&data, BEGIN_GLYPHS);
4808 4808
4809 if (*prop) { 4809 if (*prop) {
4810 goto done; 4810 goto done;
4811 } 4811 }
4819 4819
4820 else 4820 else
4821 { 4821 {
4822 Lisp_Object entry = Qnil; 4822 Lisp_Object entry = Qnil;
4823 /* Get the character at the current buffer position. */ 4823 /* Get the character at the current buffer position. */
4824 data.ch = string_emchar (disp_string, data.byte_charpos); 4824 data.ch = string_ichar (disp_string, data.byte_charpos);
4825 if (!NILP (face_dt) || !NILP (window_dt)) 4825 if (!NILP (face_dt) || !NILP (window_dt))
4826 entry = display_table_entry (data.ch, face_dt, window_dt); 4826 entry = display_table_entry (data.ch, face_dt, window_dt);
4827 4827
4828 /* If there is a display table entry for it, hand it off to 4828 /* If there is a display table entry for it, hand it off to
4829 add_disp_table_entry_runes and let it worry about it. */ 4829 add_disp_table_entry_runes and let it worry about it. */
4848 4848
4849 /* If the current character is considered to be printable, then 4849 /* If the current character is considered to be printable, then
4850 just add it. */ 4850 just add it. */
4851 else if (data.ch >= printable_min) 4851 else if (data.ch >= printable_min)
4852 { 4852 {
4853 *prop = add_emchar_rune (&data); 4853 *prop = add_ichar_rune (&data);
4854 if (*prop) 4854 if (*prop)
4855 goto done; 4855 goto done;
4856 } 4856 }
4857 4857
4858 /* If the current character is a tab, determine the next tab 4858 /* If the current character is a tab, determine the next tab
4907 The is_*() routines have undefined results on 4907 The is_*() routines have undefined results on
4908 arguments outside of the range [-1, 255]. (This 4908 arguments outside of the range [-1, 255]. (This
4909 often bites people who carelessly use `char' instead 4909 often bites people who carelessly use `char' instead
4910 of `unsigned char'.) 4910 of `unsigned char'.)
4911 */ 4911 */
4912 else if (data.ch < 0x100 && iscntrl ((Intbyte) data.ch)) 4912 else if (data.ch < 0x100 && iscntrl ((Ibyte) data.ch))
4913 { 4913 {
4914 *prop = add_control_char_runes (&data, b); 4914 *prop = add_control_char_runes (&data, b);
4915 4915
4916 if (*prop) 4916 if (*prop)
4917 goto done; 4917 goto done;
4929 4929
4930 /* Assume the current character is considered to be printable, 4930 /* Assume the current character is considered to be printable,
4931 then just add it. */ 4931 then just add it. */
4932 else 4932 else
4933 { 4933 {
4934 *prop = add_emchar_rune (&data); 4934 *prop = add_ichar_rune (&data);
4935 if (*prop) 4935 if (*prop)
4936 goto done; 4936 goto done;
4937 } 4937 }
4938 4938
4939 INC_BYTECOUNT (XSTRING_DATA (disp_string), data.byte_charpos); 4939 INC_BYTECOUNT (XSTRING_DATA (disp_string), data.byte_charpos);
4980 if (truncate_win) 4980 if (truncate_win)
4981 { 4981 {
4982 Bytecount byte_pos; 4982 Bytecount byte_pos;
4983 4983
4984 /* Now find the start of the next line. */ 4984 /* Now find the start of the next line. */
4985 byte_pos = byte_find_next_emchar_in_string (disp_string, '\n', 4985 byte_pos = byte_find_next_ichar_in_string (disp_string, '\n',
4986 data.byte_charpos, 1); 4986 data.byte_charpos, 1);
4987 4987
4988 data.cursor_type = NO_CURSOR; 4988 data.cursor_type = NO_CURSOR;
4989 data.byte_charpos = byte_pos; 4989 data.byte_charpos = byte_pos;
4990 gb.glyph = Vtruncation_glyph; 4990 gb.glyph = Vtruncation_glyph;
5005 if (data.end_glyph_width) 5005 if (data.end_glyph_width)
5006 add_glyph_rune (&data, &gb, BEGIN_GLYPHS, 0, cachel); 5006 add_glyph_rune (&data, &gb, BEGIN_GLYPHS, 0, cachel);
5007 5007
5008 if (truncate_win && data.byte_charpos == byte_string_zv) 5008 if (truncate_win && data.byte_charpos == byte_string_zv)
5009 { 5009 {
5010 const Intbyte *endb = charptr_n_addr (XSTRING_DATA (disp_string), 5010 const Ibyte *endb = itext_n_addr (XSTRING_DATA (disp_string),
5011 byte_string_zv); 5011 byte_string_zv);
5012 DEC_CHARPTR (endb); 5012 DEC_IBYTEPTR (endb);
5013 if (charptr_emchar (endb) != '\n') 5013 if (itext_ichar (endb) != '\n')
5014 { 5014 {
5015 /* #### Damn this losing shit. */ 5015 /* #### Damn this losing shit. */
5016 data.byte_charpos++; 5016 data.byte_charpos++;
5017 } 5017 }
5018 } 5018 }
6932 } 6932 }
6933 6933
6934 6934
6935 /* Given a character representing an object in a modeline 6935 /* Given a character representing an object in a modeline
6936 specification, return a string (stored into the global array 6936 specification, return a string (stored into the global array
6937 `mode_spec_intbyte_string') with the information that object 6937 `mode_spec_ibyte_string') with the information that object
6938 represents. 6938 represents.
6939 6939
6940 This function is largely unchanged from previous versions of the 6940 This function is largely unchanged from previous versions of the
6941 redisplay engine. 6941 redisplay engine.
6942 6942
6943 Warning! This code is also used for frame titles and can be called 6943 Warning! This code is also used for frame titles and can be called
6944 very early in the device/frame update process! JV 6944 very early in the device/frame update process! JV
6945 */ 6945 */
6946 6946
6947 static void 6947 static void
6948 decode_mode_spec (struct window *w, Emchar spec, int type) 6948 decode_mode_spec (struct window *w, Ichar spec, int type)
6949 { 6949 {
6950 Lisp_Object obj = Qnil; 6950 Lisp_Object obj = Qnil;
6951 const char *str = NULL; 6951 const char *str = NULL;
6952 struct buffer *b = XBUFFER (w->buffer); 6952 struct buffer *b = XBUFFER (w->buffer);
6953 6953
6954 Dynarr_reset (mode_spec_intbyte_string); 6954 Dynarr_reset (mode_spec_ibyte_string);
6955 6955
6956 switch (spec) 6956 switch (spec)
6957 { 6957 {
6958 /* print buffer name */ 6958 /* print buffer name */
6959 case 'b': 6959 case 'b':
6974 int col = column_at_point (b, pt, 1) + !!column_number_start_at_one; 6974 int col = column_at_point (b, pt, 1) + !!column_number_start_at_one;
6975 char buf[DECIMAL_PRINT_SIZE (long)]; 6975 char buf[DECIMAL_PRINT_SIZE (long)];
6976 6976
6977 long_to_string (buf, col); 6977 long_to_string (buf, col);
6978 6978
6979 Dynarr_add_many (mode_spec_intbyte_string, 6979 Dynarr_add_many (mode_spec_ibyte_string,
6980 (const Intbyte *) buf, strlen (buf)); 6980 (const Ibyte *) buf, strlen (buf));
6981 6981
6982 goto decode_mode_spec_done; 6982 goto decode_mode_spec_done;
6983 } 6983 }
6984 /* print the file coding system */ 6984 /* print the file coding system */
6985 case 'C': 6985 case 'C':
7108 2-digit number that is close. */ 7108 2-digit number that is close. */
7109 if (percent == 100) 7109 if (percent == 100)
7110 percent = 99; 7110 percent = 99;
7111 7111
7112 sprintf (buf, "%d%%", percent); 7112 sprintf (buf, "%d%%", percent);
7113 Dynarr_add_many (mode_spec_intbyte_string, (Intbyte *) buf, 7113 Dynarr_add_many (mode_spec_ibyte_string, (Ibyte *) buf,
7114 strlen (buf)); 7114 strlen (buf));
7115 7115
7116 goto decode_mode_spec_done; 7116 goto decode_mode_spec_done;
7117 } 7117 }
7118 break; 7118 break;
7159 if (toppos <= BUF_BEGV (b)) 7159 if (toppos <= BUF_BEGV (b))
7160 sprintf (buf, "Top%d%%", percent); 7160 sprintf (buf, "Top%d%%", percent);
7161 else 7161 else
7162 sprintf (buf, "%d%%", percent); 7162 sprintf (buf, "%d%%", percent);
7163 7163
7164 Dynarr_add_many (mode_spec_intbyte_string, (Intbyte *) buf, 7164 Dynarr_add_many (mode_spec_ibyte_string, (Ibyte *) buf,
7165 strlen (buf)); 7165 strlen (buf));
7166 7166
7167 goto decode_mode_spec_done; 7167 goto decode_mode_spec_done;
7168 } 7168 }
7169 break; 7169 break;
7184 str = "[[[... "; 7184 str = "[[[... ";
7185 break; 7185 break;
7186 } 7186 }
7187 7187
7188 for (i = 0; i < command_loop_level; i++) 7188 for (i = 0; i < command_loop_level; i++)
7189 Dynarr_add (mode_spec_intbyte_string, '['); 7189 Dynarr_add (mode_spec_ibyte_string, '[');
7190 7190
7191 goto decode_mode_spec_done; 7191 goto decode_mode_spec_done;
7192 } 7192 }
7193 7193
7194 /* print one ] for each recursive editing level. */ 7194 /* print one ] for each recursive editing level. */
7201 str = "...]]]"; 7201 str = "...]]]";
7202 break; 7202 break;
7203 } 7203 }
7204 7204
7205 for (i = 0; i < command_loop_level; i++) 7205 for (i = 0; i < command_loop_level; i++)
7206 Dynarr_add (mode_spec_intbyte_string, ']'); 7206 Dynarr_add (mode_spec_ibyte_string, ']');
7207 7207
7208 goto decode_mode_spec_done; 7208 goto decode_mode_spec_done;
7209 } 7209 }
7210 7210
7211 /* print infinitely many dashes -- handle at top level now */ 7211 /* print infinitely many dashes -- handle at top level now */
7213 break; 7213 break;
7214 7214
7215 } 7215 }
7216 7216
7217 if (STRINGP (obj)) 7217 if (STRINGP (obj))
7218 Dynarr_add_many (mode_spec_intbyte_string, 7218 Dynarr_add_many (mode_spec_ibyte_string,
7219 XSTRING_DATA (obj), 7219 XSTRING_DATA (obj),
7220 XSTRING_LENGTH (obj)); 7220 XSTRING_LENGTH (obj));
7221 else if (str) 7221 else if (str)
7222 Dynarr_add_many (mode_spec_intbyte_string, (Intbyte *) str, strlen (str)); 7222 Dynarr_add_many (mode_spec_ibyte_string, (Ibyte *) str, strlen (str));
7223 7223
7224 decode_mode_spec_done: 7224 decode_mode_spec_done:
7225 Dynarr_add (mode_spec_intbyte_string, '\0'); 7225 Dynarr_add (mode_spec_ibyte_string, '\0');
7226 } 7226 }
7227 7227
7228 /* Given a display line, free all of its data structures. */ 7228 /* Given a display line, free all of its data structures. */
7229 7229
7230 static void 7230 static void
9404 if (!initialized) 9404 if (!initialized)
9405 #endif 9405 #endif
9406 { 9406 {
9407 if (!cmotion_display_lines) 9407 if (!cmotion_display_lines)
9408 cmotion_display_lines = Dynarr_new (display_line); 9408 cmotion_display_lines = Dynarr_new (display_line);
9409 if (!mode_spec_intbyte_string) 9409 if (!mode_spec_ibyte_string)
9410 mode_spec_intbyte_string = Dynarr_new (Intbyte); 9410 mode_spec_ibyte_string = Dynarr_new (Ibyte);
9411 if (!formatted_string_extent_dynarr) 9411 if (!formatted_string_extent_dynarr)
9412 formatted_string_extent_dynarr = Dynarr_new (EXTENT); 9412 formatted_string_extent_dynarr = Dynarr_new (EXTENT);
9413 if (!formatted_string_extent_start_dynarr) 9413 if (!formatted_string_extent_start_dynarr)
9414 formatted_string_extent_start_dynarr = Dynarr_new (Bytecount); 9414 formatted_string_extent_start_dynarr = Dynarr_new (Bytecount);
9415 if (!formatted_string_extent_end_dynarr) 9415 if (!formatted_string_extent_end_dynarr)