comparison src/redisplay-tty.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 84762348c6f9
children 79c6ff3eef26
comparison
equal deleted inserted replaced
866:613552a02607 867:804517e16990
78 if (a) \ 78 if (a) \
79 tputs (a, n, cmputc); \ 79 tputs (a, n, cmputc); \
80 } while (0) 80 } while (0)
81 #define OUTPUT1_IF(c, a) OUTPUTN_IF (c, a, 1) 81 #define OUTPUT1_IF(c, a) OUTPUTN_IF (c, a, 1)
82 82
83 static void tty_output_emchar_dynarr (struct window *w, 83 static void tty_output_ichar_dynarr (struct window *w,
84 struct display_line *dl, 84 struct display_line *dl,
85 Emchar_dynarr *buf, int xpos, 85 Ichar_dynarr *buf, int xpos,
86 face_index findex, 86 face_index findex,
87 int cursor); 87 int cursor);
88 static void tty_output_intbyte_string (struct window *w, 88 static void tty_output_ibyte_string (struct window *w,
89 struct display_line *dl, 89 struct display_line *dl,
90 Intbyte *str, Bytecount len, 90 Ibyte *str, Bytecount len,
91 int xpos, face_index findex, 91 int xpos, face_index findex,
92 int cursor); 92 int cursor);
93 static void tty_turn_on_face (struct window *w, face_index findex); 93 static void tty_turn_on_face (struct window *w, face_index findex);
94 static void tty_turn_off_face (struct window *w, face_index findex); 94 static void tty_turn_off_face (struct window *w, face_index findex);
95 static void tty_turn_on_frame_face (struct frame *f, Lisp_Object face); 95 static void tty_turn_on_frame_face (struct frame *f, Lisp_Object face);
101 tty_text_width 101 tty_text_width
102 102
103 Non-Mule tty's don't have fonts (that we use at least), so everything 103 Non-Mule tty's don't have fonts (that we use at least), so everything
104 is considered to be fixed width -- in other words, we return LEN. 104 is considered to be fixed width -- in other words, we return LEN.
105 Under Mule, however, a character can still cover more than one 105 Under Mule, however, a character can still cover more than one
106 column, so we use emchar_string_displayed_columns(). 106 column, so we use ichar_string_displayed_columns().
107 ****************************************************************************/ 107 ****************************************************************************/
108 static int 108 static int
109 tty_text_width (struct frame *f, struct face_cachel *cachel, const Emchar *str, 109 tty_text_width (struct frame *f, struct face_cachel *cachel, const Ichar *str,
110 Charcount len) 110 Charcount len)
111 { 111 {
112 return emchar_string_displayed_columns (str, len); 112 return ichar_string_displayed_columns (str, len);
113 } 113 }
114 114
115 /***************************************************************************** 115 /*****************************************************************************
116 tty_divider_height 116 tty_divider_height
117 117
198 int start, int end, int start_pixpos, 198 int start, int end, int start_pixpos,
199 int cursor_start, int cursor_width, 199 int cursor_start, int cursor_width,
200 int cursor_height) 200 int cursor_height)
201 { 201 {
202 struct frame *f = XFRAME (w->frame); 202 struct frame *f = XFRAME (w->frame);
203 Emchar_dynarr *buf = Dynarr_new (Emchar); 203 Ichar_dynarr *buf = Dynarr_new (Ichar);
204 204
205 struct display_block *db = Dynarr_atp (dl->display_blocks, block); 205 struct display_block *db = Dynarr_atp (dl->display_blocks, block);
206 rune_dynarr *rba = db->runes; 206 rune_dynarr *rba = db->runes;
207 struct rune *rb; 207 struct rune *rb;
208 208
249 } 249 }
250 else 250 else
251 { 251 {
252 if (Dynarr_length (buf)) 252 if (Dynarr_length (buf))
253 { 253 {
254 tty_output_emchar_dynarr (w, dl, buf, xpos, findex, 0); 254 tty_output_ichar_dynarr (w, dl, buf, xpos, findex, 0);
255 xpos = rb->xpos; 255 xpos = rb->xpos;
256 } 256 }
257 Dynarr_reset (buf); 257 Dynarr_reset (buf);
258 258
259 if (rb->type == RUNE_CHAR) 259 if (rb->type == RUNE_CHAR)
264 if (rb->object.chr.ch == '\n') 264 if (rb->object.chr.ch == '\n')
265 { 265 {
266 /* Clear in case a cursor was formerly here. */ 266 /* Clear in case a cursor was formerly here. */
267 267
268 Dynarr_add (buf, ' '); 268 Dynarr_add (buf, ' ');
269 tty_output_emchar_dynarr (w, dl, buf, rb->xpos, 269 tty_output_ichar_dynarr (w, dl, buf, rb->xpos,
270 DEFAULT_INDEX, 0); 270 DEFAULT_INDEX, 0);
271 Dynarr_reset (buf); 271 Dynarr_reset (buf);
272 272
273 cmgoto (f, dl->ypos - 1, rb->xpos); 273 cmgoto (f, dl->ypos - 1, rb->xpos);
274 274
277 else if (rb->cursor_type == CURSOR_ON) 277 else if (rb->cursor_type == CURSOR_ON)
278 { 278 {
279 /* There is not a distinct eol cursor on tty's. */ 279 /* There is not a distinct eol cursor on tty's. */
280 280
281 Dynarr_add (buf, rb->object.chr.ch); 281 Dynarr_add (buf, rb->object.chr.ch);
282 tty_output_emchar_dynarr (w, dl, buf, xpos, findex, 0); 282 tty_output_ichar_dynarr (w, dl, buf, xpos, findex, 0);
283 Dynarr_reset (buf); 283 Dynarr_reset (buf);
284 284
285 cmgoto (f, dl->ypos - 1, xpos); 285 cmgoto (f, dl->ypos - 1, xpos);
286 286
287 xpos += rb->width; 287 xpos += rb->width;
291 /* #### RUNE_HLINE is actually a little more complicated than this 291 /* #### RUNE_HLINE is actually a little more complicated than this
292 but at the moment it is only used to draw a turned off 292 but at the moment it is only used to draw a turned off
293 modeline and this will suffice for that. */ 293 modeline and this will suffice for that. */
294 else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE) 294 else if (rb->type == RUNE_BLANK || rb->type == RUNE_HLINE)
295 { 295 {
296 Emchar ch_to_add; 296 Ichar ch_to_add;
297 int size = rb->width; 297 int size = rb->width;
298 298
299 if (rb->type == RUNE_BLANK) 299 if (rb->type == RUNE_BLANK)
300 ch_to_add = ' '; 300 ch_to_add = ' ';
301 else 301 else
302 ch_to_add = '-'; 302 ch_to_add = '-';
303 303
304 while (size--) 304 while (size--)
305 Dynarr_add (buf, ch_to_add); 305 Dynarr_add (buf, ch_to_add);
306 tty_output_emchar_dynarr (w, dl, buf, rb->xpos, findex, 0); 306 tty_output_ichar_dynarr (w, dl, buf, rb->xpos, findex, 0);
307 307
308 if (xpos >= cursor_start 308 if (xpos >= cursor_start
309 && cursor_start < xpos + Dynarr_length (buf)) 309 && cursor_start < xpos + Dynarr_length (buf))
310 { 310 {
311 cmgoto (f, dl->ypos - 1, cursor_start); 311 cmgoto (f, dl->ypos - 1, cursor_start);
362 abort (); 362 abort ();
363 } 363 }
364 } 364 }
365 365
366 if (Dynarr_length (buf)) 366 if (Dynarr_length (buf))
367 tty_output_emchar_dynarr (w, dl, buf, xpos, findex, 0); 367 tty_output_ichar_dynarr (w, dl, buf, xpos, findex, 0);
368 Dynarr_free (buf); 368 Dynarr_free (buf);
369 369
370 } 370 }
371 371
372 372
518 } 518 }
519 tty_turn_off_frame_face (f, Vdefault_face); 519 tty_turn_off_frame_face (f, Vdefault_face);
520 } 520 }
521 521
522 static void 522 static void
523 tty_output_intbyte_string (struct window *w, struct display_line *dl, 523 tty_output_ibyte_string (struct window *w, struct display_line *dl,
524 Intbyte *str, Bytecount len, int xpos, 524 Ibyte *str, Bytecount len, int xpos,
525 face_index findex, int cursor) 525 face_index findex, int cursor)
526 { 526 {
527 struct frame *f = XFRAME (w->frame); 527 struct frame *f = XFRAME (w->frame);
528 struct console *c = XCONSOLE (FRAME_CONSOLE (f)); 528 struct console *c = XCONSOLE (FRAME_CONSOLE (f));
529 529
532 532
533 /* Enable any face properties. */ 533 /* Enable any face properties. */
534 tty_turn_on_face (w, findex); 534 tty_turn_on_face (w, findex);
535 535
536 send_string_to_tty_console (c, str, len); 536 send_string_to_tty_console (c, str, len);
537 TTY_INC_CURSOR_X (c, intbyte_string_displayed_columns (str, len)); 537 TTY_INC_CURSOR_X (c, ibyte_string_displayed_columns (str, len));
538 538
539 /* Turn the face properties back off. */ 539 /* Turn the face properties back off. */
540 tty_turn_off_face (w, findex); 540 tty_turn_off_face (w, findex);
541 } 541 }
542 542
543 static Intbyte_dynarr *tty_output_emchar_dynarr_dynarr; 543 static Ibyte_dynarr *tty_output_ichar_dynarr_dynarr;
544 544
545 /***************************************************************************** 545 /*****************************************************************************
546 tty_output_emchar_dynarr 546 tty_output_ichar_dynarr
547 547
548 Given a string and a starting position, output that string in the 548 Given a string and a starting position, output that string in the
549 given face. If cursor is true, draw a cursor around the string. 549 given face. If cursor is true, draw a cursor around the string.
550 ****************************************************************************/ 550 ****************************************************************************/
551 static void 551 static void
552 tty_output_emchar_dynarr (struct window *w, struct display_line *dl, 552 tty_output_ichar_dynarr (struct window *w, struct display_line *dl,
553 Emchar_dynarr *buf, int xpos, face_index findex, 553 Ichar_dynarr *buf, int xpos, face_index findex,
554 int cursor) 554 int cursor)
555 { 555 {
556 if (!tty_output_emchar_dynarr_dynarr) 556 if (!tty_output_ichar_dynarr_dynarr)
557 tty_output_emchar_dynarr_dynarr = Dynarr_new (Intbyte); 557 tty_output_ichar_dynarr_dynarr = Dynarr_new (Ibyte);
558 else 558 else
559 Dynarr_reset (tty_output_emchar_dynarr_dynarr); 559 Dynarr_reset (tty_output_ichar_dynarr_dynarr);
560 560
561 convert_emchar_string_into_intbyte_dynarr (Dynarr_atp (buf, 0), 561 convert_ichar_string_into_ibyte_dynarr (Dynarr_atp (buf, 0),
562 Dynarr_length (buf), 562 Dynarr_length (buf),
563 tty_output_emchar_dynarr_dynarr); 563 tty_output_ichar_dynarr_dynarr);
564 564
565 tty_output_intbyte_string (w, dl, 565 tty_output_ibyte_string (w, dl,
566 Dynarr_atp (tty_output_emchar_dynarr_dynarr, 0), 566 Dynarr_atp (tty_output_ichar_dynarr_dynarr, 0),
567 Dynarr_length (tty_output_emchar_dynarr_dynarr), 567 Dynarr_length (tty_output_ichar_dynarr_dynarr),
568 xpos, findex, cursor); 568 xpos, findex, cursor);
569 } 569 }
570 570
571 #if 0 571 #if 0
572 572
573 static Intbyte_dynarr *sidcs_dynarr; 573 static Ibyte_dynarr *sidcs_dynarr;
574 574
575 static void 575 static void
576 substitute_in_dynamic_color_string (Lisp_Object spec, Lisp_Object string) 576 substitute_in_dynamic_color_string (Lisp_Object spec, Lisp_Object string)
577 { 577 {
578 int i; 578 int i;
579 Intbyte *specdata = XSTRING_DATA (spec); 579 Ibyte *specdata = XSTRING_DATA (spec);
580 Bytecount speclen = XSTRING_LENGTH (spec); 580 Bytecount speclen = XSTRING_LENGTH (spec);
581 581
582 if (!sidcs_dynarr) 582 if (!sidcs_dynarr)
583 sidcs_dynarr = Dynarr_new (Intbyte); 583 sidcs_dynarr = Dynarr_new (Ibyte);
584 else 584 else
585 Dynarr_reset (sidcs_dynarr); 585 Dynarr_reset (sidcs_dynarr);
586 586
587 for (i = 0; i < speclen; i++) 587 for (i = 0; i < speclen; i++)
588 { 588 {
607 607
608 static void 608 static void
609 set_foreground_to (struct console *c, Lisp_Object sym) 609 set_foreground_to (struct console *c, Lisp_Object sym)
610 { 610 {
611 Lisp_Object result; 611 Lisp_Object result;
612 Intbyte *escseq = 0; 612 Ibyte *escseq = 0;
613 Bytecount escseqlen = 0; 613 Bytecount escseqlen = 0;
614 614
615 result = assq_no_quit (sym, Vtty_color_alist); 615 result = assq_no_quit (sym, Vtty_color_alist);
616 if (!NILP (result)) 616 if (!NILP (result))
617 { 617 {
637 637
638 static void 638 static void
639 set_background_to (struct console *c, Lisp_Object sym) 639 set_background_to (struct console *c, Lisp_Object sym)
640 { 640 {
641 Lisp_Object result; 641 Lisp_Object result;
642 Intbyte *escseq = 0; 642 Ibyte *escseq = 0;
643 Bytecount escseqlen = 0; 643 Bytecount escseqlen = 0;
644 644
645 result = assq_no_quit (sym, Vtty_color_alist); 645 result = assq_no_quit (sym, Vtty_color_alist);
646 if (!NILP (result)) 646 if (!NILP (result))
647 { 647 {