diff options
| author | Gerd Moellmann | 1999-08-21 19:30:21 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 1999-08-21 19:30:21 +0000 |
| commit | 0788646cc2f1b65a6aabf8a2a9b0fa3488e0f560 (patch) | |
| tree | 773506345d0d6c30531219e12f628cee68ad2228 /src | |
| parent | 39e98b382bd74d9f4e7f915d73166777b1004be7 (diff) | |
| download | emacs-0788646cc2f1b65a6aabf8a2a9b0fa3488e0f560.tar.gz emacs-0788646cc2f1b65a6aabf8a2a9b0fa3488e0f560.zip | |
Remove conditional compilation on `standalone'.
(glyph_len, str_to_glyph_cpy, str_to_glyph_ncpy,
glyph_to_str_cpy): Remove that section because GLYPHs are no
longer used in that way.
(PRINTDECLARE): Add multibyte.
(PRINTPREPARE, PRINTFINISH): Handle printcharfun t differently.
(printbufidx): Removed.
(printchar, strout): Rewritten.
Diffstat (limited to 'src')
| -rw-r--r-- | src/print.c | 471 |
1 files changed, 152 insertions, 319 deletions
diff --git a/src/print.c b/src/print.c index d3a7efc12c9..ecd146808ed 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -23,8 +23,6 @@ Boston, MA 02111-1307, USA. */ | |||
| 23 | #include <config.h> | 23 | #include <config.h> |
| 24 | #include <stdio.h> | 24 | #include <stdio.h> |
| 25 | #include "lisp.h" | 25 | #include "lisp.h" |
| 26 | |||
| 27 | #ifndef standalone | ||
| 28 | #include "buffer.h" | 26 | #include "buffer.h" |
| 29 | #include "charset.h" | 27 | #include "charset.h" |
| 30 | #include "frame.h" | 28 | #include "frame.h" |
| @@ -33,7 +31,6 @@ Boston, MA 02111-1307, USA. */ | |||
| 33 | #include "dispextern.h" | 31 | #include "dispextern.h" |
| 34 | #include "termchar.h" | 32 | #include "termchar.h" |
| 35 | #include "keyboard.h" | 33 | #include "keyboard.h" |
| 36 | #endif /* not standalone */ | ||
| 37 | 34 | ||
| 38 | #ifdef USE_TEXT_PROPERTIES | 35 | #ifdef USE_TEXT_PROPERTIES |
| 39 | #include "intervals.h" | 36 | #include "intervals.h" |
| @@ -171,58 +168,7 @@ static int max_print; | |||
| 171 | #endif /* MAX_PRINT_CHARS */ | 168 | #endif /* MAX_PRINT_CHARS */ |
| 172 | 169 | ||
| 173 | void print_interval (); | 170 | void print_interval (); |
| 174 | |||
| 175 | #if 0 | ||
| 176 | /* Convert between chars and GLYPHs */ | ||
| 177 | |||
| 178 | int | ||
| 179 | glyphlen (glyphs) | ||
| 180 | register GLYPH *glyphs; | ||
| 181 | { | ||
| 182 | register int i = 0; | ||
| 183 | |||
| 184 | while (glyphs[i]) | ||
| 185 | i++; | ||
| 186 | return i; | ||
| 187 | } | ||
| 188 | |||
| 189 | void | ||
| 190 | str_to_glyph_cpy (str, glyphs) | ||
| 191 | char *str; | ||
| 192 | GLYPH *glyphs; | ||
| 193 | { | ||
| 194 | register GLYPH *gp = glyphs; | ||
| 195 | register char *cp = str; | ||
| 196 | |||
| 197 | while (*cp) | ||
| 198 | *gp++ = *cp++; | ||
| 199 | } | ||
| 200 | |||
| 201 | void | ||
| 202 | str_to_glyph_ncpy (str, glyphs, n) | ||
| 203 | char *str; | ||
| 204 | GLYPH *glyphs; | ||
| 205 | register int n; | ||
| 206 | { | ||
| 207 | register GLYPH *gp = glyphs; | ||
| 208 | register char *cp = str; | ||
| 209 | |||
| 210 | while (n-- > 0) | ||
| 211 | *gp++ = *cp++; | ||
| 212 | } | ||
| 213 | 171 | ||
| 214 | void | ||
| 215 | glyph_to_str_cpy (glyphs, str) | ||
| 216 | GLYPH *glyphs; | ||
| 217 | char *str; | ||
| 218 | { | ||
| 219 | register GLYPH *gp = glyphs; | ||
| 220 | register char *cp = str; | ||
| 221 | |||
| 222 | while (*gp) | ||
| 223 | *str++ = *gp++ & 0377; | ||
| 224 | } | ||
| 225 | #endif | ||
| 226 | 172 | ||
| 227 | /* Low level output routines for characters and strings */ | 173 | /* Low level output routines for characters and strings */ |
| 228 | 174 | ||
| @@ -231,66 +177,68 @@ glyph_to_str_cpy (glyphs, str) | |||
| 231 | and must start with PRINTPREPARE, end with PRINTFINISH, | 177 | and must start with PRINTPREPARE, end with PRINTFINISH, |
| 232 | and use PRINTDECLARE to declare common variables. | 178 | and use PRINTDECLARE to declare common variables. |
| 233 | Use PRINTCHAR to output one character, | 179 | Use PRINTCHAR to output one character, |
| 234 | or call strout to output a block of characters. | 180 | or call strout to output a block of characters. */ |
| 235 | */ | 181 | |
| 236 | 182 | #define PRINTDECLARE \ | |
| 237 | #define PRINTDECLARE \ | 183 | struct buffer *old = current_buffer; \ |
| 238 | struct buffer *old = current_buffer; \ | 184 | int old_point = -1, start_point; \ |
| 239 | int old_point = -1, start_point; \ | 185 | int old_point_byte, start_point_byte; \ |
| 240 | int old_point_byte, start_point_byte; \ | 186 | int specpdl_count = specpdl_ptr - specpdl; \ |
| 241 | int specpdl_count = specpdl_ptr - specpdl; \ | 187 | int free_print_buffer = 0; \ |
| 242 | int free_print_buffer = 0; \ | 188 | int multibyte = !NILP (current_buffer->enable_multibyte_characters); \ |
| 243 | Lisp_Object original | 189 | Lisp_Object original |
| 244 | 190 | ||
| 245 | #define PRINTPREPARE \ | 191 | #define PRINTPREPARE \ |
| 246 | original = printcharfun; \ | 192 | original = printcharfun; \ |
| 247 | if (NILP (printcharfun)) printcharfun = Qt; \ | 193 | if (NILP (printcharfun)) printcharfun = Qt; \ |
| 248 | if (BUFFERP (printcharfun)) \ | 194 | if (BUFFERP (printcharfun)) \ |
| 249 | { \ | 195 | { \ |
| 250 | if (XBUFFER (printcharfun) != current_buffer) \ | 196 | if (XBUFFER (printcharfun) != current_buffer) \ |
| 251 | Fset_buffer (printcharfun); \ | 197 | Fset_buffer (printcharfun); \ |
| 252 | printcharfun = Qnil; \ | 198 | printcharfun = Qnil; \ |
| 253 | } \ | 199 | } \ |
| 254 | if (MARKERP (printcharfun)) \ | 200 | if (MARKERP (printcharfun)) \ |
| 255 | { \ | 201 | { \ |
| 256 | if (!(XMARKER (original)->buffer)) \ | 202 | if (!(XMARKER (original)->buffer)) \ |
| 257 | error ("Marker does not point anywhere"); \ | 203 | error ("Marker does not point anywhere"); \ |
| 258 | if (XMARKER (original)->buffer != current_buffer) \ | 204 | if (XMARKER (original)->buffer != current_buffer) \ |
| 259 | set_buffer_internal (XMARKER (original)->buffer); \ | 205 | set_buffer_internal (XMARKER (original)->buffer); \ |
| 260 | old_point = PT; \ | 206 | old_point = PT; \ |
| 261 | old_point_byte = PT_BYTE; \ | 207 | old_point_byte = PT_BYTE; \ |
| 262 | SET_PT_BOTH (marker_position (printcharfun), \ | 208 | SET_PT_BOTH (marker_position (printcharfun), \ |
| 263 | marker_byte_position (printcharfun)); \ | 209 | marker_byte_position (printcharfun)); \ |
| 264 | start_point = PT; \ | 210 | start_point = PT; \ |
| 265 | start_point_byte = PT_BYTE; \ | 211 | start_point_byte = PT_BYTE; \ |
| 266 | printcharfun = Qnil; \ | 212 | printcharfun = Qnil; \ |
| 267 | } \ | 213 | } \ |
| 268 | if (NILP (printcharfun)) \ | 214 | if (NILP (printcharfun)) \ |
| 269 | { \ | 215 | { \ |
| 270 | Lisp_Object string; \ | 216 | Lisp_Object string; \ |
| 271 | if (NILP (current_buffer->enable_multibyte_characters) \ | 217 | if (NILP (current_buffer->enable_multibyte_characters) \ |
| 272 | && ! print_escape_multibyte) \ | 218 | && ! print_escape_multibyte) \ |
| 273 | specbind (Qprint_escape_multibyte, Qt); \ | 219 | specbind (Qprint_escape_multibyte, Qt); \ |
| 274 | if (! NILP (current_buffer->enable_multibyte_characters) \ | 220 | if (! NILP (current_buffer->enable_multibyte_characters) \ |
| 275 | && ! print_escape_nonascii) \ | 221 | && ! print_escape_nonascii) \ |
| 276 | specbind (Qprint_escape_nonascii, Qt); \ | 222 | specbind (Qprint_escape_nonascii, Qt); \ |
| 277 | if (print_buffer != 0) \ | 223 | if (print_buffer != 0) \ |
| 278 | { \ | 224 | { \ |
| 279 | string = make_string_from_bytes (print_buffer, \ | 225 | string = make_string_from_bytes (print_buffer, \ |
| 280 | print_buffer_pos, \ | 226 | print_buffer_pos, \ |
| 281 | print_buffer_pos_byte); \ | 227 | print_buffer_pos_byte); \ |
| 282 | record_unwind_protect (print_unwind, string); \ | 228 | record_unwind_protect (print_unwind, string); \ |
| 283 | } \ | 229 | } \ |
| 284 | else \ | 230 | else \ |
| 285 | { \ | 231 | { \ |
| 286 | print_buffer_size = 1000; \ | 232 | print_buffer_size = 1000; \ |
| 287 | print_buffer = (char *) xmalloc (print_buffer_size); \ | 233 | print_buffer = (char *) xmalloc (print_buffer_size); \ |
| 288 | free_print_buffer = 1; \ | 234 | free_print_buffer = 1; \ |
| 289 | } \ | 235 | } \ |
| 290 | print_buffer_pos = 0; \ | 236 | print_buffer_pos = 0; \ |
| 291 | print_buffer_pos_byte = 0; \ | 237 | print_buffer_pos_byte = 0; \ |
| 292 | } \ | 238 | } \ |
| 293 | if (!CONSP (Vprint_gensym)) \ | 239 | if (EQ (printcharfun, Qt)) \ |
| 240 | setup_echo_area_for_printing (multibyte); \ | ||
| 241 | if (!CONSP (Vprint_gensym)) \ | ||
| 294 | Vprint_gensym_alist = Qnil | 242 | Vprint_gensym_alist = Qnil |
| 295 | 243 | ||
| 296 | #define PRINTFINISH \ | 244 | #define PRINTFINISH \ |
| @@ -339,6 +287,7 @@ glyph_to_str_cpy (glyphs, str) | |||
| 339 | 287 | ||
| 340 | /* This is used to restore the saved contents of print_buffer | 288 | /* This is used to restore the saved contents of print_buffer |
| 341 | when there is a recursive call to print. */ | 289 | when there is a recursive call to print. */ |
| 290 | |||
| 342 | static Lisp_Object | 291 | static Lisp_Object |
| 343 | print_unwind (saved_text) | 292 | print_unwind (saved_text) |
| 344 | Lisp_Object saved_text; | 293 | Lisp_Object saved_text; |
| @@ -346,134 +295,68 @@ print_unwind (saved_text) | |||
| 346 | bcopy (XSTRING (saved_text)->data, print_buffer, XSTRING (saved_text)->size); | 295 | bcopy (XSTRING (saved_text)->data, print_buffer, XSTRING (saved_text)->size); |
| 347 | } | 296 | } |
| 348 | 297 | ||
| 349 | /* Index of first unused element of FRAME_MESSAGE_BUF (mini_frame). */ | 298 | |
| 350 | static int printbufidx; | 299 | /* Print character CH using method FUN. FUN nil means print to |
| 300 | print_buffer. FUN t means print to echo area or stdout if | ||
| 301 | non-interactive. If FUN is neither nil nor t, call FUN with CH as | ||
| 302 | argument. */ | ||
| 351 | 303 | ||
| 352 | static void | 304 | static void |
| 353 | printchar (ch, fun) | 305 | printchar (ch, fun) |
| 354 | unsigned int ch; | 306 | unsigned int ch; |
| 355 | Lisp_Object fun; | 307 | Lisp_Object fun; |
| 356 | { | 308 | { |
| 357 | Lisp_Object ch1; | ||
| 358 | |||
| 359 | #ifdef MAX_PRINT_CHARS | 309 | #ifdef MAX_PRINT_CHARS |
| 360 | if (max_print) | 310 | if (max_print) |
| 361 | print_chars++; | 311 | print_chars++; |
| 362 | #endif /* MAX_PRINT_CHARS */ | 312 | #endif /* MAX_PRINT_CHARS */ |
| 363 | #ifndef standalone | ||
| 364 | if (EQ (fun, Qnil)) | ||
| 365 | { | ||
| 366 | int len; | ||
| 367 | unsigned char work[4], *str; | ||
| 368 | |||
| 369 | QUIT; | ||
| 370 | len = CHAR_STRING (ch, work, str); | ||
| 371 | if (print_buffer_pos_byte + len >= print_buffer_size) | ||
| 372 | print_buffer = (char *) xrealloc (print_buffer, | ||
| 373 | print_buffer_size *= 2); | ||
| 374 | bcopy (str, print_buffer + print_buffer_pos_byte, len); | ||
| 375 | print_buffer_pos += 1; | ||
| 376 | print_buffer_pos_byte += len; | ||
| 377 | return; | ||
| 378 | } | ||
| 379 | 313 | ||
| 380 | if (EQ (fun, Qt)) | 314 | if (!NILP (fun) && !EQ (fun, Qt)) |
| 315 | call1 (fun, make_number (ch)); | ||
| 316 | else | ||
| 381 | { | 317 | { |
| 382 | FRAME_PTR mini_frame | ||
| 383 | = XFRAME (WINDOW_FRAME (XWINDOW (minibuf_window))); | ||
| 384 | unsigned char work[4], *str; | 318 | unsigned char work[4], *str; |
| 385 | int len = CHAR_STRING (ch, work, str); | 319 | int len = CHAR_STRING (ch, work, str); |
| 386 | 320 | ||
| 387 | QUIT; | 321 | QUIT; |
| 388 | 322 | ||
| 389 | if (noninteractive) | 323 | if (NILP (fun)) |
| 390 | { | ||
| 391 | while (len--) | ||
| 392 | putchar (*str), str++; | ||
| 393 | noninteractive_need_newline = 1; | ||
| 394 | return; | ||
| 395 | } | ||
| 396 | |||
| 397 | if (echo_area_glyphs != FRAME_MESSAGE_BUF (mini_frame) | ||
| 398 | || !message_buf_print) | ||
| 399 | { | ||
| 400 | message_log_maybe_newline (); | ||
| 401 | echo_area_glyphs = FRAME_MESSAGE_BUF (mini_frame); | ||
| 402 | echo_area_message = Qnil; | ||
| 403 | printbufidx = 0; | ||
| 404 | echo_area_glyphs_length = 0; | ||
| 405 | message_buf_print = 1; | ||
| 406 | |||
| 407 | if (minibuffer_auto_raise) | ||
| 408 | { | ||
| 409 | Lisp_Object mini_window; | ||
| 410 | |||
| 411 | /* Get the frame containing the minibuffer | ||
| 412 | that the selected frame is using. */ | ||
| 413 | mini_window = FRAME_MINIBUF_WINDOW (selected_frame); | ||
| 414 | |||
| 415 | Fraise_frame (WINDOW_FRAME (XWINDOW (mini_window))); | ||
| 416 | } | ||
| 417 | } | ||
| 418 | |||
| 419 | if (len == 1 | ||
| 420 | && ! NILP (current_buffer->enable_multibyte_characters) | ||
| 421 | && ! CHAR_HEAD_P (*str)) | ||
| 422 | { | 324 | { |
| 423 | /* Convert the unibyte character to multibyte. */ | 325 | if (print_buffer_pos_byte + len >= print_buffer_size) |
| 424 | unsigned char c = *str; | 326 | print_buffer = (char *) xrealloc (print_buffer, |
| 425 | 327 | print_buffer_size *= 2); | |
| 426 | len = count_size_as_multibyte (&c, 1); | 328 | bcopy (str, print_buffer + print_buffer_pos_byte, len); |
| 427 | copy_text (&c, work, 1, 0, 1); | 329 | print_buffer_pos += 1; |
| 428 | str = work; | 330 | print_buffer_pos_byte += len; |
| 429 | } | 331 | } |
| 430 | 332 | else if (noninteractive) | |
| 431 | message_dolog (str, len, 0, len > 1); | ||
| 432 | |||
| 433 | if (! NILP (current_buffer->enable_multibyte_characters) | ||
| 434 | && ! message_enable_multibyte) | ||
| 435 | { | 333 | { |
| 436 | /* Record that the message buffer is multibyte. */ | 334 | fwrite (str, 1, len, stdout); |
| 437 | message_enable_multibyte = 1; | 335 | noninteractive_need_newline = 1; |
| 438 | |||
| 439 | /* If we have already had some message text in the messsage | ||
| 440 | buffer, we convert it to multibyte. */ | ||
| 441 | if (printbufidx > 0) | ||
| 442 | { | ||
| 443 | int size | ||
| 444 | = count_size_as_multibyte (FRAME_MESSAGE_BUF (mini_frame), | ||
| 445 | printbufidx); | ||
| 446 | unsigned char *tembuf = (unsigned char *) alloca (size + 1); | ||
| 447 | copy_text (FRAME_MESSAGE_BUF (mini_frame), tembuf, printbufidx, | ||
| 448 | 0, 1); | ||
| 449 | printbufidx = size; | ||
| 450 | if (printbufidx > FRAME_MESSAGE_BUF_SIZE (mini_frame)) | ||
| 451 | { | ||
| 452 | printbufidx = FRAME_MESSAGE_BUF_SIZE (mini_frame); | ||
| 453 | /* Rewind incomplete multi-byte form. */ | ||
| 454 | while (printbufidx > 0 && tembuf[printbufidx] >= 0xA0) | ||
| 455 | printbufidx--; | ||
| 456 | } | ||
| 457 | bcopy (tembuf, FRAME_MESSAGE_BUF (mini_frame), printbufidx); | ||
| 458 | } | ||
| 459 | } | 336 | } |
| 460 | 337 | else | |
| 461 | if (printbufidx < FRAME_MESSAGE_BUF_SIZE (mini_frame) - len) | ||
| 462 | { | 338 | { |
| 463 | bcopy (str, &FRAME_MESSAGE_BUF (mini_frame)[printbufidx], len); | 339 | int multibyte_p |
| 464 | printbufidx += len; | 340 | = !NILP (current_buffer->enable_multibyte_characters); |
| 341 | |||
| 342 | if (!message_buf_print) | ||
| 343 | setup_echo_area_for_printing (multibyte_p); | ||
| 344 | |||
| 345 | insert_char (ch); | ||
| 346 | message_dolog (str, len, 0, multibyte_p); | ||
| 465 | } | 347 | } |
| 466 | FRAME_MESSAGE_BUF (mini_frame)[printbufidx] = 0; | ||
| 467 | echo_area_glyphs_length = printbufidx; | ||
| 468 | |||
| 469 | return; | ||
| 470 | } | 348 | } |
| 471 | #endif /* not standalone */ | ||
| 472 | |||
| 473 | XSETFASTINT (ch1, ch); | ||
| 474 | call1 (fun, ch1); | ||
| 475 | } | 349 | } |
| 476 | 350 | ||
| 351 | |||
| 352 | /* Output SIZE characters, SIZE_BYTE bytes from string PTR using | ||
| 353 | method PRINTCHARFUN. If SIZE < 0, use the string length of PTR for | ||
| 354 | both SIZE and SIZE_BYTE. PRINTCHARFUN nil means output to | ||
| 355 | print_buffer. PRINTCHARFUN t means output to the echo area or to | ||
| 356 | stdout if non-interactive. If neither nil nor t, call Lisp | ||
| 357 | function PRINTCHARFUN for each character printed. MULTIBYTE | ||
| 358 | non-zero means PTR contains multibyte characters. */ | ||
| 359 | |||
| 477 | static void | 360 | static void |
| 478 | strout (ptr, size, size_byte, printcharfun, multibyte) | 361 | strout (ptr, size, size_byte, printcharfun, multibyte) |
| 479 | char *ptr; | 362 | char *ptr; |
| @@ -481,12 +364,10 @@ strout (ptr, size, size_byte, printcharfun, multibyte) | |||
| 481 | Lisp_Object printcharfun; | 364 | Lisp_Object printcharfun; |
| 482 | int multibyte; | 365 | int multibyte; |
| 483 | { | 366 | { |
| 484 | int i = 0; | ||
| 485 | |||
| 486 | if (size < 0) | 367 | if (size < 0) |
| 487 | size_byte = size = strlen (ptr); | 368 | size_byte = size = strlen (ptr); |
| 488 | 369 | ||
| 489 | if (EQ (printcharfun, Qnil)) | 370 | if (NILP (printcharfun)) |
| 490 | { | 371 | { |
| 491 | if (print_buffer_pos_byte + size_byte > print_buffer_size) | 372 | if (print_buffer_pos_byte + size_byte > print_buffer_size) |
| 492 | { | 373 | { |
| @@ -502,113 +383,73 @@ strout (ptr, size, size_byte, printcharfun, multibyte) | |||
| 502 | if (max_print) | 383 | if (max_print) |
| 503 | print_chars += size; | 384 | print_chars += size; |
| 504 | #endif /* MAX_PRINT_CHARS */ | 385 | #endif /* MAX_PRINT_CHARS */ |
| 505 | return; | ||
| 506 | } | 386 | } |
| 507 | if (EQ (printcharfun, Qt)) | 387 | else if (noninteractive) |
| 508 | { | 388 | { |
| 509 | FRAME_PTR mini_frame | 389 | fwrite (ptr, 1, size_byte, stdout); |
| 510 | = XFRAME (WINDOW_FRAME (XWINDOW (minibuf_window))); | 390 | noninteractive_need_newline = 1; |
| 511 | 391 | } | |
| 512 | QUIT; | 392 | else if (EQ (printcharfun, Qt)) |
| 513 | 393 | { | |
| 514 | #ifdef MAX_PRINT_CHARS | 394 | /* Output to echo area. We're trying to avoid a little overhead |
| 515 | if (max_print) | 395 | here, that's the reason we don't call printchar to do the |
| 516 | print_chars += size; | 396 | job. */ |
| 517 | #endif /* MAX_PRINT_CHARS */ | 397 | int i; |
| 518 | 398 | int multibyte_p | |
| 519 | if (noninteractive) | 399 | = !NILP (current_buffer->enable_multibyte_characters); |
| 400 | |||
| 401 | if (!message_buf_print) | ||
| 402 | setup_echo_area_for_printing (multibyte_p); | ||
| 403 | |||
| 404 | message_dolog (ptr, size_byte, 0, multibyte_p); | ||
| 405 | |||
| 406 | if (size == size_byte) | ||
| 520 | { | 407 | { |
| 521 | fwrite (ptr, 1, size_byte, stdout); | 408 | for (i = 0; i < size; ++i) |
| 522 | noninteractive_need_newline = 1; | 409 | insert_char (*ptr++); |
| 523 | return; | ||
| 524 | } | 410 | } |
| 525 | 411 | else | |
| 526 | if (echo_area_glyphs != FRAME_MESSAGE_BUF (mini_frame) | ||
| 527 | || !message_buf_print) | ||
| 528 | { | 412 | { |
| 529 | message_log_maybe_newline (); | 413 | int len; |
| 530 | echo_area_glyphs = FRAME_MESSAGE_BUF (mini_frame); | 414 | for (i = 0; i < size_byte; i += len) |
| 531 | echo_area_message = Qnil; | ||
| 532 | printbufidx = 0; | ||
| 533 | echo_area_glyphs_length = 0; | ||
| 534 | message_buf_print = 1; | ||
| 535 | |||
| 536 | if (minibuffer_auto_raise) | ||
| 537 | { | 415 | { |
| 538 | Lisp_Object mini_window; | 416 | int ch = STRING_CHAR_AND_LENGTH (ptr + i, size_byte - i, len); |
| 539 | 417 | insert_char (ch); | |
| 540 | /* Get the frame containing the minibuffer | ||
| 541 | that the selected frame is using. */ | ||
| 542 | mini_window = FRAME_MINIBUF_WINDOW (selected_frame); | ||
| 543 | |||
| 544 | Fraise_frame (WINDOW_FRAME (XWINDOW (mini_window))); | ||
| 545 | } | 418 | } |
| 546 | } | 419 | } |
| 420 | |||
| 421 | #ifdef MAX_PRINT_CHARS | ||
| 422 | if (max_print) | ||
| 423 | print_chars += size; | ||
| 424 | #endif /* MAX_PRINT_CHARS */ | ||
| 425 | } | ||
| 426 | else | ||
| 427 | { | ||
| 428 | /* PRINTCHARFUN is a Lisp function. */ | ||
| 429 | int i = 0; | ||
| 547 | 430 | ||
| 548 | message_dolog (ptr, size_byte, 0, multibyte); | 431 | if (size == size_byte) |
| 549 | |||
| 550 | /* Convert message to multibyte if we are now adding multibyte text. */ | ||
| 551 | if (multibyte | ||
| 552 | && ! message_enable_multibyte | ||
| 553 | && printbufidx > 0) | ||
| 554 | { | 432 | { |
| 555 | int size = count_size_as_multibyte (FRAME_MESSAGE_BUF (mini_frame), | 433 | while (i < size_byte) |
| 556 | printbufidx); | ||
| 557 | unsigned char *tembuf = (unsigned char *) alloca (size + 1); | ||
| 558 | copy_text (FRAME_MESSAGE_BUF (mini_frame), tembuf, printbufidx, | ||
| 559 | 0, 1); | ||
| 560 | printbufidx = size; | ||
| 561 | if (printbufidx > FRAME_MESSAGE_BUF_SIZE (mini_frame)) | ||
| 562 | { | 434 | { |
| 563 | printbufidx = FRAME_MESSAGE_BUF_SIZE (mini_frame); | 435 | int ch = ptr[i++]; |
| 564 | /* Rewind incomplete multi-byte form. */ | 436 | PRINTCHAR (ch); |
| 565 | while (printbufidx > 0 && tembuf[printbufidx] >= 0xA0) | ||
| 566 | printbufidx--; | ||
| 567 | } | 437 | } |
| 568 | |||
| 569 | bcopy (tembuf, FRAME_MESSAGE_BUF (mini_frame), printbufidx); | ||
| 570 | } | 438 | } |
| 571 | 439 | else | |
| 572 | if (multibyte) | ||
| 573 | message_enable_multibyte = 1; | ||
| 574 | |||
| 575 | /* Compute how much of the new text will fit there. */ | ||
| 576 | if (size_byte > FRAME_MESSAGE_BUF_SIZE (mini_frame) - printbufidx - 1) | ||
| 577 | { | 440 | { |
| 578 | size_byte = FRAME_MESSAGE_BUF_SIZE (mini_frame) - printbufidx - 1; | 441 | while (i < size_byte) |
| 579 | /* Rewind incomplete multi-byte form. */ | 442 | { |
| 580 | while (size_byte && (unsigned char) ptr[size_byte] >= 0xA0) | 443 | /* Here, we must convert each multi-byte form to the |
| 581 | size_byte--; | 444 | corresponding character code before handing it to |
| 445 | PRINTCHAR. */ | ||
| 446 | int len; | ||
| 447 | int ch = STRING_CHAR_AND_LENGTH (ptr + i, size_byte - i, len); | ||
| 448 | PRINTCHAR (ch); | ||
| 449 | i += len; | ||
| 450 | } | ||
| 582 | } | 451 | } |
| 583 | |||
| 584 | /* Put that part of the new text in. */ | ||
| 585 | bcopy (ptr, &FRAME_MESSAGE_BUF (mini_frame) [printbufidx], size_byte); | ||
| 586 | printbufidx += size_byte; | ||
| 587 | FRAME_MESSAGE_BUF (mini_frame) [printbufidx] = 0; | ||
| 588 | echo_area_glyphs_length = printbufidx; | ||
| 589 | |||
| 590 | return; | ||
| 591 | } | 452 | } |
| 592 | |||
| 593 | i = 0; | ||
| 594 | if (size == size_byte) | ||
| 595 | while (i < size_byte) | ||
| 596 | { | ||
| 597 | int ch = ptr[i++]; | ||
| 598 | |||
| 599 | PRINTCHAR (ch); | ||
| 600 | } | ||
| 601 | else | ||
| 602 | while (i < size_byte) | ||
| 603 | { | ||
| 604 | /* Here, we must convert each multi-byte form to the | ||
| 605 | corresponding character code before handing it to PRINTCHAR. */ | ||
| 606 | int len; | ||
| 607 | int ch = STRING_CHAR_AND_LENGTH (ptr + i, size_byte - i, len); | ||
| 608 | |||
| 609 | PRINTCHAR (ch); | ||
| 610 | i += len; | ||
| 611 | } | ||
| 612 | } | 453 | } |
| 613 | 454 | ||
| 614 | /* Print the contents of a string STRING using PRINTCHARFUN. | 455 | /* Print the contents of a string STRING using PRINTCHARFUN. |
| @@ -725,8 +566,6 @@ write_string_1 (data, size, printcharfun) | |||
| 725 | } | 566 | } |
| 726 | 567 | ||
| 727 | 568 | ||
| 728 | #ifndef standalone | ||
| 729 | |||
| 730 | void | 569 | void |
| 731 | temp_output_buffer_setup (bufname) | 570 | temp_output_buffer_setup (bufname) |
| 732 | char *bufname; | 571 | char *bufname; |
| @@ -822,7 +661,7 @@ buffer and calling the hook. It gets one argument, the buffer to display.") | |||
| 822 | 661 | ||
| 823 | return unbind_to (count, val); | 662 | return unbind_to (count, val); |
| 824 | } | 663 | } |
| 825 | #endif /* not standalone */ | 664 | |
| 826 | 665 | ||
| 827 | static void print (); | 666 | static void print (); |
| 828 | 667 | ||
| @@ -1605,7 +1444,6 @@ print (obj, printcharfun, escapeflag) | |||
| 1605 | strout (XSUBR (obj)->symbol_name, -1, -1, printcharfun, 0); | 1444 | strout (XSUBR (obj)->symbol_name, -1, -1, printcharfun, 0); |
| 1606 | PRINTCHAR ('>'); | 1445 | PRINTCHAR ('>'); |
| 1607 | } | 1446 | } |
| 1608 | #ifndef standalone | ||
| 1609 | else if (WINDOWP (obj)) | 1447 | else if (WINDOWP (obj)) |
| 1610 | { | 1448 | { |
| 1611 | strout ("#<window ", -1, -1, printcharfun, 0); | 1449 | strout ("#<window ", -1, -1, printcharfun, 0); |
| @@ -1665,7 +1503,6 @@ print (obj, printcharfun, escapeflag) | |||
| 1665 | strout (buf, -1, -1, printcharfun, 0); | 1503 | strout (buf, -1, -1, printcharfun, 0); |
| 1666 | PRINTCHAR ('>'); | 1504 | PRINTCHAR ('>'); |
| 1667 | } | 1505 | } |
| 1668 | #endif /* not standalone */ | ||
| 1669 | else | 1506 | else |
| 1670 | { | 1507 | { |
| 1671 | int size = XVECTOR (obj)->size; | 1508 | int size = XVECTOR (obj)->size; |
| @@ -1709,7 +1546,6 @@ print (obj, printcharfun, escapeflag) | |||
| 1709 | } | 1546 | } |
| 1710 | break; | 1547 | break; |
| 1711 | 1548 | ||
| 1712 | #ifndef standalone | ||
| 1713 | case Lisp_Misc: | 1549 | case Lisp_Misc: |
| 1714 | switch (XMISCTYPE (obj)) | 1550 | switch (XMISCTYPE (obj)) |
| 1715 | { | 1551 | { |
| @@ -1821,7 +1657,6 @@ print (obj, printcharfun, escapeflag) | |||
| 1821 | goto badtype; | 1657 | goto badtype; |
| 1822 | } | 1658 | } |
| 1823 | break; | 1659 | break; |
| 1824 | #endif /* standalone */ | ||
| 1825 | 1660 | ||
| 1826 | default: | 1661 | default: |
| 1827 | badtype: | 1662 | badtype: |
| @@ -1979,7 +1814,5 @@ with #N= for the specified value of N."); | |||
| 1979 | Qprint_escape_nonascii = intern ("print-escape-nonascii"); | 1814 | Qprint_escape_nonascii = intern ("print-escape-nonascii"); |
| 1980 | staticpro (&Qprint_escape_nonascii); | 1815 | staticpro (&Qprint_escape_nonascii); |
| 1981 | 1816 | ||
| 1982 | #ifndef standalone | ||
| 1983 | defsubr (&Swith_output_to_temp_buffer); | 1817 | defsubr (&Swith_output_to_temp_buffer); |
| 1984 | #endif /* not standalone */ | ||
| 1985 | } | 1818 | } |