X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/fe6aa7a1f05e241a438ca3fa85969b7381d89a0e..d1c3da7b87087d7da58128aaf84afaeaeae971eb:/src/emacs.c diff --git a/src/emacs.c b/src/emacs.c index 1a4444211f..9e12a7c4f8 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -107,6 +107,10 @@ extern void moncontrol (int mode); #include #endif +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; static const char emacs_bugreport[] = PACKAGE_BUGREPORT; @@ -390,7 +394,7 @@ init_cmdargs (int argc, char **argv, int skip_args, char *original_pwd) { register int i; Lisp_Object name, dir, handler; - ptrdiff_t count = SPECPDL_INDEX (); + dynwind_begin (); Lisp_Object raw_name; initial_argv = argv; @@ -549,7 +553,7 @@ init_cmdargs (int argc, char **argv, int skip_args, char *original_pwd) = Fcons (build_unibyte_string (argv[i]), Vcommand_line_args); } - unbind_to (count, Qnil); + dynwind_end (); } DEFUN ("invocation-name", Finvocation_name, Sinvocation_name, 0, 0, 0, @@ -696,9 +700,29 @@ close_output_streams (void) _exit (EXIT_FAILURE); } -/* ARGSUSED */ +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); +} + +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); +} + +/* ARGSUSED */ +static int +main2 (void *ignore, int argc, char **argv) { bool do_initial_setlocale; bool dumping; @@ -766,10 +790,6 @@ main (int argc, char **argv) atexit (close_output_streams); - /* Override Guile's libgc configuration. */ - xputenv ("GC_ALL_INTERIOR_POINTERS=1"); - scm_init_guile (); - sort_args (argc, argv); argc = 0; while (argv[argc]) argc++; @@ -1158,7 +1178,23 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem if (!initialized) { + /* 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 lexer"), + "make-lisp-string", + scm_c_make_gsubr ("make-lisp-string", 1, 0, 0, + string_from_scheme)); + init_guile (); + init_fns_once (); init_obarray (); init_eval_once (); init_charset_once (); @@ -1170,6 +1206,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 @@ -1184,8 +1234,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. */ @@ -2026,7 +2074,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 @@ -2070,7 +2117,7 @@ You must run Emacs in batch mode in order to dump it. */) { Lisp_Object tem; Lisp_Object symbol; - ptrdiff_t count = SPECPDL_INDEX (); + dynwind_begin (); check_pure_size (); @@ -2160,7 +2207,8 @@ You must run Emacs in batch mode in order to dump it. */) Vpurify_flag = tem; - return unbind_to (count, Qnil); + dynwind_end (); + return Qnil; } #endif /* not CANNOT_DUMP */