218 |
int fd[2]; |
int fd[2]; |
219 |
int filefd; |
int filefd; |
220 |
register int pid; |
register int pid; |
221 |
char buf[16384]; |
#define CALLPROC_BUFFER_SIZE_MIN (16 * 1024) |
222 |
char *bufptr = buf; |
#define CALLPROC_BUFFER_SIZE_MAX (4 * CALLPROC_BUFFER_SIZE_MIN) |
223 |
int bufsize = sizeof buf; |
char buf[CALLPROC_BUFFER_SIZE_MAX]; |
224 |
|
int bufsize = CALLPROC_BUFFER_SIZE_MIN; |
225 |
int count = SPECPDL_INDEX (); |
int count = SPECPDL_INDEX (); |
226 |
|
|
227 |
register const unsigned char **new_argv |
register const unsigned char **new_argv |
766 |
nread = carryover; |
nread = carryover; |
767 |
while (nread < bufsize - 1024) |
while (nread < bufsize - 1024) |
768 |
{ |
{ |
769 |
int this_read = emacs_read (fd[0], bufptr + nread, |
int this_read = emacs_read (fd[0], buf + nread, |
770 |
bufsize - nread); |
bufsize - nread); |
771 |
|
|
772 |
if (this_read < 0) |
if (this_read < 0) |
791 |
if (!NILP (buffer)) |
if (!NILP (buffer)) |
792 |
{ |
{ |
793 |
if (! CODING_MAY_REQUIRE_DECODING (&process_coding)) |
if (! CODING_MAY_REQUIRE_DECODING (&process_coding)) |
794 |
insert_1_both (bufptr, nread, nread, 0, 1, 0); |
insert_1_both (buf, nread, nread, 0, 1, 0); |
795 |
else |
else |
796 |
{ /* We have to decode the input. */ |
{ /* We have to decode the input. */ |
797 |
int size; |
int size; |
808 |
requires text-encoding detection. */ |
requires text-encoding detection. */ |
809 |
if (process_coding.type == coding_type_undecided) |
if (process_coding.type == coding_type_undecided) |
810 |
{ |
{ |
811 |
detect_coding (&process_coding, bufptr, nread); |
detect_coding (&process_coding, buf, nread); |
812 |
if (process_coding.composing != COMPOSITION_DISABLED) |
if (process_coding.composing != COMPOSITION_DISABLED) |
813 |
/* We have not yet allocated the composition |
/* We have not yet allocated the composition |
814 |
data because the coding type was undecided. */ |
data because the coding type was undecided. */ |
817 |
if (process_coding.cmp_data) |
if (process_coding.cmp_data) |
818 |
process_coding.cmp_data->char_offset = PT; |
process_coding.cmp_data->char_offset = PT; |
819 |
|
|
820 |
decode_coding (&process_coding, bufptr, decoding_buf, |
decode_coding (&process_coding, buf, decoding_buf, |
821 |
nread, size); |
nread, size); |
822 |
|
|
823 |
if (display_on_the_fly |
if (display_on_the_fly |
906 |
if (carryover > 0) |
if (carryover > 0) |
907 |
/* As CARRYOVER should not be that large, we had |
/* As CARRYOVER should not be that large, we had |
908 |
better avoid overhead of bcopy. */ |
better avoid overhead of bcopy. */ |
909 |
BCOPY_SHORT (bufptr + process_coding.consumed, bufptr, |
BCOPY_SHORT (buf + process_coding.consumed, buf, |
910 |
carryover); |
carryover); |
911 |
if (process_coding.result == CODING_FINISH_INSUFFICIENT_CMP) |
if (process_coding.result == CODING_FINISH_INSUFFICIENT_CMP) |
912 |
{ |
{ |
923 |
if (process_coding.mode & CODING_MODE_LAST_BLOCK) |
if (process_coding.mode & CODING_MODE_LAST_BLOCK) |
924 |
break; |
break; |
925 |
|
|
926 |
|
#if (CALLPROC_BUFFER_SIZE_MIN != CALLPROC_BUFFER_SIZE_MAX) |
927 |
/* Make the buffer bigger as we continue to read more data, |
/* Make the buffer bigger as we continue to read more data, |
928 |
but not past 64k. */ |
but not past CALLPROC_BUFFER_SIZE_MAX. */ |
929 |
if (bufsize < 64 * 1024 && total_read > 32 * bufsize) |
if (bufsize < CALLPROC_BUFFER_SIZE_MAX && total_read > 32 * bufsize) |
930 |
{ |
if ((bufsize *= 2) > CALLPROC_BUFFER_SIZE_MAX) |
931 |
char *tempptr; |
bufsize = CALLPROC_BUFFER_SIZE_MAX; |
932 |
bufsize *= 2; |
#endif |
|
|
|
|
tempptr = (char *) alloca (bufsize); |
|
|
bcopy (bufptr, tempptr, bufsize / 2); |
|
|
bufptr = tempptr; |
|
|
} |
|
933 |
|
|
934 |
if (display_p) |
if (display_p) |
935 |
{ |
{ |