declare smobs in alloc.c
[bpt/emacs.git] / src / lread.c
index f04b4fb..0d910d5 100644 (file)
@@ -39,6 +39,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "frame.h"
 #include "termhooks.h"
 #include "blockinput.h"
+#include "guile.h"
 
 #ifdef MSDOS
 #include "msdos.h"
@@ -1813,17 +1814,7 @@ readevalloop (Lisp_Object readcharfun,
   bool whole_buffer = 0;
   /* True on the first time around.  */
   bool first_sexp = 1;
-  Lisp_Object macroexpand = intern ("internal-macroexpand-for-load");
-
-  if (NILP (Ffboundp (macroexpand))
-      /* Don't macroexpand in .elc files, since it should have been done
-        already.  We actually don't know whether we're in a .elc file or not,
-        so we use circumstantial evidence: .el files normally go through
-        Vload_source_file_function -> load-with-code-conversion
-        -> eval-buffer.  */
-      || EQ (readcharfun, Qget_file_char)
-      || EQ (readcharfun, Qget_emacs_mule_file_char))
-    macroexpand = Qnil;
+  Lisp_Object compile_fn = 0;
 
   if (MARKERP (readcharfun))
     {
@@ -1952,14 +1943,7 @@ readevalloop (Lisp_Object readcharfun,
       /* Restore saved point and BEGV.  */
       dynwind_end ();
 
-      //scm_display (val, SCM_UNDEFINED);
-      //scm_newline (SCM_UNDEFINED);
-
-      /* Now eval what we just read.  */
-      if (!NILP (macroexpand))
-        val = readevalloop_eager_expand_eval (val, macroexpand);
-      else
-        val = eval_sub (val);
+      val = eval_sub (val);
 
       if (printflag)
        {
@@ -3903,19 +3887,34 @@ usage: (unintern NAME OBARRAY)  */)
   return (scm_is_true (scm_unintern (name, obhash (obarray))) ? Qt : Qnil);
 }
 \f
+struct map_obarray_data
+{
+  Lisp_Object obarray;
+  void (*fn) (Lisp_Object, Lisp_Object);
+  Lisp_Object arg;
+};
+
+static Lisp_Object
+map_obarray_inner (void *data, Lisp_Object sym)
+{
+  struct map_obarray_data *modata = data;
+
+  Lisp_Object tem = Ffind_symbol (SYMBOL_NAME (sym), modata->obarray);
+  if (scm_is_true (scm_c_value_ref (tem, 1))
+      && EQ (sym, scm_c_value_ref (tem, 0)))
+    modata->fn (sym, modata->arg);
+  return SCM_UNSPECIFIED;
+}
+
 void
 map_obarray (Lisp_Object obarray, void (*fn) (Lisp_Object, Lisp_Object), Lisp_Object arg)
 {
-  Lisp_Object proc (Lisp_Object sym)
-  {
-    Lisp_Object tem = Ffind_symbol (SYMBOL_NAME (sym), obarray);
-    if (scm_is_true (scm_c_value_ref (tem, 1))
-        && EQ (sym, scm_c_value_ref (tem, 0)))
-      fn (sym, arg);
-    return SCM_UNSPECIFIED;
-  }
+  struct map_obarray_data data = { .obarray = obarray,
+                                   .fn = fn,
+                                   .arg = arg };
+
   CHECK_VECTOR (obarray);
-  scm_obarray_for_each (scm_c_make_gsubr ("proc", 1, 0, 0, proc),
+  scm_obarray_for_each (make_c_closure (map_obarray_inner, &data, 1, 0),
                         obhash (obarray));
 }
 
@@ -4140,24 +4139,17 @@ load_path_default (void)
 {
   Lisp_Object lpath = Qnil;
   const char *normal;
+  bool initialized_or_cannot_dump;
 
 #ifdef CANNOT_DUMP
-#ifdef HAVE_NS
-  const char *loadpath = ns_load_path ();
-#endif
-
+  initialized_or_cannot_dump = true;
   normal = PATH_LOADSEARCH;
-#ifdef HAVE_NS
-  lpath = decode_env_path (0, loadpath ? loadpath : normal, 0);
 #else
-  lpath = decode_env_path (0, normal, 0);
-#endif
-
-#else  /* !CANNOT_DUMP */
-
+  initialized_or_cannot_dump = initialized;
   normal = NILP (Vpurify_flag) ? PATH_LOADSEARCH : PATH_DUMPLOADSEARCH;
+#endif
 
-  if (initialized)
+  if (initialized_or_cannot_dump)
     {
 #ifdef HAVE_NS
       const char *loadpath = ns_load_path ();
@@ -4251,7 +4243,7 @@ load_path_default (void)
 
         } /* if Vinstallation_directory */
     }
-  else                          /* !initialized */
+  else /* !initialized_or_cannot_dump */
     {
       /* NORMAL refers to PATH_DUMPLOADSEARCH, ie the lisp dir in the
          source directory.  We used to add ../lisp (ie the lisp dir in
@@ -4260,7 +4252,6 @@ load_path_default (void)
          for Makefile.  */
       lpath = decode_env_path (0, normal, 0);
     }
-#endif /* !CANNOT_DUMP */
 
   return lpath;
 }
@@ -4268,7 +4259,12 @@ load_path_default (void)
 void
 init_lread (void)
 {
-  /* First, set Vload_path.  */
+  /* Set Vsource_directory before calling load_path_default.  */
+  Vsource_directory
+    = Fexpand_file_name (build_string ("../"),
+                        Fcar (decode_env_path (0, PATH_DUMPLOADSEARCH, 0)));
+
+  /* Set Vload_path.  */
 
   /* Ignore EMACSLOADPATH when dumping.  */
 #ifdef CANNOT_DUMP
@@ -4435,8 +4431,7 @@ Initialized during startup as described in Info node `(elisp)Library Search'.  *
 This list should not include the empty string.
 `load' and related functions try to append these suffixes, in order,
 to the specified file name if a Lisp suffix is allowed or required.  */);
-  Vload_suffixes = list2 (build_pure_c_string (".elc"),
-                         build_pure_c_string (".el"));
+  Vload_suffixes = list1 (build_pure_c_string (".el"));
   DEFVAR_LISP ("load-file-rep-suffixes", Vload_file_rep_suffixes,
               doc: /* List of suffixes that indicate representations of \
 the same file.
@@ -4542,9 +4537,6 @@ and is not meant for users to change.  */);
   DEFVAR_LISP ("source-directory", Vsource_directory,
               doc: /* Directory in which Emacs sources were found when Emacs was built.
 You cannot count on them to still be there!  */);
-  Vsource_directory
-    = Fexpand_file_name (build_string ("../"),
-                        Fcar (decode_env_path (0, PATH_DUMPLOADSEARCH, 0)));
 
   DEFVAR_LISP ("preloaded-file-list", Vpreloaded_file_list,
               doc: /* List of files that were preloaded (when dumping Emacs).  */);