static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *);
static int interactive_p (int);
static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args);
- \f
+
+ /* Functions to set Lisp_Object slots of struct specbinding. */
+
+ static inline void
+ set_specpdl_symbol (Lisp_Object symbol)
+ {
+ specpdl_ptr->symbol = symbol;
+ }
+
+ static inline void
+ set_specpdl_old_value (Lisp_Object oldval)
+ {
+ specpdl_ptr->old_value = oldval;
+ }
+
++static inline void
++set_specpdl_saved_value (Lisp_Object savedval)
++{
++ specpdl_ptr->saved_value = savedval;
++}
++
void
init_eval_once (void)
{
case SYMBOL_PLAINVAL:
/* The most common case is that of a non-constant symbol with a
trivial value. Make that as fast as we can. */
- specpdl_ptr->symbol = symbol;
- specpdl_ptr->old_value = SYMBOL_VAL (sym);
+ set_specpdl_symbol (symbol);
+ set_specpdl_old_value (SYMBOL_VAL (sym));
specpdl_ptr->func = NULL;
+ specpdl_ptr->saved_value = Qnil;
++specpdl_ptr;
- if (!sym->constant)
- SET_SYMBOL_VAL (sym, value);
- else
- set_internal (symbol, value, Qnil, 1);
+ do_specbind (sym, specpdl_ptr - 1, value);
break;
case SYMBOL_LOCALIZED:
if (SYMBOL_BLV (sym)->frame_local)
}
}
else
- specpdl_ptr->symbol = symbol;
+ set_specpdl_symbol (symbol);
specpdl_ptr++;
- set_internal (symbol, value, Qnil, 1);
+ do_specbind (sym, specpdl_ptr - 1, value);
break;
}
default: abort ();
if (specpdl_ptr == specpdl + specpdl_size)
grow_specpdl ();
specpdl_ptr->func = function;
- specpdl_ptr->symbol = Qnil;
- specpdl_ptr->old_value = arg;
- specpdl_ptr->saved_value = Qnil;
+ set_specpdl_symbol (Qnil);
+ set_specpdl_old_value (arg);
++ set_specpdl_saved_value (Qnil);
specpdl_ptr++;
}
/* Maximum number of bytes to send to a pty without an eof. */
static int pty_max_bytes;
+ /* These setters are used only in this file, so they can be private. */
+ static inline void
+ pset_buffer (struct Lisp_Process *p, Lisp_Object val)
+ {
+ p->buffer = val;
+ }
+ static inline void
+ pset_command (struct Lisp_Process *p, Lisp_Object val)
+ {
+ p->command = val;
+ }
+ static inline void
+ pset_decode_coding_system (struct Lisp_Process *p, Lisp_Object val)
+ {
+ p->decode_coding_system = val;
+ }
+ static inline void
+ pset_decoding_buf (struct Lisp_Process *p, Lisp_Object val)
+ {
+ p->decoding_buf = val;
+ }
+ static inline void
+ pset_encode_coding_system (struct Lisp_Process *p, Lisp_Object val)
+ {
+ p->encode_coding_system = val;
+ }
+ static inline void
+ pset_encoding_buf (struct Lisp_Process *p, Lisp_Object val)
+ {
+ p->encoding_buf = val;
+ }
+ static inline void
+ pset_filter (struct Lisp_Process *p, Lisp_Object val)
+ {
+ p->filter = val;
+ }
+ static inline void
+ pset_log (struct Lisp_Process *p, Lisp_Object val)
+ {
+ p->log = val;
+ }
+ static inline void
+ pset_mark (struct Lisp_Process *p, Lisp_Object val)
+ {
+ p->mark = val;
+ }
+ static inline void
++pset_thread (struct Lisp_Process *p, Lisp_Object val)
++{
++ p->thread = val;
++}
++static inline void
+ pset_name (struct Lisp_Process *p, Lisp_Object val)
+ {
+ p->name = val;
+ }
+ static inline void
+ pset_plist (struct Lisp_Process *p, Lisp_Object val)
+ {
+ p->plist = val;
+ }
+ static inline void
+ pset_sentinel (struct Lisp_Process *p, Lisp_Object val)
+ {
+ p->sentinel = val;
+ }
+ static inline void
+ pset_status (struct Lisp_Process *p, Lisp_Object val)
+ {
+ p->status = val;
+ }
+ static inline void
+ pset_tty_name (struct Lisp_Process *p, Lisp_Object val)
+ {
+ p->tty_name = val;
+ }
+ static inline void
+ pset_type (struct Lisp_Process *p, Lisp_Object val)
+ {
+ p->type = val;
+ }
+ static inline void
+ pset_write_queue (struct Lisp_Process *p, Lisp_Object val)
+ {
+ p->write_queue = val;
+ }
+
\f
+enum fd_bits
+{
+ /* Read from file descriptor. */
+ FOR_READ = 1,
+ /* Write to file descriptor. */
+ FOR_WRITE = 2,
+ /* This descriptor refers to a keyboard. Only valid if FOR_READ is
+ set. */
+ KEYBOARD_FD = 4,
+ /* This descriptor refers to a process. */
+ PROCESS_FD = 8,
+ /* A non-blocking connect. Only valid if FOR_WRITE is set. */
+ NON_BLOCKING_CONNECT_FD = 16
+};
+
static struct fd_callback_data
{
fd_callback func;
p = allocate_process ();
/* Initialize Lisp data. Note that allocate_process initializes all
Lisp data to nil, so do it only for slots which should not be nil. */
- PSET (p, status, Qrun);
- PSET (p, mark, Fmake_marker ());
- PSET (p, thread, Fcurrent_thread ());
+ pset_status (p, Qrun);
+ pset_mark (p, Fmake_marker ());
++ pset_thread (p, Fcurrent_thread ());
/* Initialize non-Lisp data. Note that allocate_process zeroes out all
non-Lisp data, so do it only for slots which should not be zero. */
else if (EQ (p->filter, Qt)
/* Network or serial process not stopped: */
&& !EQ (p->command, Qt))
- {
- FD_SET (p->infd, &input_wait_mask);
- FD_SET (p->infd, &non_keyboard_wait_mask);
- }
+ delete_read_fd (p->infd);
}
- PSET (p, filter, filter);
+ pset_filter (p, filter);
if (NETCONN1_P (p) || SERIALCONN1_P (p))
- PSET (p, childp, Fplist_put (p->childp, QCfilter, filter));
+ pset_childp (p, Fplist_put (p->childp, QCfilter, filter));
setup_process_coding_systems (process);
return filter;
}
more portable (see USG_SUBTTY_WORKS above). */
XPROCESS (process)->pty_flag = pty_flag;
- PSET (XPROCESS (process), status, Qrun);
+ pset_status (XPROCESS (process), Qrun);
setup_process_coding_systems (process);
- FD_SET (inchannel, &input_wait_mask);
- FD_SET (inchannel, &non_keyboard_wait_mask);
- if (inchannel > max_process_desc)
- max_process_desc = inchannel;
+ add_non_keyboard_read_fd (inchannel);
XPROCESS (process)->pid = -2;
#ifdef HAVE_PTYS
/* We may get here if connect did succeed immediately. However,
in that case, we still need to signal this like a non-blocking
connection. */
- PSET (p, status, Qconnect);
+ pset_status (p, Qconnect);
- if (!FD_ISSET (inch, &connect_wait_mask))
- {
- FD_SET (inch, &connect_wait_mask);
- FD_SET (inch, &write_mask);
- num_pending_connects++;
- }
+ if ((fd_callback_info[inch].flags & NON_BLOCKING_CONNECT_FD) == 0)
+ add_non_blocking_write_fd (inch);
}
else
#endif
p = XPROCESS (process);
if (NILP (p->command)
&& p->infd >= 0)
- {
- FD_CLR (p->infd, &input_wait_mask);
- FD_CLR (p->infd, &non_keyboard_wait_mask);
- }
+ delete_read_fd (p->infd);
- PSET (p, command, Qt);
+ pset_command (p, Qt);
return process;
}
#ifndef SIGTSTP