diff options
| author | Kenichi Handa | 1998-01-22 01:26:45 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1998-01-22 01:26:45 +0000 |
| commit | 321fecde5bcc50f5591618d3b4ec6bd7fe1dfdff (patch) | |
| tree | c6e843d7af4e7b697351796c3f7a90b5bc9637a6 /src/callproc.c | |
| parent | 080cb8cd45fba24c4d9dcc63387cacd63826a977 (diff) | |
| download | emacs-321fecde5bcc50f5591618d3b4ec6bd7fe1dfdff.tar.gz emacs-321fecde5bcc50f5591618d3b4ec6bd7fe1dfdff.zip | |
(Fcall_process): Use raw-text instead of emacs-mule
when enable-multibyte-characters is nil. Adjusted for the change
of encode_coding and decode_coding.
Diffstat (limited to 'src/callproc.c')
| -rw-r--r-- | src/callproc.c | 65 |
1 files changed, 36 insertions, 29 deletions
diff --git a/src/callproc.c b/src/callproc.c index e1eff4f549d..ca593db58b4 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -285,7 +285,7 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") | |||
| 285 | if (!NILP (Vcoding_system_for_read)) | 285 | if (!NILP (Vcoding_system_for_read)) |
| 286 | val = Vcoding_system_for_read; | 286 | val = Vcoding_system_for_read; |
| 287 | else if (NILP (current_buffer->enable_multibyte_characters)) | 287 | else if (NILP (current_buffer->enable_multibyte_characters)) |
| 288 | val = Qemacs_mule; | 288 | val = Qraw_text; |
| 289 | else | 289 | else |
| 290 | { | 290 | { |
| 291 | if (!EQ (coding_systems, Qt)) | 291 | if (!EQ (coding_systems, Qt)) |
| @@ -447,16 +447,16 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") | |||
| 447 | int size = encoding_buffer_size (&argument_coding, | 447 | int size = encoding_buffer_size (&argument_coding, |
| 448 | XSTRING (args[i])->size_byte); | 448 | XSTRING (args[i])->size_byte); |
| 449 | unsigned char *dummy1 = (unsigned char *) alloca (size); | 449 | unsigned char *dummy1 = (unsigned char *) alloca (size); |
| 450 | int produced, dummy; | 450 | int dummy; |
| 451 | 451 | ||
| 452 | /* The Irix 4.0 compiler barfs if we eliminate dummy. */ | 452 | /* The Irix 4.0 compiler barfs if we eliminate dummy. */ |
| 453 | new_argv[i - 3] = dummy1; | 453 | new_argv[i - 3] = dummy1; |
| 454 | produced = encode_coding (&argument_coding, | 454 | encode_coding (&argument_coding, |
| 455 | XSTRING (args[i])->data, | 455 | XSTRING (args[i])->data, |
| 456 | new_argv[i - 3], | 456 | new_argv[i - 3], |
| 457 | XSTRING (args[i])->size_byte, | 457 | XSTRING (args[i])->size_byte, |
| 458 | size, &dummy); | 458 | size); |
| 459 | new_argv[i - 3][produced] = 0; | 459 | new_argv[i - 3][argument_coding.produced] = 0; |
| 460 | } | 460 | } |
| 461 | UNGCPRO; | 461 | UNGCPRO; |
| 462 | } | 462 | } |
| @@ -666,6 +666,7 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") | |||
| 666 | register int nread; | 666 | register int nread; |
| 667 | int first = 1; | 667 | int first = 1; |
| 668 | int total_read = 0; | 668 | int total_read = 0; |
| 669 | int carryover = 0; | ||
| 669 | 670 | ||
| 670 | while (1) | 671 | while (1) |
| 671 | { | 672 | { |
| @@ -673,11 +674,10 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") | |||
| 673 | of the buffer size we have. But don't read | 674 | of the buffer size we have. But don't read |
| 674 | less than 1024--save that for the next bufferful. */ | 675 | less than 1024--save that for the next bufferful. */ |
| 675 | 676 | ||
| 676 | nread = process_coding.carryover_size; /* This value is initially 0. */ | 677 | nread = carryover; |
| 677 | while (nread < bufsize - 1024) | 678 | while (nread < bufsize - 1024) |
| 678 | { | 679 | { |
| 679 | int this_read | 680 | int this_read = read (fd[0], bufptr + nread, bufsize - nread); |
| 680 | = read (fd[0], bufptr + nread, bufsize - nread); | ||
| 681 | 681 | ||
| 682 | if (this_read < 0) | 682 | if (this_read < 0) |
| 683 | goto give_up; | 683 | goto give_up; |
| @@ -691,13 +691,13 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") | |||
| 691 | give_up_1: | 691 | give_up_1: |
| 692 | 692 | ||
| 693 | /* Now NREAD is the total amount of data in the buffer. */ | 693 | /* Now NREAD is the total amount of data in the buffer. */ |
| 694 | if (nread == 0) | 694 | if (nread == carryover) |
| 695 | /* Here, just tell decode_coding that we are processing the | 695 | /* Here, just tell decode_coding that we are processing the |
| 696 | last block. We break the loop after decoding. */ | 696 | last block. We break the loop after decoding. */ |
| 697 | process_coding.last_block = 1; | 697 | process_coding.mode |= CODING_MODE_LAST_BLOCK; |
| 698 | 698 | ||
| 699 | immediate_quit = 0; | 699 | immediate_quit = 0; |
| 700 | total_read += nread; | 700 | total_read += nread - carryover; |
| 701 | 701 | ||
| 702 | if (!NILP (buffer)) | 702 | if (!NILP (buffer)) |
| 703 | { | 703 | { |
| @@ -705,19 +705,32 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") | |||
| 705 | insert (bufptr, nread); | 705 | insert (bufptr, nread); |
| 706 | else | 706 | else |
| 707 | { /* We have to decode the input. */ | 707 | { /* We have to decode the input. */ |
| 708 | int size = decoding_buffer_size (&process_coding, bufsize); | 708 | int size = decoding_buffer_size (&process_coding, nread); |
| 709 | char *decoding_buf = get_conversion_buffer (size); | 709 | char *decoding_buf = get_conversion_buffer (size); |
| 710 | int dummy; | ||
| 711 | 710 | ||
| 712 | nread = decode_coding (&process_coding, bufptr, decoding_buf, | 711 | decode_coding (&process_coding, bufptr, decoding_buf, |
| 713 | nread, size, &dummy); | 712 | nread, size); |
| 714 | if (nread > 0) | 713 | if (process_coding.produced > 0) |
| 715 | insert (decoding_buf, nread); | 714 | insert (decoding_buf, process_coding.produced); |
| 715 | carryover = process_coding.produced - process_coding.consumed; | ||
| 716 | if (carryover > 0) | ||
| 717 | { | ||
| 718 | /* As CARRYOVER should not be that large, we had | ||
| 719 | better avoid overhead of bcopy. */ | ||
| 720 | char *p = bufptr + process_coding.consumed; | ||
| 721 | char *pend = p + carryover; | ||
| 722 | char *dst = bufptr; | ||
| 723 | |||
| 724 | while (p < pend) *dst++ = *p++; | ||
| 725 | } | ||
| 716 | } | 726 | } |
| 717 | } | 727 | } |
| 718 | 728 | if (process_coding.mode & CODING_MODE_LAST_BLOCK) | |
| 719 | if (process_coding.last_block) | 729 | { |
| 720 | break; | 730 | if (carryover > 0) |
| 731 | insert (bufptr, carryover); | ||
| 732 | break; | ||
| 733 | } | ||
| 721 | 734 | ||
| 722 | /* Make the buffer bigger as we continue to read more data, | 735 | /* Make the buffer bigger as we continue to read more data, |
| 723 | but not past 64k. */ | 736 | but not past 64k. */ |
| @@ -727,12 +740,6 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") | |||
| 727 | bufptr = (char *) alloca (bufsize); | 740 | bufptr = (char *) alloca (bufsize); |
| 728 | } | 741 | } |
| 729 | 742 | ||
| 730 | if (!NILP (buffer) && process_coding.carryover_size > 0) | ||
| 731 | /* We have carryover in the last decoding. It should be | ||
| 732 | processed again after reading more data. */ | ||
| 733 | bcopy (process_coding.carryover, bufptr, | ||
| 734 | process_coding.carryover_size); | ||
| 735 | |||
| 736 | if (!NILP (display) && INTERACTIVE) | 743 | if (!NILP (display) && INTERACTIVE) |
| 737 | { | 744 | { |
| 738 | if (first) | 745 | if (first) |