Add support for large files, 64-bit Solaris, system locale codings.
[bpt/emacs.git] / src / lread.c
index f173205..e08b4dd 100644 (file)
@@ -1,5 +1,5 @@
 /* Lisp parsing and input streams.
-   Copyright (C) 1985, 86, 87, 88, 89, 93, 94, 95, 97, 1998
+   Copyright (C) 1985, 86, 87, 88, 89, 93, 94, 95, 97, 98, 1999
       Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -27,11 +27,12 @@ Boston, MA 02111-1307, USA.  */
 #include <sys/file.h>
 #include <errno.h>
 #include "lisp.h"
+#include "intervals.h"
 
 #ifndef standalone
 #include "buffer.h"
 #include "charset.h"
-#include <paths.h>
+#include <epaths.h>
 #include "commands.h"
 #include "keyboard.h"
 #include "termhooks.h"
@@ -57,10 +58,6 @@ Boston, MA 02111-1307, USA.  */
 #endif
 
 #ifdef LISP_FLOAT_TYPE
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#endif
-
 #include <math.h>
 #endif /* LISP_FLOAT_TYPE */
 
@@ -72,6 +69,14 @@ Boston, MA 02111-1307, USA.  */
 #define O_RDONLY 0
 #endif
 
+#ifdef HAVE_FTELLO
+#define file_offset off_t
+#define file_tell ftello
+#else
+#define file_offset long
+#define file_tell ftell
+#endif
+
 extern int errno;
 
 Lisp_Object Qread_char, Qget_file_char, Qstandard_input, Qcurrent_load_list;
@@ -92,6 +97,9 @@ Lisp_Object Vsource_directory;
 /* Search path for files to be loaded. */
 Lisp_Object Vload_path;
 
+/* File name of user's init file.  */
+Lisp_Object Vuser_init_file;
+
 /* This is the user-visible association list that maps features to
    lists of defs in their load files. */
 Lisp_Object Vload_history;
@@ -124,6 +132,9 @@ static int load_convert_to_unibyte;
    compiled) instead of readevalloop.  */
 Lisp_Object Vload_source_file_function;
 
+/* List of all DEFVAR_BOOL variables.  Used by the byte optimizer.  */
+Lisp_Object Vbyte_boolean_vars;
+
 /* List of descriptors now open for Fload.  */
 static Lisp_Object load_descriptor_list;
 
@@ -149,7 +160,7 @@ static int saved_doc_string_size;
 /* Length of actual data in saved_doc_string.  */
 static int saved_doc_string_length;
 /* This is the file position that string came from.  */
-static int saved_doc_string_position;
+static file_offset saved_doc_string_position;
 
 /* This contains the previous string skipped with #@.
    We copy it from saved_doc_string when a new string
@@ -160,7 +171,7 @@ static int prev_saved_doc_string_size;
 /* Length of actual data in prev_saved_doc_string.  */
 static int prev_saved_doc_string_length;
 /* This is the file position that string came from.  */
-static int prev_saved_doc_string_position;
+static file_offset prev_saved_doc_string_position;
 
 /* Nonzero means inside a new-style backquote
    with no surrounding parentheses.
@@ -184,7 +195,7 @@ readchar (readcharfun)
      Lisp_Object readcharfun;
 {
   Lisp_Object tem;
-  register int c, mpos;
+  register int c;
 
   if (BUFFERP (readcharfun))
     {
@@ -405,6 +416,9 @@ unreadchar (readcharfun, c)
 
 static Lisp_Object read0 (), read1 (), read_list (), read_vector ();
 static int read_multibyte ();
+static Lisp_Object substitute_object_recurse ();
+static void        substitute_object_in_subtree (), substitute_in_interval ();
+
 \f
 /* Get a character from the tty.  */
 
