X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/4c03c46d5f8295b25d6583bd67c601a66f04e32e..8d892d7fef218001fa8ef828db4a5a864448f950:/src/lread.c diff --git a/src/lread.c b/src/lread.c index 0178286527..bbe421c0eb 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1,6 +1,7 @@ /* Lisp parsing and input streams. - Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994, 1995, 1997, 1998, - 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1985, 1986, 1987, 1988, 1989, 1993, 1994, 1995, + 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, + 2005 Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -16,8 +17,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs; see the file COPYING. If not, write to -the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ #include @@ -85,11 +86,12 @@ Lisp_Object Qvariable_documentation, Vvalues, Vstandard_input, Vafter_load_alist Lisp_Object Qascii_character, Qload, Qload_file_name; Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction; Lisp_Object Qinhibit_file_name_operation; +Lisp_Object Qeval_buffer_list, Veval_buffer_list; extern Lisp_Object Qevent_symbol_element_mask; extern Lisp_Object Qfile_exists_p; -/* non-zero if inside `load' */ +/* non-zero iff inside `load' */ int load_in_progress; /* Directory in which the sources were found. */ @@ -673,7 +675,6 @@ Return t if file exists. */) { register FILE *stream; register int fd = -1; - register Lisp_Object lispstream; int count = SPECPDL_INDEX (); Lisp_Object temp; struct gcpro gcpro1; @@ -903,10 +904,7 @@ Return t if file exists. */) } GCPRO1 (file); - lispstream = Fcons (Qnil, Qnil); - XSETCARFASTINT (lispstream, (EMACS_UINT)stream >> 16); - XSETCDRFASTINT (lispstream, (EMACS_UINT)stream & 0xffff); - record_unwind_protect (load_unwind, lispstream); + record_unwind_protect (load_unwind, make_save_value (stream, 0)); record_unwind_protect (load_descriptor_unwind, load_descriptor_list); specbind (Qload_file_name, found); specbind (Qinhibit_file_name_operation, Qnil); @@ -956,11 +954,12 @@ Return t if file exists. */) } static Lisp_Object -load_unwind (stream) /* used as unwind-protect function in load */ - Lisp_Object stream; +load_unwind (arg) /* used as unwind-protect function in load */ + Lisp_Object arg; { - fclose ((FILE *) (XFASTINT (XCAR (stream)) << 16 - | XFASTINT (XCDR (stream)))); + FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer; + if (stream != NULL) + fclose (stream); if (--load_in_progress < 0) load_in_progress = 0; return Qnil; } @@ -1005,6 +1004,7 @@ complete_filename_p (pathname) DEFUN ("locate-file-internal", Flocate_file_internal, Slocate_file_internal, 2, 4, 0, doc: /* Search for FILENAME through PATH. +Returns the file's name in absolute form, or nil if not found. If SUFFIXES is non-nil, it should be a list of suffixes to append to file name when searching. If non-nil, PREDICATE is used instead of `file-readable-p'. @@ -1451,6 +1451,7 @@ This function preserves the position of point. */) if (NILP (filename)) filename = XBUFFER (buf)->filename; + specbind (Qeval_buffer_list, Fcons (buf, Veval_buffer_list)); specbind (Qstandard_output, tem); record_unwind_protect (save_excursion_restore, save_excursion_save ()); BUF_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf))); @@ -1486,6 +1487,7 @@ This function does not move point. */) else tem = printflag; specbind (Qstandard_output, tem); + specbind (Qeval_buffer_list, Fcons (cbuf, Veval_buffer_list)); /* readevalloop calls functions which check the type of start and end. */ readevalloop (cbuf, 0, XBUFFER (cbuf)->filename, Feval, @@ -2594,6 +2596,23 @@ read1 (readcharfun, pch, first_in_list) break; case 'N': value = zero / zero; + + /* If that made a "negative" NaN, negate it. */ + + { + int i; + union { double d; char c[sizeof (double)]; } u_data, u_minus_zero; + + u_data.d = value; + u_minus_zero.d = - 0.0; + for (i = 0; i < sizeof (double); i++) + if (u_data.c[i] & u_minus_zero.c[i]) + { + value = - value; + break; + } + } + /* Now VALUE is a positive NaN. */ break; default: value = atof (read_buffer + negative); @@ -2844,7 +2863,7 @@ read_vector (readcharfun, bytecodeflag) if (i == COMPILED_BYTECODE) { if (!STRINGP (item)) - error ("invalid byte code"); + error ("Invalid byte code"); /* Delay handling the bytecode slot until we know whether it is lazily-loaded (we can tell by whether the @@ -2866,7 +2885,7 @@ read_vector (readcharfun, bytecodeflag) item = Fread (bytestr); if (!CONSP (item)) - error ("invalid byte code"); + error ("Invalid byte code"); otem = XCONS (item); bytestr = XCAR (item); @@ -3943,6 +3962,10 @@ to load. See also `load-dangerous-libraries'. */); Vbytecomp_version_regexp = build_string ("^;;;.\\(in Emacs version\\|bytecomp version FSF\\)"); + DEFVAR_LISP ("eval-buffer-list", &Veval_buffer_list, + doc: /* List of buffers being read from by calls to `eval-buffer' and `eval-region'. */); + Veval_buffer_list = Qnil; + /* Vsource_directory was initialized in init_lread. */ load_descriptor_list = Qnil; @@ -3984,11 +4007,15 @@ to load. See also `load-dangerous-libraries'. */); Qload_file_name = intern ("load-file-name"); staticpro (&Qload_file_name); + Qeval_buffer_list = intern ("eval-buffer-list"); + staticpro (&Qeval_buffer_list); + staticpro (&dump_path); staticpro (&read_objects); read_objects = Qnil; staticpro (&seen_list); + seen_list = Qnil; Vloads_in_progress = Qnil; staticpro (&Vloads_in_progress);