/* This is useud to build the load history. */
Lisp_Object Vcurrent_load_list;
+/* List of descriptors now open for Fload. */
+static Lisp_Object load_descriptor_list;
+
/* File for get_file_char to read from. Use by load */
static FILE *instream;
\f
static void readevalloop ();
static Lisp_Object load_unwind ();
+static Lisp_Object load_descriptor_unwind ();
DEFUN ("load", Fload, Sload, 1, 4, 0,
"Execute a file of Lisp code named FILE.\n\
*ptr = stream;
XSET (lispstream, Lisp_Internal_Stream, (int) ptr);
record_unwind_protect (load_unwind, lispstream);
+ record_unwind_protect (load_descriptor_unwind, load_descriptor_list);
+ load_descriptor_list
+ = Fcons (make_number (fileno (stream)), load_descriptor_list);
load_in_progress++;
readevalloop (Qget_file_char, stream, str, Feval, 0);
unbind_to (count, Qnil);
return Qnil;
}
+static Lisp_Object
+load_descriptor_unwind (oldlist)
+ Lisp_Object oldlist;
+{
+ load_descriptor_list = oldlist;
+}
+
+/* Close all descriptors in use for Floads.
+ This is used when starting a subprocess. */
+
+void
+close_load_descs ()
+{
+ Lisp_Object tail;
+ for (tail = load_descriptor_list; !NILP (tail); tail = XCONS (tail)->cdr)
+ close (XFASTINT (XCONS (tail)->car));
+}
\f
static int
complete_filename_p (pathname)
Vvalues = Qnil;
load_in_progress = 0;
+
+ load_descriptor_list = Qnil;
}
void
"Used for internal purposes by `load'.");
Vcurrent_load_list = Qnil;
+ load_descriptor_list = Qnil;
+ staticpro (&load_descriptor_list);
+
Qcurrent_load_list = intern ("current-load-list");
staticpro (&Qcurrent_load_list);