comparison src/emacs.c @ 446:1ccc32a20af4 r21-2-38

Import from CVS: tag r21-2-38
author cvs
date Mon, 13 Aug 2007 11:37:21 +0200
parents 576fb035e263
children e7ef97881643
comparison
equal deleted inserted replaced
445:34f3776fcf0e 446:1ccc32a20af4
340 340
341 /* WARNING! 341 /* WARNING!
342 342
343 Some LISP-visible command-line options are set by XEmacs _before_ the 343 Some LISP-visible command-line options are set by XEmacs _before_ the
344 data is dumped in building a --pdump XEmacs, but used _after_ it is 344 data is dumped in building a --pdump XEmacs, but used _after_ it is
345 restored in normal operation. Thus the restored values overwrite the 345 restored in normal operation. Thus the dump-time values overwrite the
346 values XEmacs is getting at run-time. Such variables must be saved 346 values XEmacs is getting at runtime. Such variables must be saved
347 before loading the dumpfile, and restored afterward. 347 before loading the dumpfile, and restored afterward.
348 348
349 This is done immediately before and after pdump_load() in main_1(). 349 Therefore these variables may not be initialized in vars_of_emacs().
350 See that function for the current list of protected variables. 350
351 351 The save/restore is done immediately before and after pdump_load() in
352 Note that if the variable is never DEFVAR'd, saving/restoring is not 352 main_1(). See that function for the current list of protected variables.
353 needed. 353
354 Note that saving/restoring is only necessary for a few variables that are
355 o command line arguments effective at runtime (as opposed to dump-time),
356 o parsed before pdump_load, and
357 o exported to Lisp via a DEFVAR.
354 */ 358 */
355 359
356 /* Nonzero means running XEmacs without interactive terminal. */ 360 /* Nonzero means running XEmacs without interactive terminal. */
357 361
358 int noninteractive; 362 int noninteractive;
819 823
820 /* Make stack traces always identify version + configuration */ 824 /* Make stack traces always identify version + configuration */
821 #define main_1 STACK_TRACE_EYE_CATCHER 825 #define main_1 STACK_TRACE_EYE_CATCHER
822 826
823 /* This function is not static, so that the compiler is less likely to 827 /* This function is not static, so that the compiler is less likely to
824 inline it, which would make it not show up in stack traces. */ 828 inline it, which would make it not show up in stack traces.
829
830 The restart argument is a flag that indicates that main_1 is now
831 being called for the second time in this invocation of xemacs; this can
832 only happen in an xemacs that is not loaded with dumped data (temacs
833 with the conventional dumper or xemacs -nd with the pdumper). See
834 Frun_emacs_from_temacs().
835
836 restart interacts with initialized as follows (per Olivier Galibert):
837
838 It's perverted.
839
840 initialized==0 => temacs
841 initialized!=0 && restart!=0 => run-temacs
842 initialized!=0 && restart==0 => xemacs/post pdump_load()
843 */
825 DECLARE_DOESNT_RETURN (main_1 (int, char **, char **, int)); 844 DECLARE_DOESNT_RETURN (main_1 (int, char **, char **, int));
826 DOESNT_RETURN 845 DOESNT_RETURN
827 main_1 (int argc, char **argv, char **envp, int restart) 846 main_1 (int argc, char **argv, char **envp, int restart)
828 { 847 {
829 char stack_bottom_variable; 848 char stack_bottom_variable;
928 if (argmatch (argv, argc, "-sd", "--show-dump-id", 9, NULL, &skip_args)) 947 if (argmatch (argv, argc, "-sd", "--show-dump-id", 9, NULL, &skip_args))
929 { 948 {
930 #ifdef PDUMP 949 #ifdef PDUMP
931 printf ("%08x\n", dump_id); 950 printf ("%08x\n", dump_id);
932 #else 951 #else
933 printf ("*ERROR**\n"); 952 printf ("Portable dumper not configured; -sd just forces exit.\n");
934 #endif 953 #endif
935 exit (0); 954 exit (0);
936 } 955 }
937 956
938 /* Handle the -t switch, which specifies filename to use as terminal */ 957 /* Handle the -t switch, which specifies filename to use as terminal */
1147 and restored after loading the dumped data. 1166 and restored after loading the dumped data.
1148 1167
1149 Boy, this is ugly, but how else to do it? 1168 Boy, this is ugly, but how else to do it?
1150 */ 1169 */
1151 1170
1152 /* noninteractive1 is protected by noninteractive, which is not 1171 /* noninteractive1 is saved in noninteractive, which isn't LISP-visible */
1153 LISP-visible */
1154 int inhibit_early_packages_save = inhibit_early_packages; 1172 int inhibit_early_packages_save = inhibit_early_packages;
1155 int inhibit_autoloads_save = inhibit_autoloads; 1173 int inhibit_autoloads_save = inhibit_autoloads;
1156 int debug_paths_save = debug_paths; 1174 int debug_paths_save = debug_paths;
1157 #ifdef INHIBIT_SITE_LISP 1175 /* #### Give inhibit-site-lisp a command switch? If so, uncomment: */
1158 int inhibit_site_lisp_save = inhibit_site_lisp; 1176 /* int inhibit_site_lisp_save = inhibit_site_lisp; */
1159 #endif
1160 #ifdef INHIBIT_SITE_MODULES
1161 int inhibit_site_modules_save = inhibit_site_modules; 1177 int inhibit_site_modules_save = inhibit_site_modules;
1162 #endif
1163 1178
1164 initialized = pdump_load (argv[0]); 1179 initialized = pdump_load (argv[0]);
1165 1180
1166 /* Now unstomp everything */ 1181 /* Now unstomp everything */
1167 noninteractive1 = noninteractive; 1182 noninteractive1 = noninteractive;
1168 inhibit_early_packages = inhibit_early_packages_save; 1183 inhibit_early_packages = inhibit_early_packages_save;
1169 inhibit_autoloads = inhibit_autoloads_save; 1184 inhibit_autoloads = inhibit_autoloads_save;
1170 debug_paths = debug_paths_save; 1185 debug_paths = debug_paths_save;
1171 #ifdef INHIBIT_SITE_LISP 1186 /* #### Give inhibit-site-lisp a command switch? If so, uncomment: */
1172 inhibit_site_lisp = inhibit_site_lisp_save; 1187 /* inhibit_site_lisp = inhibit_site_lisp_save; */
1173 #endif
1174 #ifdef INHIBIT_SITE_MODULES
1175 inhibit_site_modules = inhibit_site_modules_save; 1188 inhibit_site_modules = inhibit_site_modules_save;
1176 #endif
1177 1189
1178 if (initialized) 1190 if (initialized)
1179 run_temacs_argc = -1; 1191 run_temacs_argc = -1;
1180 else 1192 else
1181 purify_flag = 1; 1193 purify_flag = 1;
1623 Fcons() 1635 Fcons()
1624 listN() 1636 listN()
1625 make_opaque_ptr() 1637 make_opaque_ptr()
1626 1638
1627 perhaps a few others. 1639 perhaps a few others.
1640
1641 NB: Initialization or assignment should not be done here to certain
1642 variables settable from the command line. See the comment above
1643 the call to pdump_load() in main_1(). This caveat should only
1644 apply to vars_of_emacs().
1628 */ 1645 */
1629 1646
1630 /* Now allow Fprovide() statements to be made. */ 1647 /* Now allow Fprovide() statements to be made. */
1631 init_provide_once (); 1648 init_provide_once ();
1632 1649
1967 if (always_gc) /* purification debugging hack */ 1984 if (always_gc) /* purification debugging hack */
1968 garbage_collect_1 (); 1985 garbage_collect_1 ();
1969 } 1986 }
1970 #endif 1987 #endif
1971 #ifdef PDUMP 1988 #ifdef PDUMP
1972 } else if (!restart) { 1989 } else if (!restart) { /* after successful pdump_load() */
1973 reinit_alloc_once_early (); 1990 reinit_alloc_once_early ();
1974 reinit_symbols_once_early (); 1991 reinit_symbols_once_early ();
1975 reinit_opaque_once_early (); 1992 reinit_opaque_once_early ();
1976 1993
1977 reinit_console_type_create_stream (); 1994 reinit_console_type_create_stream ();
2083 /* CONGRATULATIONS!!! We have successfully initialized the Lisp 2100 /* CONGRATULATIONS!!! We have successfully initialized the Lisp
2084 engine. */ 2101 engine. */
2085 2102
2086 if (initialized) 2103 if (initialized)
2087 { 2104 {
2088 /* Stuff that needs to be reset at run time. Order below should 2105 /* Stuff that should not be done at dump time, including stuff that
2089 not matter. */ 2106 needs to be reset at run time. Order below should not matter.
2107
2108 Many initializations taken from the environment should go here. */
2090 reinit_alloc (); 2109 reinit_alloc ();
2091 reinit_eval (); 2110 reinit_eval ();
2092 #ifdef MULE_REGEXP 2111 #ifdef MULE_REGEXP
2093 reinit_mule_category (); 2112 reinit_mule_category ();
2113 #endif
2114 #ifdef HAVE_POSTGRESQL
2115 init_postgresql_from_environment();
2094 #endif 2116 #endif
2095 } 2117 }
2096 2118
2097 /* Now do further initialization/setup of stuff that is not needed by the 2119 /* Now do further initialization/setup of stuff that is not needed by the
2098 syms_of_() routines. This involves stuff that only is enabled in 2120 syms_of_() routines. This involves stuff that only is enabled in
3719 * The target is to override the static constructor from the 3741 * The target is to override the static constructor from the
3720 * libiflPNG.so library which is masquerading as libz, and 3742 * libiflPNG.so library which is masquerading as libz, and
3721 * cores on us when re-started from the dumped executable. 3743 * cores on us when re-started from the dumped executable.
3722 * This will have to go for 21.1 -- OG. 3744 * This will have to go for 21.1 -- OG.
3723 */ 3745 */
3724 void __sti__iflPNGFile_c___(void); 3746 void __sti__iflPNGFile_c___ (void);
3725 void __sti__iflPNGFile_c___() 3747 void
3748 __sti__iflPNGFile_c___ (void)
3726 { 3749 {
3727 } 3750 }
3728 3751
3729 #endif 3752 #endif