disable GC_all_interior_pointers
[bpt/emacs.git] / src / emacs.c
index f013bbf..4777044 100644 (file)
@@ -109,6 +109,7 @@ extern void moncontrol (int mode);
 
 Lisp_Object symbol_module;
 Lisp_Object function_module;
+Lisp_Object plist_module;
 
 static const char emacs_version[] = PACKAGE_VERSION;
 static const char emacs_copyright[] = COPYRIGHT;
@@ -699,13 +700,24 @@ close_output_streams (void)
      _exit (EXIT_FAILURE);
 }
 
+static Lisp_Object
+string_from_scheme (Lisp_Object scheme_string)
+{
+  size_t nbytes;
+  char *c_string = scm_to_utf8_stringn (scheme_string, &nbytes);
+  return make_string_from_bytes (c_string,
+                                 scm_c_string_length (scheme_string),
+                                 nbytes);
+}
+
+Lisp_Object xsymbol_fn;
+Lisp_Object symbol_function_fn;
+
 static int main2 (void *, int, char **);
 
 int
 main (int argc, char **argv)
 {
-  /* Override Guile's libgc configuration. */
-  xputenv ("GC_ALL_INTERIOR_POINTERS=1");
   scm_boot_guile (argc, argv, main2, NULL);
 }
 
@@ -1167,17 +1179,29 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
 
   if (!initialized)
     {
-      symbol_module = scm_call (scm_c_public_ref ("guile", "define-module*"),
-                                scm_list_1 (scm_from_utf8_symbol ("elisp-symbols")),
-                                scm_from_locale_keyword ("pure"),
-                                SCM_BOOL_T,
-                                SCM_UNDEFINED);
-      function_module = scm_call (scm_c_public_ref ("guile", "define-module*"),
-                                  scm_list_1 (scm_from_utf8_symbol ("elisp-functions")),
-                                  scm_from_locale_keyword ("pure"),
-                                  SCM_BOOL_T,
-                                  SCM_UNDEFINED);
+      /* scm_c_module_define (scm_c_resolve_module ("language elisp lexer"), */
+      /*                      "make-lisp-string", */
+      /*                      scm_c_make_gsubr ("make-lisp-string", 1, 0, 0, */
+      /*                                        string_from_scheme)); */
+      (void *) scm_c_resolve_module ("language elisp spec");
+      symbol_module = scm_c_resolve_module ("elisp-symbols");
+      function_module = scm_c_resolve_module ("elisp-functions");
+      plist_module = scm_c_resolve_module ("elisp-plists");
+      scm_set_current_module (scm_c_resolve_module ("guile-user"));
+
       init_alloc_once ();
+
+      scm_c_module_define (scm_c_resolve_module ("language elisp runtime"),
+                           "make-lisp-string",
+                           scm_c_make_gsubr ("make-lisp-string", 1, 0, 0,
+                                             string_from_scheme));
+      scm_c_module_define (scm_c_resolve_module ("language elisp runtime"),
+                           "lisp-string?",
+                           scm_c_make_gsubr ("stringp", 1, 0, 0, Fstringp));
+
+      xsymbol_fn = scm_c_public_ref ("language elisp runtime", "symbol-desc");
+      symbol_function_fn = scm_c_public_ref ("language elisp runtime", "symbol-function");
+
       init_guile ();
       init_fns_once ();
       init_obarray ();
@@ -1191,6 +1215,20 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
       init_minibuf_once ();    /* Create list of minibuffers.  */
                                /* Must precede init_window_once.  */
 
+      /* Called before syms_of_fileio, because it sets up
+         Qerror_condition.  Called before other symbol-initialization
+         functions because it sets up symbols used by defsubr.  */
+      syms_of_data ();
+
+      scm_call_7 (scm_c_public_ref ("language elisp runtime", "emacs!"),
+                  SYMBOL_FUNCTION (intern ("symbol-value")),
+                  SYMBOL_FUNCTION (intern ("set")),
+                  SYMBOL_FUNCTION (intern ("boundp")),
+                  SYMBOL_FUNCTION (intern ("default-value")),
+                  SYMBOL_FUNCTION (intern ("set-default")),
+                  SYMBOL_FUNCTION (intern ("default-boundp")),
+                  SYMBOL_FUNCTION (intern ("bind-symbol")));
+
       /* Call syms_of_xfaces before init_window_once because that
         function creates Vterminal_frame.  Termcap frames now use
         faces, and the face implementation uses some symbols as
@@ -1205,8 +1243,6 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
         CANNOT_DUMP is defined.  */
       syms_of_keyboard ();
 
-      /* Called before syms_of_fileio, because it sets up Qerror_condition.  */
-      syms_of_data ();
       syms_of_fns ();     /* Before syms_of_charset which uses hashtables.  */
       syms_of_fileio ();
       /* Before syms_of_coding to initialize Vgc_cons_threshold.  */
@@ -1426,7 +1462,6 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
       syms_of_floatfns ();
 
       syms_of_buffer ();
-      syms_of_bytecode ();
       syms_of_callint ();
       syms_of_casefiddle ();
       syms_of_casetab ();
@@ -1544,8 +1579,6 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
 #endif /* HAVE_W32NOTIFY */
 #endif /* WINDOWSNT */
 
-      syms_of_profiler ();
-
       keys_of_casefiddle ();
       keys_of_cmds ();
       keys_of_buffer ();
@@ -2047,7 +2080,6 @@ shut_down_emacs (int sig, Lisp_Object stuff)
 
   /* There is a tendency for a SIGIO signal to arrive within exit,
      and cause a SIGHUP because the input descriptor is already closed.  */
-  unrequest_sigio ();
   ignore_sigio ();
 
   /* Do this only if terminating normally, we want glyph matrices