diff options
| author | Jason Rumney | 2003-10-11 22:24:47 +0000 |
|---|---|---|
| committer | Jason Rumney | 2003-10-11 22:24:47 +0000 |
| commit | fc0b0cffeb154aaa51cd3831dc6a6b050d0d3c1d (patch) | |
| tree | fcc4a7dd4ae93a74fa21e7268851bffd6fa62f14 /src | |
| parent | f78f8eccb6693ae22bb4066a3779f893ef722970 (diff) | |
| download | emacs-fc0b0cffeb154aaa51cd3831dc6a6b050d0d3c1d.tar.gz emacs-fc0b0cffeb154aaa51cd3831dc6a6b050d0d3c1d.zip | |
Include character.h. Use terminal_encode_buffer from term.c.
(write_glyphs): Use new version of encode_terminal_code. Use
encode_coding_object in place of encode_coding.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32console.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/w32console.c b/src/w32console.c index 91601eb148a..61b142db028 100644 --- a/src/w32console.c +++ b/src/w32console.c | |||
| @@ -294,6 +294,8 @@ insert_glyphs (register struct glyph *start, register int len) | |||
| 294 | } | 294 | } |
| 295 | } | 295 | } |
| 296 | 296 | ||
| 297 | extern unsigned char *terminal_encode_buffer; | ||
| 298 | |||
| 297 | void | 299 | void |
| 298 | write_glyphs (register struct glyph *string, register int len) | 300 | write_glyphs (register struct glyph *string, register int len) |
| 299 | { | 301 | { |
| @@ -301,8 +303,6 @@ write_glyphs (register struct glyph *string, register int len) | |||
| 301 | DWORD r; | 303 | DWORD r; |
| 302 | struct frame * f = PICK_FRAME (); | 304 | struct frame * f = PICK_FRAME (); |
| 303 | WORD char_attr; | 305 | WORD char_attr; |
| 304 | unsigned char conversion_buffer[1024]; | ||
| 305 | int conversion_buffer_size = sizeof conversion_buffer; | ||
| 306 | 306 | ||
| 307 | if (len <= 0) | 307 | if (len <= 0) |
| 308 | return; | 308 | return; |
| @@ -326,11 +326,8 @@ write_glyphs (register struct glyph *string, register int len) | |||
| 326 | 326 | ||
| 327 | while (n > 0) | 327 | while (n > 0) |
| 328 | { | 328 | { |
| 329 | /* We use a fixed size (1024 bytes) of conversion buffer. | 329 | produced = encode_terminal_code (string, |
| 330 | Usually it is sufficient, but if not, we just repeat the | 330 | n, |
| 331 | loop. */ | ||
| 332 | produced = encode_terminal_code (string, conversion_buffer, | ||
| 333 | n, conversion_buffer_size, | ||
| 334 | &consumed); | 331 | &consumed); |
| 335 | if (produced > 0) | 332 | if (produced > 0) |
| 336 | { | 333 | { |
| @@ -344,7 +341,7 @@ write_glyphs (register struct glyph *string, register int len) | |||
| 344 | } | 341 | } |
| 345 | 342 | ||
| 346 | /* Write the characters. */ | 343 | /* Write the characters. */ |
| 347 | if (!WriteConsoleOutputCharacter (cur_screen, conversion_buffer, | 344 | if (!WriteConsoleOutputCharacter (cur_screen, terminal_encode_buffer, |
| 348 | produced, cursor_coords, &r)) | 345 | produced, cursor_coords, &r)) |
| 349 | { | 346 | { |
| 350 | printf ("Failed writing console characters: %d\n", | 347 | printf ("Failed writing console characters: %d\n", |
| @@ -364,9 +361,13 @@ write_glyphs (register struct glyph *string, register int len) | |||
| 364 | /* We may have to output some codes to terminate the writing. */ | 361 | /* We may have to output some codes to terminate the writing. */ |
| 365 | if (CODING_REQUIRE_FLUSHING (&terminal_coding)) | 362 | if (CODING_REQUIRE_FLUSHING (&terminal_coding)) |
| 366 | { | 363 | { |
| 364 | Lisp_Object blank_string = build_string (""); | ||
| 365 | int conversion_buffer_size = 1024; | ||
| 366 | |||
| 367 | terminal_coding.mode |= CODING_MODE_LAST_BLOCK; | 367 | terminal_coding.mode |= CODING_MODE_LAST_BLOCK; |
| 368 | encode_coding (&terminal_coding, "", conversion_buffer, | 368 | terminal_coding.destination = (unsigned char *) xmalloc (conversion_buffer_size); |
| 369 | 0, conversion_buffer_size); | 369 | encode_coding_object (&terminal_coding, blank_string, 0, 0, |
| 370 | 0, conversion_buffer_size, Qnil); | ||
| 370 | if (terminal_coding.produced > 0) | 371 | if (terminal_coding.produced > 0) |
| 371 | { | 372 | { |
| 372 | if (!FillConsoleOutputAttribute (cur_screen, char_attr_normal, | 373 | if (!FillConsoleOutputAttribute (cur_screen, char_attr_normal, |
| @@ -379,7 +380,7 @@ write_glyphs (register struct glyph *string, register int len) | |||
| 379 | } | 380 | } |
| 380 | 381 | ||
| 381 | /* Write the characters. */ | 382 | /* Write the characters. */ |
| 382 | if (!WriteConsoleOutputCharacter (cur_screen, conversion_buffer, | 383 | if (!WriteConsoleOutputCharacter (cur_screen, terminal_coding.destination, |
| 383 | produced, cursor_coords, &r)) | 384 | produced, cursor_coords, &r)) |
| 384 | { | 385 | { |
| 385 | printf ("Failed writing console characters: %d\n", | 386 | printf ("Failed writing console characters: %d\n", |
| @@ -387,6 +388,7 @@ write_glyphs (register struct glyph *string, register int len) | |||
| 387 | fflush (stdout); | 388 | fflush (stdout); |
| 388 | } | 389 | } |
| 389 | } | 390 | } |
| 391 | xfree (terminal_coding.destination); | ||
| 390 | } | 392 | } |
| 391 | } | 393 | } |
| 392 | 394 | ||