#include "commands.h"
#include "frame.h"
#include "blockinput.h"
+#include "keyboard.h"
+#include "dispextern.h"
#define max(a, b) ((a) > (b) ? (a) : (b))
Lisp_Object status_convert ();
+void
update_status (p)
struct Lisp_Process *p;
{
allocate_pty ()
{
struct stat stb;
- register c, i;
+ register int c, i;
int fd;
/* Some systems name their pseudoterminals so that there are gaps in
return val;
}
+void
remove_process (proc)
register Lisp_Object proc;
{
an output stream or filter function to handle the output.\n\
BUFFER may be also nil, meaning that this process is not associated\n\
with any buffer.\n\
-Third arg is program file name. It is searched for as in the shell.\n\
+Third arg is program file name. It is searched for in PATH.\n\
Remaining arguments are strings to give program as arguments.")
(nargs, args)
int nargs;
#ifdef VMS
/* Make a one member argv with all args concatenated
together separated by a blank. */
- len = XSTRING (program)->size_byte + 2;
+ len = STRING_BYTES (XSTRING (program)) + 2;
for (i = 3; i < nargs; i++)
{
tem = args[i];
CHECK_STRING (tem, i);
- len += XSTRING (tem)->size_byte + 1; /* count the blank */
+ len += STRING_BYTES (XSTRING (tem)) + 1; /* count the blank */
}
new_argv = (unsigned char *) alloca (len);
strcpy (new_argv, XSTRING (program)->data);
static int waiting_for_user_input_p;
/* This is here so breakpoints can be put on it. */
-static
+static void
wait_reading_process_input_1 ()
{
}
before the timeout elapsed.
Otherwise, return true iff we received input from any process. */
+int
wait_reading_process_input (time_limit, microsecs, read_kbd, do_display)
int time_limit, microsecs;
Lisp_Object read_kbd;
The characters read are decoded according to PROC's coding-system
for decoding. */
+int
read_process_output (proc, channel)
Lisp_Object proc;
register int channel;
char *buf = (char *) xmalloc (nbytes + carryover);
bcopy (XSTRING (p->decoding_buf)->data
- + XSTRING (p->decoding_buf)->size_byte - carryover,
+ + STRING_BYTES (XSTRING (p->decoding_buf)) - carryover,
buf, carryover);
bcopy (chars, buf + carryover, nbytes);
chars = buf;
if (carryover)
/* See the comment above. */
bcopy (XSTRING (p->decoding_buf)->data
- + XSTRING (p->decoding_buf)->size_byte - carryover,
+ + STRING_BYTES (XSTRING (p->decoding_buf)) - carryover,
buf, carryover);
if (proc_buffered_char[channel] < 0)
int require = decoding_buffer_size (coding, nbytes);
int result;
- if (XSTRING (p->decoding_buf)->size_byte < require)
+ if (STRING_BYTES (XSTRING (p->decoding_buf)) < require)
p->decoding_buf = make_uninit_string (require);
result = decode_coding (coding, chars, XSTRING (p->decoding_buf)->data,
- nbytes, XSTRING (p->decoding_buf)->size_byte);
+ nbytes, STRING_BYTES (XSTRING (p->decoding_buf)));
carryover = nbytes - coding->consumed;
/* A new coding system might be found by `decode_coding'. */
return 0;
chars = (char *) XSTRING (p->decoding_buf)->data;
nbytes = coding->produced;
- nchars = coding->produced_char;
+ nchars = (coding->fake_multibyte
+ ? multibyte_chars_in_text (chars, nbytes)
+ : coding->produced_char);
chars_in_decoding_buf = 1;
}
#ifdef VMS
/* Although we don't have to decode the received data, we must
move it to an area which we don't have to free. */
if (! STRINGP (p->decoding_buf)
- || XSTRING (p->decoding_buf)->size < nbytes)
+ || STRING_BYTES (XSTRING (p->decoding_buf)) < nbytes)
p->decoding_buf = make_uninit_string (nbytes);
bcopy (chars, XSTRING (p->decoding_buf)->data, nbytes);
free (chars);
chars = XSTRING (p->decoding_buf)->data;
+ nchars = multibyte_chars_in_text (chars, nbytes);
chars_in_decoding_buf = 1;
carryover = 0;
}
/* Don't clobber the CURRENT match data, either! */
tem = Fmatch_data (Qnil, Qnil);
restore_match_data ();
- record_unwind_protect (Fstore_match_data, Fmatch_data (Qnil, Qnil));
- Fstore_match_data (tem);
+ record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil));
+ Fset_match_data (tem);
}
/* For speed, if a search happens within this code,
save the match data in a special nonrecursive fashion. */
running_asynch_code = 1;
- text = make_multibyte_string (chars, nchars, nbytes);
+ text = make_string_from_bytes (chars, nchars, nbytes);
internal_condition_case_1 (read_process_output_call,
Fcons (outstream,
Fcons (proc, Fcons (text, Qnil))),
/* Insert before markers in case we are inserting where
the buffer's mark is, and the user's next command is Meta-y. */
if (chars_in_decoding_buf)
- insert_from_string_before_markers (p->decoding_buf, 0, 0,
- nchars, nbytes, 0);
+ {
+ /* Since multibyteness of p->docoding_buf is corrupted, we
+ can't use insert_from_string_before_markers. */
+ char *temp_buf;
+
+ temp_buf = (char *) alloca (nbytes);
+ bcopy (XSTRING (p->decoding_buf)->data, temp_buf, nbytes);
+ insert_before_markers (temp_buf, nbytes);
+ }
else
insert_1_both (chars, nchars, nbytes, 0, 1, 1);
set_marker_both (p->mark, p->buffer, PT, PT_BYTE);
being encoded. Should we store them in a buffer to prepend them to
the data send later? */
+void
send_process (proc, buf, len, object)
volatile Lisp_Object proc;
unsigned char *buf;
offset = -1;
}
bcopy ((XSTRING (XPROCESS (proc)->encoding_buf)->data
- + XSTRING (XPROCESS (proc)->encoding_buf)->size_byte
+ + STRING_BYTES (XSTRING (XPROCESS (proc)->encoding_buf))
- carryover),
temp_buf,
carryover);
buf = temp_buf;
}
- if (XSTRING (XPROCESS (proc)->encoding_buf)->size_byte < require)
+ if (STRING_BYTES (XSTRING (XPROCESS (proc)->encoding_buf)) < require)
{
XPROCESS (proc)->encoding_buf = make_uninit_string (require);
}
object = XPROCESS (proc)->encoding_buf;
encode_coding (coding, buf, XSTRING (object)->data,
- len, XSTRING (object)->size_byte);
+ len, STRING_BYTES (XSTRING (object)));
len = coding->produced;
buf = XSTRING (object)->data;
if (temp_buf)
CHECK_STRING (string, 1);
proc = get_process (process);
send_process (proc, XSTRING (string)->data,
- XSTRING (string)->size_byte, string);
+ STRING_BYTES (XSTRING (string)), string);
return Qnil;
}
\f
Lisp_Object tem;
tem = Fmatch_data (Qnil, Qnil);
restore_match_data ();
- record_unwind_protect (Fstore_match_data, Fmatch_data (Qnil, Qnil));
- Fstore_match_data (tem);
+ record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil));
+ Fset_match_data (tem);
}
/* For speed, if a search happens within this code,
return 0;
}
\f
+void
init_process ()
{
register int i;
bzero (proc_encode_coding_system, sizeof proc_encode_coding_system);
}
+void
syms_of_process ()
{
Qprocessp = intern ("processp");
If `buffer' is nil, kill all processes.
Since we have no subprocesses, this does nothing. */
+void
kill_buffer_processes (buffer)
Lisp_Object buffer;
{