X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Femacs.c;h=90179ea42bf070a5e771a0ee0b5bb7a971863fe7;hb=b72024be0ea9f3018c978c7e63d241452ab74671;hp=abc8bfeea0a9692773727280232d2a8483588b0e;hpb=d8bd7eee3147c839d3c74d1823c139cd54867a75;p=chise%2Fxemacs-chise.git- diff --git a/src/emacs.c b/src/emacs.c index abc8bfe..90179ea 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -342,15 +342,19 @@ unsigned int lim_data; Some LISP-visible command-line options are set by XEmacs _before_ the data is dumped in building a --pdump XEmacs, but used _after_ it is - restored in normal operation. Thus the restored values overwrite the - values XEmacs is getting at run-time. Such variables must be saved + restored in normal operation. Thus the dump-time values overwrite the + values XEmacs is getting at runtime. Such variables must be saved before loading the dumpfile, and restored afterward. - This is done immediately before and after pdump_load() in main_1(). - See that function for the current list of protected variables. + Therefore these variables may not be initialized in vars_of_emacs(). - Note that if the variable is never DEFVAR'd, saving/restoring is not - needed. + The save/restore is done immediately before and after pdump_load() in + main_1(). See that function for the current list of protected variables. + + Note that saving/restoring is only necessary for a few variables that are + o command line arguments effective at runtime (as opposed to dump-time), + o parsed before pdump_load, and + o exported to Lisp via a DEFVAR. */ /* Nonzero means running XEmacs without interactive terminal. */ @@ -385,8 +389,8 @@ int nodumpfile; int debug_paths; /* Save argv and argc. */ -static Extbyte **initial_argv; -static int initial_argc; +static Extbyte **initial_argv; /* #### currently unused */ +static int initial_argc; /* #### currently unused */ static void sort_args (int argc, char **argv); @@ -821,7 +825,22 @@ argmatch (char **argv, int argc, char *sstr, char *lstr, #define main_1 STACK_TRACE_EYE_CATCHER /* This function is not static, so that the compiler is less likely to - inline it, which would make it not show up in stack traces. */ + inline it, which would make it not show up in stack traces. + + The restart argument is a flag that indicates that main_1 is now + being called for the second time in this invocation of xemacs; this can + only happen in an xemacs that is not loaded with dumped data (temacs + with the conventional dumper or xemacs -nd with the pdumper). See + Frun_emacs_from_temacs(). + + restart interacts with initialized as follows (per Olivier Galibert): + + It's perverted. + + initialized==0 => temacs + initialized!=0 && restart!=0 => run-temacs + initialized!=0 && restart==0 => xemacs/post pdump_load() +*/ DECLARE_DOESNT_RETURN (main_1 (int, char **, char **, int)); DOESNT_RETURN main_1 (int argc, char **argv, char **envp, int restart) @@ -930,7 +949,7 @@ main_1 (int argc, char **argv, char **envp, int restart) #ifdef PDUMP printf ("%08x\n", dump_id); #else - printf ("*ERROR**\n"); + printf ("Portable dumper not configured; -sd just forces exit.\n"); #endif exit (0); } @@ -1149,17 +1168,13 @@ main_1 (int argc, char **argv, char **envp, int restart) Boy, this is ugly, but how else to do it? */ - /* noninteractive1 is protected by noninteractive, which is not - LISP-visible */ + /* noninteractive1 is saved in noninteractive, which isn't LISP-visible */ int inhibit_early_packages_save = inhibit_early_packages; int inhibit_autoloads_save = inhibit_autoloads; int debug_paths_save = debug_paths; -#ifdef INHIBIT_SITE_LISP - int inhibit_site_lisp_save = inhibit_site_lisp; -#endif -#ifdef INHIBIT_SITE_MODULES + /* #### Give inhibit-site-lisp a command switch? If so, uncomment: */ + /* int inhibit_site_lisp_save = inhibit_site_lisp; */ int inhibit_site_modules_save = inhibit_site_modules; -#endif initialized = pdump_load (argv[0]); @@ -1168,12 +1183,9 @@ main_1 (int argc, char **argv, char **envp, int restart) inhibit_early_packages = inhibit_early_packages_save; inhibit_autoloads = inhibit_autoloads_save; debug_paths = debug_paths_save; -#ifdef INHIBIT_SITE_LISP - inhibit_site_lisp = inhibit_site_lisp_save; -#endif -#ifdef INHIBIT_SITE_MODULES + /* #### Give inhibit-site-lisp a command switch? If so, uncomment: */ + /* inhibit_site_lisp = inhibit_site_lisp_save; */ inhibit_site_modules = inhibit_site_modules_save; -#endif if (initialized) run_temacs_argc = -1; @@ -1625,6 +1637,11 @@ main_1 (int argc, char **argv, char **envp, int restart) make_opaque_ptr() perhaps a few others. + + NB: Initialization or assignment should not be done here to certain + variables settable from the command line. See the comment above + the call to pdump_load() in main_1(). This caveat should only + apply to vars_of_emacs(). */ /* Now allow Fprovide() statements to be made. */ @@ -1678,6 +1695,9 @@ main_1 (int argc, char **argv, char **envp, int restart) vars_of_extents (); vars_of_faces (); vars_of_fileio (); +#ifdef CLASH_DETECTION + vars_of_filelock (); +#endif vars_of_floatfns (); vars_of_font_lock (); vars_of_frame (); @@ -1966,7 +1986,7 @@ main_1 (int argc, char **argv, char **envp, int restart) } #endif #ifdef PDUMP - } else if (!restart) { + } else if (!restart) { /* after successful pdump_load() */ reinit_alloc_once_early (); reinit_symbols_once_early (); reinit_opaque_once_early (); @@ -2082,13 +2102,18 @@ main_1 (int argc, char **argv, char **envp, int restart) if (initialized) { - /* Stuff that needs to be reset at run time. Order below should - not matter. */ + /* Stuff that should not be done at dump time, including stuff that + needs to be reset at run time. Order below should not matter. + + Many initializations taken from the environment should go here. */ reinit_alloc (); reinit_eval (); #ifdef MULE_REGEXP reinit_mule_category (); #endif +#ifdef HAVE_POSTGRESQL + init_postgresql_from_environment(); +#endif } /* Now do further initialization/setup of stuff that is not needed by the @@ -2912,13 +2937,13 @@ Remember to set `command-line-processed' to nil before dumping if you want the dumped XEmacs to process its command line and announce itself normally when it is run. */ - (intoname, symname)) + (filename, symfile)) { /* This function can GC */ struct gcpro gcpro1, gcpro2; int opurify; - GCPRO2 (intoname, symname); + GCPRO2 (filename, symfile); #ifdef FREE_CHECKING Freally_free (Qnil); @@ -2927,15 +2952,15 @@ and announce itself normally when it is run. disable_free_hook (); #endif - CHECK_STRING (intoname); - intoname = Fexpand_file_name (intoname, Qnil); - if (!NILP (symname)) + CHECK_STRING (filename); + filename = Fexpand_file_name (filename, Qnil); + if (!NILP (symfile)) { - CHECK_STRING (symname); - if (XSTRING_LENGTH (symname) > 0) - symname = Fexpand_file_name (symname, Qnil); + CHECK_STRING (symfile); + if (XSTRING_LENGTH (symfile) > 0) + symfile = Fexpand_file_name (symfile, Qnil); else - symname = Qnil; + symfile = Qnil; } opurify = purify_flag; @@ -2962,15 +2987,15 @@ and announce itself normally when it is run. UNGCPRO; { - char *intoname_ext; - char *symname_ext; + char *filename_ext; + char *symfile_ext; - LISP_STRING_TO_EXTERNAL (intoname, intoname_ext, Qfile_name); + LISP_STRING_TO_EXTERNAL (filename, filename_ext, Qfile_name); - if (STRINGP (symname)) - LISP_STRING_TO_EXTERNAL (symname, symname_ext, Qfile_name); + if (STRINGP (symfile)) + LISP_STRING_TO_EXTERNAL (symfile, symfile_ext, Qfile_name); else - symname_ext = 0; + symfile_ext = 0; garbage_collect_1 (); @@ -2987,7 +3012,7 @@ and announce itself normally when it is run. modify all the unexec routines to ensure that filename conversion is applied everywhere. Don't worry about memory leakage because this call only happens once. */ - unexec (intoname_ext, symname_ext, (uintptr_t) my_edata, 0, 0); + unexec (filename_ext, symfile_ext, (uintptr_t) my_edata, 0, 0); #ifdef DOUG_LEA_MALLOC free (malloc_state_ptr); #endif @@ -3372,7 +3397,34 @@ Codename of this version of Emacs (a string). #ifndef XEMACS_CODENAME #define XEMACS_CODENAME "Noname" #endif +#ifdef MULE + { + char dest[129]; + char src[64] = XEMACS_CODENAME; + unsigned char* sp = (unsigned char*)src; + int i = 0, chr; + + while ( (chr = *sp++) && (i < 128) ) + { + if (chr <= 0x7F) + dest[i++] = chr; + else + { +#ifdef UTF2000 + dest[i++] = (chr >> 6) | 0xC0; + dest[i++] = (chr & 0x3F) | 0x80; +#else + dest[i++] = LEADING_BYTE_LATIN_ISO8859_1; + dest[i++] = chr; +#endif + } + } + dest[i] = 0; + Vxemacs_codename = build_string (dest); + } +#else Vxemacs_codename = build_string (XEMACS_CODENAME); +#endif /* Lisp variables which contain command line flags. @@ -3521,7 +3573,7 @@ This is mainly meant for use in path searching. DEFVAR_LISP ("emacs-program-version", &Vemacs_program_version /* *Version of the Emacs variant. -This typically has the form XX.XX[-bXX]. +This typically has the form NN.NN-bNN. This is mainly meant for use in path searching. */ ); Vemacs_program_version = build_string ((char *) PATH_VERSION); @@ -3540,7 +3592,7 @@ especially executable programs intended for XEmacs to invoke. DEFVAR_LISP ("configure-exec-directory", &Vconfigure_exec_directory /* For internal use by the build procedure only. -configure's idea of what EXEC-DIRECTORY will be. +configure's idea of what `exec-directory' will be. */ ); #ifdef PATH_EXEC Vconfigure_exec_directory = Ffile_name_as_directory @@ -3556,7 +3608,7 @@ configure's idea of what EXEC-DIRECTORY will be. DEFVAR_LISP ("configure-lisp-directory", &Vconfigure_lisp_directory /* For internal use by the build procedure only. -configure's idea of what LISP-DIRECTORY will be. +configure's idea of what `lisp-directory' will be. */ ); #ifdef PATH_LOADSEARCH Vconfigure_lisp_directory = Ffile_name_as_directory @@ -3572,7 +3624,7 @@ configure's idea of what LISP-DIRECTORY will be. DEFVAR_LISP ("configure-module-directory", &Vconfigure_module_directory /* For internal use by the build procedure only. -configure's idea of what MODULE-DIRECTORY will be. +configure's idea of what `module-directory' will be. */ ); #ifdef PATH_MODULESEARCH Vconfigure_module_directory = Ffile_name_as_directory @@ -3602,7 +3654,7 @@ functions `locate-data-file' and `locate-data-directory' and the variable DEFVAR_LISP ("configure-data-directory", &Vconfigure_data_directory /* For internal use by the build procedure only. -configure's idea of what DATA-DIRECTORY will be. +configure's idea of what `data-directory' will be. */ ); #ifdef PATH_DATA Vconfigure_data_directory = Ffile_name_as_directory @@ -3624,7 +3676,7 @@ or were installed as packages, and are intended for XEmacs to use. DEFVAR_LISP ("configure-site-directory", &Vconfigure_site_directory /* For internal use by the build procedure only. -configure's idea of what SITE-DIRECTORY will be. +configure's idea of what `site-directory' will be. */ ); #ifdef PATH_SITE Vconfigure_site_directory = Ffile_name_as_directory @@ -3640,7 +3692,7 @@ configure's idea of what SITE-DIRECTORY will be. DEFVAR_LISP ("configure-site-module-directory", &Vconfigure_site_module_directory /* For internal use by the build procedure only. -configure's idea of what SITE-DIRECTORY will be. +configure's idea of what `site-directory' will be. */ ); #ifdef PATH_SITE_MODULES Vconfigure_site_module_directory = Ffile_name_as_directory @@ -3651,13 +3703,13 @@ configure's idea of what SITE-DIRECTORY will be. DEFVAR_LISP ("doc-directory", &Vdoc_directory /* *Directory containing the DOC file that comes with XEmacs. -This is usually the same as exec-directory. +This is usually the same as `exec-directory'. */ ); Vdoc_directory = Qnil; DEFVAR_LISP ("configure-doc-directory", &Vconfigure_doc_directory /* For internal use by the build procedure only. -configure's idea of what DOC-DIRECTORY will be. +configure's idea of what `doc-directory' will be. */ ); #ifdef PATH_DOC Vconfigure_doc_directory = Ffile_name_as_directory @@ -3668,7 +3720,7 @@ configure's idea of what DOC-DIRECTORY will be. DEFVAR_LISP ("configure-exec-prefix-directory", &Vconfigure_exec_prefix_directory /* For internal use by the build procedure only. -configure's idea of what EXEC-PREFIX-DIRECTORY will be. +configure's idea of what `exec-prefix-directory' will be. */ ); #ifdef PATH_EXEC_PREFIX Vconfigure_exec_prefix_directory = Ffile_name_as_directory @@ -3679,7 +3731,7 @@ configure's idea of what EXEC-PREFIX-DIRECTORY will be. DEFVAR_LISP ("configure-prefix-directory", &Vconfigure_prefix_directory /* For internal use by the build procedure only. -configure's idea of what PREFIX-DIRECTORY will be. +configure's idea of what `prefix-directory' will be. */ ); #ifdef PATH_PREFIX Vconfigure_prefix_directory = Ffile_name_as_directory @@ -3718,8 +3770,9 @@ The configured initial path for info documentation. * cores on us when re-started from the dumped executable. * This will have to go for 21.1 -- OG. */ -void __sti__iflPNGFile_c___(void); -void __sti__iflPNGFile_c___() +void __sti__iflPNGFile_c___ (void); +void +__sti__iflPNGFile_c___ (void) { }