aboutsummaryrefslogtreecommitdiffstats
path: root/src/lread.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lread.c')
-rw-r--r--src/lread.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/lread.c b/src/lread.c
index ee18ae5ac2b..6c2854a15b8 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -80,6 +80,9 @@ Lisp_Object Vload_history;
80/* This is useud to build the load history. */ 80/* This is useud to build the load history. */
81Lisp_Object Vcurrent_load_list; 81Lisp_Object Vcurrent_load_list;
82 82
83/* List of descriptors now open for Fload. */
84static Lisp_Object load_descriptor_list;
85
83/* File for get_file_char to read from. Use by load */ 86/* File for get_file_char to read from. Use by load */
84static FILE *instream; 87static FILE *instream;
85 88
@@ -303,6 +306,7 @@ DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0,
303 306
304static void readevalloop (); 307static void readevalloop ();
305static Lisp_Object load_unwind (); 308static Lisp_Object load_unwind ();
309static Lisp_Object load_descriptor_unwind ();
306 310
307DEFUN ("load", Fload, Sload, 1, 4, 0, 311DEFUN ("load", Fload, Sload, 1, 4, 0,
308 "Execute a file of Lisp code named FILE.\n\ 312 "Execute a file of Lisp code named FILE.\n\
@@ -406,6 +410,9 @@ Return t if file exists.")
406 *ptr = stream; 410 *ptr = stream;
407 XSET (lispstream, Lisp_Internal_Stream, (int) ptr); 411 XSET (lispstream, Lisp_Internal_Stream, (int) ptr);
408 record_unwind_protect (load_unwind, lispstream); 412 record_unwind_protect (load_unwind, lispstream);
413 record_unwind_protect (load_descriptor_unwind, load_descriptor_list);
414 load_descriptor_list
415 = Fcons (make_number (fileno (stream)), load_descriptor_list);
409 load_in_progress++; 416 load_in_progress++;
410 readevalloop (Qget_file_char, stream, str, Feval, 0); 417 readevalloop (Qget_file_char, stream, str, Feval, 0);
411 unbind_to (count, Qnil); 418 unbind_to (count, Qnil);
@@ -431,6 +438,23 @@ load_unwind (stream) /* used as unwind-protect function in load */
431 return Qnil; 438 return Qnil;
432} 439}
433 440
441static Lisp_Object
442load_descriptor_unwind (oldlist)
443 Lisp_Object oldlist;
444{
445 load_descriptor_list = oldlist;
446}
447
448/* Close all descriptors in use for Floads.
449 This is used when starting a subprocess. */
450
451void
452close_load_descs ()
453{
454 Lisp_Object tail;
455 for (tail = load_descriptor_list; !NILP (tail); tail = XCONS (tail)->cdr)
456 close (XFASTINT (XCONS (tail)->car));
457}
434 458
435static int 459static int
436complete_filename_p (pathname) 460complete_filename_p (pathname)
@@ -1871,6 +1895,8 @@ init_lread ()
1871 Vvalues = Qnil; 1895 Vvalues = Qnil;
1872 1896
1873 load_in_progress = 0; 1897 load_in_progress = 0;
1898
1899 load_descriptor_list = Qnil;
1874} 1900}
1875 1901
1876void 1902void
@@ -1937,6 +1963,9 @@ or variables, and cons cells `(provide . FEATURE)' and `(require . FEATURE)'.");
1937 "Used for internal purposes by `load'."); 1963 "Used for internal purposes by `load'.");
1938 Vcurrent_load_list = Qnil; 1964 Vcurrent_load_list = Qnil;
1939 1965
1966 load_descriptor_list = Qnil;
1967 staticpro (&load_descriptor_list);
1968
1940 Qcurrent_load_list = intern ("current-load-list"); 1969 Qcurrent_load_list = intern ("current-load-list");
1941 staticpro (&Qcurrent_load_list); 1970 staticpro (&Qcurrent_load_list);
1942 1971