@@ -467,7 +481,7 @@ read_filtered_event (no_switch_frame, ascii_required, error_nonascii,
       /* Convert certain symbols to their ASCII equivalents.  */
       if (SYMBOLP (val))
        {
-         Lisp_Object tem, tem1, tem2;
+         Lisp_Object tem, tem1;
          tem = Fget (val, Qevent_symbol_element_mask);
          if (!NILP (tem))
            {
@@ -615,7 +629,7 @@ Return t if file exists.")
      since it would try to load a directory as a Lisp file */
   if (XSTRING (file)->size > 0)
     {
-      int size = XSTRING (file)->size;
+      int size = STRING_BYTES (XSTRING (file));
 
       GCPRO1 (file);
 
@@ -652,6 +666,9 @@ Return t if file exists.")
        return Qnil;
     }
 
+  if (EQ (Qt, Vuser_init_file))
+    Vuser_init_file = found;
+
   /* If FD is 0, that means openp found a magic file.  */
   if (fd == 0)
     {
@@ -668,7 +685,7 @@ Return t if file exists.")
 
   /* Load .elc files directly, but not when they are
      remote and have no handler!  */
-  if (!bcmp (&(XSTRING (found)->data[XSTRING (found)->size - 4]),
+  if (!bcmp (&(XSTRING (found)->data[STRING_BYTES (XSTRING (found)) - 4]),
             ".elc", 4)
       && fd != 0)
     {
@@ -681,7 +698,7 @@ Return t if file exists.")
       fmode = "rb";
 #endif /* DOS_NT */
       stat ((char *)XSTRING (found)->data, &s1);
-      XSTRING (found)->data[XSTRING (found)->size - 1] = 0;
+      XSTRING (found)->data[STRING_BYTES (XSTRING (found)) - 1] = 0;
       result = stat ((char *)XSTRING (found)->data, &s2);
       if (result >= 0 && (unsigned) s1.st_mtime < (unsigned) s2.st_mtime)
        {
@@ -693,7 +710,7 @@ Return t if file exists.")
            message_with_string ("Source file `%s' newer than byte-compiled file",
                                 found, 1);
        }
-      XSTRING (found)->data[XSTRING (found)->size - 1] = 'c';
+      XSTRING (found)->data[STRING_BYTES (XSTRING (found)) - 1] = 'c';
     }
   else
     {
@@ -701,7 +718,7 @@ Return t if file exists.")
       if (!NILP (Vload_source_file_function))
        {
          if (fd != 0)
-           close (fd);
+           emacs_close (fd);
          return call4 (Vload_source_file_function, found, file,
                        NILP (noerror) ? Qnil : Qt,
                        NILP (nomessage) ? Qnil : Qt);
@@ -709,14 +726,14 @@ Return t if file exists.")
     }
 
 #ifdef WINDOWSNT
-  close (fd);
+  emacs_close (fd);
   stream = fopen ((char *) XSTRING (found)->data, fmode);
 #else  /* not WINDOWSNT */
   stream = fdopen (fd, fmode);
 #endif /* not WINDOWSNT */
   if (stream == 0)
     {
-      close (fd);
+      emacs_close (fd);
       error ("Failure to create stdio stream for %s", XSTRING (file)->data);
     }
 
@@ -736,8 +753,8 @@ Return t if file exists.")
 
   GCPRO1 (file);
   lispstream = Fcons (Qnil, Qnil);
-  XSETFASTINT (XCONS (lispstream)->car, (EMACS_UINT)stream >> 16);
-  XSETFASTINT (XCONS (lispstream)->cdr, (EMACS_UINT)stream & 0xffff);
+  XSETFASTINT (XCAR (lispstream), (EMACS_UINT)stream >> 16);
+  XSETFASTINT (XCDR (lispstream), (EMACS_UINT)stream & 0xffff);
   record_unwind_protect (load_unwind, lispstream);
   record_unwind_protect (load_descriptor_unwind, load_descriptor_list);
   specbind (Qload_file_name, found);
@@ -781,8 +798,8 @@ static Lisp_Object
 load_unwind (stream)  /* used as unwind-protect function in load */
      Lisp_Object stream;
 {
-  fclose ((FILE *) (XFASTINT (XCONS (stream)->car) << 16
-                   | XFASTINT (XCONS (stream)->cdr)));
+  fclose ((FILE *) (XFASTINT (XCAR (stream)) << 16
+                   | XFASTINT (XCDR (stream))));
   if (--load_in_progress < 0) load_in_progress = 0;
   return Qnil;
 }
@@ -803,8 +820,8 @@ close_load_descs ()
 {
 #ifndef WINDOWSNT
   Lisp_Object tail;
-  for (tail = load_descriptor_list; !NILP (tail); tail = XCONS (tail)->cdr)
-    close (XFASTINT (XCONS (tail)->car));
+  for (tail = load_descriptor_list; !NILP (tail); tail = XCDR (tail))
+    emacs_close (XFASTINT (XCAR (tail)));
 #endif
 }
 \f
@@ -884,7 +901,7 @@ openp (path, str, suffix, storeptr, exec_only)
 
       /* Calculate maximum size of any filename made from
         this path element/specified file name and any possible suffix.  */
-      want_size = strlen (suffix) + XSTRING (filename)->size + 1;
+      want_size = strlen (suffix) + STRING_BYTES (XSTRING (filename)) + 1;
       if (fn_size < want_size)
        fn = (char *) alloca (fn_size = 100 + want_size);
 
@@ -904,13 +921,14 @@ openp (path, str, suffix, storeptr, exec_only)
              && XSTRING (filename)->data[1] == ':')
            {
              strncpy (fn, XSTRING (filename)->data + 2,
-                      XSTRING (filename)->size - 2);
-             fn[XSTRING (filename)->size - 2] = 0;
+                      STRING_BYTES (XSTRING (filename)) - 2);
+             fn[STRING_BYTES (XSTRING (filename)) - 2] = 0;
            }
          else
            {
-             strncpy (fn, XSTRING (filename)->data, XSTRING (filename)->size);
-             fn[XSTRING (filename)->size] = 0;
+             strncpy (fn, XSTRING (filename)->data,
+                      STRING_BYTES (XSTRING (filename)));
+             fn[STRING_BYTES (XSTRING (filename))] = 0;
            }
 
          if (lsuffix != 0)  /* Bug happens on CCI if lsuffix is 0.  */
@@ -952,7 +970,7 @@ openp (path, str, suffix, storeptr, exec_only)
                  if (exec_only)
                    fd = (access (fn, X_OK) == 0) ? 1 : -1;
                  else
-                   fd = open (fn, O_RDONLY, 0);
+                   fd = emacs_open (fn, O_RDONLY, 0);
 
                  if (fd >= 0)
                    {
@@ -1153,7 +1171,7 @@ readevalloop (readcharfun, stream, sourcename, evalfun, printflag, unibyte, read
 
 #ifndef standalone
 
-DEFUN ("eval-buffer", Feval_buffer, Seval_buffer, 0, 4, "",
+DEFUN ("eval-buffer", Feval_buffer, Seval_buffer, 0, 5, "",
   "Execute the current buffer as Lisp code.\n\
 Programs can pass two arguments, BUFFER and PRINTFLAG.\n\
 BUFFER is the buffer to evaluate (nil means use current buffer).\n\
@@ -1162,10 +1180,15 @@ nil means discard it; anything else is stream for print.\n\
 \n\
 If the optional third argument FILENAME is non-nil,\n\
 it specifies the file name to use for `load-history'.\n\
+The optional fourth argument UNIBYTE specifies `load-convert-to-unibyte'\n\
+for this invocation.\n\
+\n\
+The optional fifth argument DO-ALLOW-PRINT, if not-nil, specifies that\n\
+`print' and related functions should work normally even if PRINTFLAG is nil.\n\
 \n\
 This function preserves the position of point.")
-  (buffer, printflag, filename, unibyte)
-     Lisp_Object buffer, printflag, filename, unibyte;
+  (buffer, printflag, filename, unibyte, do_allow_print)
+     Lisp_Object buffer, printflag, filename, unibyte, do_allow_print;
 {
   int count = specpdl_ptr - specpdl;
   Lisp_Object tem, buf;
@@ -1177,7 +1200,7 @@ This function preserves the position of point.")
   if (NILP (buf))
     error ("No such buffer");
 
-  if (NILP (printflag))
+  if (NILP (printflag) && NILP (do_allow_print))
     tem = Qsymbolp;
   else
     tem = printflag;
@@ -1478,8 +1501,10 @@ read_escape (readcharfun, stringp)
       c = READCHAR;
       if (c == '\\')
        c = read_escape (readcharfun, 0);
-      if ((c & 0177) == '?')
-       return 0177 | c;
+      if ((c & ~CHAR_MODIFIER_MASK) == '?')
+       return 0177 | (c & CHAR_MODIFIER_MASK);
+      else if (! SINGLE_BYTE_CHAR_P ((c & ~CHAR_MODIFIER_MASK)))
+       return c | ctrl_modifier;
       /* ASCII control chars are made from letters (both cases),
         as well as the non-letters within 0100...0137.  */
       else if ((c & 0137) >= 0101 && (c & 0137) <= 0132)
@@ -1730,7 +1755,7 @@ read1 (readcharfun, pch, first_in_list)
              {
                char *temp = saved_doc_string;
                int temp_size = saved_doc_string_size;
-               int temp_pos = saved_doc_string_position;
+               file_offset temp_pos = saved_doc_string_position;
                int temp_len = saved_doc_string_length;
 
                saved_doc_string = prev_saved_doc_string;
@@ -1756,7 +1781,7 @@ read1 (readcharfun, pch, first_in_list)
                                                        saved_doc_string_size);
                }
 
-             saved_doc_string_position = ftell (instream);
+             saved_doc_string_position = file_tell (instream);
 
              /* Copy that many characters into saved_doc_string.  */
              for (i = 0; i < nskip && c >= 0; i++)
@@ -1800,8 +1825,23 @@ read1 (readcharfun, pch, first_in_list)
          /* #n=object returns object, but associates it with n for #n#.  */
          if (c == '=')
            {
+             /* Make a placeholder for #n# to use temporarily */
+             Lisp_Object placeholder;
+             Lisp_Object cell;
+
+             placeholder = Fcons(Qnil, Qnil);
+             cell = Fcons (make_number (n), placeholder);
+             read_objects = Fcons (cell, read_objects);
+
+             /* Read the object itself. */
              tem = read0 (readcharfun);
-             read_objects = Fcons (Fcons (make_number (n), tem), read_objects);
+
+             /* Now put it everywhere the placeholder was... */
+             substitute_object_in_subtree (tem, placeholder);
+
+             /* ...and #n# will use the real value from now on.  */
+             Fsetcdr (cell, tem);
+             
              return tem;
            }
          /* #n# returns a previously read object.  */
@@ -1868,8 +1908,6 @@ read1 (readcharfun, pch, first_in_list)
 
     case '?':
       {
-       register Lisp_Object val;
-
        c = READCHAR;
        if (c < 0) return Fsignal (Qend_of_file, Qnil);
 
@@ -1920,17 +1958,20 @@ read1 (readcharfun, pch, first_in_list)
 
                /* If an escape specifies a non-ASCII single-byte character,
                   this must be a unibyte string.  */
-               if (SINGLE_BYTE_CHAR_P ((c & ~CHAR_META))
-                   && ! ASCII_BYTE_P (c))
+               if (SINGLE_BYTE_CHAR_P ((c & ~CHAR_MODIFIER_MASK))
+                   && ! ASCII_BYTE_P ((c & ~CHAR_MODIFIER_MASK)))
                  force_singlebyte = 1;
              }
 
-           if (! SINGLE_BYTE_CHAR_P ((c & ~CHAR_META)))
+           if (! SINGLE_BYTE_CHAR_P ((c & ~CHAR_MODIFIER_MASK)))
              {
                unsigned char workbuf[4];
                unsigned char *str = workbuf;
                int length;
 
+               /* Any modifiers for a multibyte character are invalid.  */
+               if (c & CHAR_MODIFIER_MASK)
+                 error ("Invalid modifier in string");
                length = non_ascii_char_to_string (c, workbuf, &str);
                if (length > 1)
                  force_multibyte = 1;
@@ -1946,6 +1987,15 @@ read1 (readcharfun, pch, first_in_list)
                else if (c == (CHAR_CTL | '?'))
                  c = 127;
 
+               if (c & CHAR_SHIFT)
+                 {
+                   /* Shift modifier is valid only with [A-Za-z].  */
+                   if ((c & 0377) >= 'A' && (c & 0377) <= 'Z')
+                     c &= ~CHAR_SHIFT;
+                   else if ((c & 0377) >= 'a' && (c & 0377) <= 'z')
+                     c = (c & ~CHAR_SHIFT) - ('a' - 'A');
+                 }
+
                if (c & CHAR_META)
                  /* Move the meta bit to the right place for a string.  */
                  c = (c & ~CHAR_META) | 0x80;
@@ -2157,6 +2207,129 @@ read1 (readcharfun, pch, first_in_list)
     }
 }
 \f
+
+/* List of nodes we've seen during substitute_object_in_subtree. */
+static Lisp_Object seen_list;
+
+static void
+substitute_object_in_subtree (object, placeholder)
+     Lisp_Object object;
+     Lisp_Object placeholder;
+{
+  Lisp_Object check_object;
+
+  /* We haven't seen any objects when we start. */
+  seen_list = Qnil;
+
+  /* Make all the substitutions. */
+  check_object
+    = substitute_object_recurse (object, placeholder, object);
+  
+  /* Clear seen_list because we're done with it. */
+  seen_list = Qnil;
+
+  /* The returned object here is expected to always eq the
+     original. */
+  if (!EQ (check_object, object))
+    error ("Unexpected mutation error in reader");
+}
+
+/*  Feval doesn't get called from here, so no gc protection is needed. */
+#define SUBSTITUTE(get_val, set_val)                 \
+{                                                    \
+  Lisp_Object old_value = get_val;                   \
+  Lisp_Object true_value                             \
+    = substitute_object_recurse (object, placeholder,\
+                              old_value);           \
+                                                     \
+  if (!EQ (old_value, true_value))                   \
+    {                                                \
+       set_val;                                      \
+    }                                                \
+}
+
+static Lisp_Object
+substitute_object_recurse (object, placeholder, subtree)
+     Lisp_Object object;
+     Lisp_Object placeholder;
+     Lisp_Object subtree;
+{
+  /* If we find the placeholder, return the target object. */
+  if (EQ (placeholder, subtree))
+    return object;
+
+  /* If we've been to this node before, don't explore it again. */
+  if (!EQ (Qnil, Fmemq (subtree, seen_list)))
+    return subtree;
+
+  /* If this node can be the entry point to a cycle, remember that
+     we've seen it.  It can only be such an entry point if it was made
+     by #n=, which means that we can find it as a value in
+     read_objects.  */
+  if (!EQ (Qnil, Frassq (subtree, read_objects)))
+    seen_list = Fcons (subtree, seen_list);
+      
+  /* Recurse according to subtree's type.
+     Every branch must return a Lisp_Object.  */
+  switch (XTYPE (subtree))
+    {
+    case Lisp_Vectorlike:
+      {
+       int i;
+       int length = Flength(subtree);
+       for (i = 0; i < length; i++)
+         {
+           Lisp_Object idx = make_number (i);
+           SUBSTITUTE (Faref (subtree, idx),
+                       Faset (subtree, idx, true_value)); 
+         }
+       return subtree;
+      }
+
+    case Lisp_Cons:
+      {
+       SUBSTITUTE (Fcar_safe (subtree),
+                   Fsetcar (subtree, true_value)); 
+       SUBSTITUTE (Fcdr_safe (subtree),
+                   Fsetcdr (subtree, true_value)); 
+       return subtree;
+      }
+
+#ifdef USE_TEXT_PROPERTIES
+    case Lisp_String:
+      {
+       /* Check for text properties in each interval.
+          substitute_in_interval contains part of the logic. */ 
+
+       INTERVAL    root_interval = XSTRING (subtree)->intervals;
+       Lisp_Object arg           = Fcons (object, placeholder);
+          
+       traverse_intervals (root_interval, 1, 0,
+                           &substitute_in_interval, arg); 
+
+       return subtree;
+      }
+#endif /* defined USE_TEXT_PROPERTIES */
+
+      /* Other types don't recurse any further. */
+    default:
+      return subtree;
+    }
+}
+
+/*  Helper function for substitute_object_recurse.  */
+static void
+substitute_in_interval (interval, arg)
+     INTERVAL    interval;
+     Lisp_Object arg;
+{
+  Lisp_Object object      = Fcar (arg);
+  Lisp_Object placeholder = Fcdr (arg);
+
+  SUBSTITUTE(interval->plist, interval->plist = true_value);
+}
+
+\f
 #ifdef LISP_FLOAT_TYPE
 
 #define LEAD_INT 1
@@ -2285,8 +2458,8 @@ read_vector (readcharfun, bytecodeflag)
                    error ("invalid byte code");
 
                  otem = XCONS (item);
-                 bytestr = XCONS (item)->car;
-                 item = XCONS (item)->cdr;
+                 bytestr = XCAR (item);
+                 item = XCDR (item);
                  free_cons (otem);
                }
 
@@ -2378,7 +2551,7 @@ read_list (flag, readcharfun)
            {
              GCPRO2 (val, tail);
              if (!NILP (tail))
-               XCONS (tail)->cdr = read0 (readcharfun);
+               XCDR (tail) = read0 (readcharfun);
              else
                val = read0 (readcharfun);
              read1 (readcharfun, &ch, 0);
@@ -2391,7 +2564,7 @@ read_list (flag, readcharfun)
                    {
                      /* Get a doc string from the file we are loading.
                         If it's in saved_doc_string, get it from there.  */
-                     int pos = XINT (XCONS (val)->cdr);
+                     int pos = XINT (XCDR (val));
                      /* Position is negative for user variables.  */
                      if (pos < 0) pos = -pos;
                      if (pos >= saved_doc_string_position
@@ -2471,7 +2644,7 @@ read_list (flag, readcharfun)
             ? pure_cons (elt, Qnil)
             : Fcons (elt, Qnil));
       if (!NILP (tail))
-       XCONS (tail)->cdr = tem;
+       XCDR (tail) = tem;
       else
        val = tem;
       tail = tem;
@@ -2769,8 +2942,6 @@ OBARRAY defaults to the value of `obarray'.")
   (function, obarray)
      Lisp_Object function, obarray;
 {
-  Lisp_Object tem;
-
   if (NILP (obarray)) obarray = Vobarray;
   obarray = check_obarray (obarray);
 
@@ -2872,6 +3043,7 @@ defvar_bool (namestring, address)
   XMISCTYPE (val) = Lisp_Misc_Boolfwd;
   XBOOLFWD (val)->boolvar = address;
   XSYMBOL (sym)->value = val;
+  Vbyte_boolean_vars = Fcons (sym, Vbyte_boolean_vars);
 }
 
 /* Similar but define a variable whose value is the Lisp Object stored
@@ -2961,11 +3133,6 @@ init_lread ()
   char *normal;
   int turn_off_warning = 0;
 
-#ifdef HAVE_SETLOCALE
-  /* Make sure numbers are parsed as we expect.  */
-  setlocale (LC_NUMERIC, "C");
-#endif /* HAVE_SETLOCALE */
-
   /* Compute the default load-path.  */
 #ifdef CANNOT_DUMP
   normal = PATH_LOADSEARCH;
@@ -3095,7 +3262,7 @@ init_lread ()
 
       for (path_tail = Vload_path;
           !NILP (path_tail);
-          path_tail = XCONS (path_tail)->cdr)
+          path_tail = XCDR (path_tail))
        {
          Lisp_Object dirfile;
          dirfile = Fcar (path_tail);
@@ -3104,7 +3271,7 @@ init_lread ()
              dirfile = Fdirectory_file_name (dirfile);
              if (access (XSTRING (dirfile)->data, 0) < 0)
                dir_warning ("Warning: Lisp directory `%s' does not exist.\n",
-                            XCONS (path_tail)->car);
+                            XCAR (path_tail));
            }
        }
     }
@@ -3182,7 +3349,7 @@ See documentation of `read' for possible values.");
     "*List of directories to search for files to load.\n\
 Each element is a string (directory name) or nil (try default directory).\n\
 Initialized based on EMACSLOADPATH environment variable, if any,\n\
-otherwise to default specified by file `paths.h' when Emacs was built.");
+otherwise to default specified by file `epaths.h' when Emacs was built.");
 
   DEFVAR_BOOL ("load-in-progress", &load_in_progress,
     "Non-nil iff inside of `load'.");
@@ -3211,6 +3378,10 @@ or variables, and cons cells `(provide . FEATURE)' and `(require . FEATURE)'.");
     "Full name of file being loaded by `load'.");
   Vload_file_name = Qnil;
 
+  DEFVAR_LISP ("user-init-file", &Vuser_init_file,
+    "File name, including directory, of user's initialization file.");
+  Vuser_init_file = Qnil;
+
   DEFVAR_LISP ("current-load-list", &Vcurrent_load_list,
     "Used for internal purposes by `load'.");
   Vcurrent_load_list = Qnil;
@@ -3251,6 +3422,10 @@ You cannot count on them to still be there!");
      "List of files that were preloaded (when dumping Emacs).");
   Vpreloaded_file_list = Qnil;
 
+  DEFVAR_LISP ("byte-boolean-vars", &Vbyte_boolean_vars,
+     "List of all DEFVAR_BOOL variables, used by the byte code optimizer.");
+  Vbyte_boolean_vars = Qnil;
+
   /* Vsource_directory was initialized in init_lread.  */
 
   load_descriptor_list = Qnil;
@@ -3296,4 +3471,6 @@ You cannot count on them to still be there!");
 
   staticpro (&read_objects);
   read_objects = Qnil;
+  staticpro (&seen_list);
+  
 }