Mercurial > hg > xemacs-beta
comparison src/emacs.c @ 814:a634e3b7acc8
[xemacs-hg @ 2002-04-14 12:41:59 by ben]
latest changes
TODO.ben-mule-21-5: Update.
make-docfile.c: Add basic support for handling ISO 2022 doc strings -- we parse
the basic charset designation sequences so we know whether we're
in ASCII and have to pay attention to end quotes and such.
Reformat code according to coding standards.
abbrev.el: Add `global-abbrev-mode', which turns on or off abbrev-mode in all
buffers. Added `defining-abbrev-turns-on-abbrev-mode' -- if
non-nil, defining an abbrev through an interactive function will
automatically turn on abbrev-mode, either globally or locally
depending on the command. This is the "what you'd expect"
behavior.
indent.el: general function for indenting a balanced expression in a
mode-correct way. Works similar to indent-region in that a mode
can specify a specific command to do the whole operation; if not,
figure out the region using forward-sexp and indent each line
using indent-according-to-mode.
keydefs.el: Removed.
Modify M-C-backslash to do indent-region-or-balanced-expression.
Make S-Tab just insert a TAB char, like it's meant to do.
make-docfile.el: Now that we're using the call-process-in-lisp, we need to load
an extra file win32-native.el because we're running a bare temacs.
menubar-items.el: Totally redo the Cmds menu so that most used commands appear
directly on the menu and less used commands appear in submenus.
The old way may have been very pretty, but rather impractical.
process.el: Under Windows, don't ever use old-call-process-internal, even
in batch mode. We can do processes in batch mode.
subr.el: Someone recoded truncate-string-to-width, saying "the FSF version
is too complicated and does lots of hard-to-understand stuff" but
the resulting recoded version was *totally* wrong! it
misunderstood the basic point of this function, which is work in
*columns* not chars. i dumped ours and copied the version from
FSF 21.1. Also added truncate-string-with-continuation-dots,
since this idiom is used often.
config.inc.samp, xemacs.mak: Separate out debug and optimize flags.
Remove all vestiges of USE_MINIMAL_TAGBITS,
USE_INDEXED_LRECORD_IMPLEMENTATION, and GUNG_HO, since those
ifdefs have long been removed.
Make error-checking support actually work.
Some rearrangement of config.inc.samp to make it more logical.
Remove callproc.c and ntproc.c from xemacs.mak, no longer used.
Make pdump the default.
lisp.h: Add support for strong type-checking of Bytecount, Bytebpos,
Charcount, Charbpos, and others, by making them classes,
overloading the operators to provide integer-like operation and
carefully controlling what operations are allowed. Not currently
enabled in C++ builds because there are still a number of compile
errors, and it won't really work till we merge in my "8-bit-Mule"
workspace, in which I make use of the new types Charxpos,
Bytexpos, Memxpos, representing a "position" either in a buffer or
a string. (This is especially important in the extent code.)
abbrev.c, alloc.c, eval.c, buffer.c, buffer.h, editfns.c, fns.c, text.h: Warning fixes, some of them related to new C++ strict type
checking of Bytecount, Charbpos, etc.
dired.c: Caught an actual error due to strong type checking -- char len
being passed when should be byte len.
alloc.c, backtrace.h, bytecode.c, bytecode.h, eval.c, sysdep.c: Further optimize Ffuncall:
-- process arg list at compiled-function creation time, converting
into an array for extra-quick access at funcall time.
-- rewrite funcall_compiled_function to use it, and inline this
function.
-- change the order of check for magic stuff in
SPECBIND_FAST_UNSAFE to be faster.
-- move the check for need to garbage collect into the allocation
code, so only a single flag needs to be checked in funcall.
buffer.c, symbols.c: add debug funs to check on mule optimization info in buffers and
strings.
eval.c, emacs.c, text.c, regex.c, scrollbar-msw.c, search.c: Fix evil crashes due to eistrings not properly reinitialized under
pdump. Redo a bit some of the init routines; convert some
complex_vars_of() into simple vars_of(), because they didn't need
complex processing.
callproc.c, emacs.c, event-stream.c, nt.c, process.c, process.h, sysdep.c, sysdep.h, syssignal.h, syswindows.h, ntproc.c: Delete. Hallelujah, praise the Lord, there is no god
but Allah!!!
fix so that processes can be invoked in bare temacs -- thereby
eliminating any need for callproc.c. (currently only eliminated
under NT.) remove all crufty and unnecessary old process code in
ntproc.c and elsewhere. move non-callproc-specific stuff (mostly
environment) into process.c, so callproc.c can be left out under
NT.
console-tty.c, doc.c, file-coding.c, file-coding.h, lstream.c, lstream.h: fix doc string handling so it works with Japanese, etc docs.
change handling of "character mode" so callers don't have to
manually set it (quite error-prone).
event-msw.c: spacing fixes.
lread.c: eliminate unused crufty vintage-19 "FSF defun hack" code.
lrecord.h: improve pdump description docs.
buffer.c, ntheap.c, unexnt.c, win32.c, emacs.c: Mule-ize some unexec and startup code. It was pseudo-Mule-ized
before by simply always calling the ...A versions of functions,
but that won't cut it -- eventually we want to be able to run
properly even if XEmacs has been installed in a Japanese
directory. (The current problem is the timing of the loading of
the Unicode tables; this will eventually be fixed.) Go through and
fix various other places where the code was not Mule-clean.
Provide a function mswindows_get_module_file_name() to get our own
name without resort to PATH_MAX and such. Add a big comment in
main() about the problem with Unicode table load timing that I
just alluded to.
emacs.c: When error-checking is enabled (interpreted as "user is developing
XEmacs"), don't ask user to "pause to read messages" when a fatal
error has occurred, because it will wedge if we are in an inner
modal loop (typically when a menu is popped up) and make us unable
to get a useful stack trace in the debugger.
text.c: Correct update_entirely_ascii_p_flag to actually work.
lisp.h, symsinit.h: declarations for above changes.
author | ben |
---|---|
date | Sun, 14 Apr 2002 12:43:31 +0000 |
parents | 2b676dc88c66 |
children | 6504113e7c2d |
comparison
equal
deleted
inserted
replaced
813:9541922fb765 | 814:a634e3b7acc8 |
---|---|
470 static void sort_args (int argc, char **argv); | 470 static void sort_args (int argc, char **argv); |
471 | 471 |
472 Lisp_Object Qkill_emacs_hook; | 472 Lisp_Object Qkill_emacs_hook; |
473 Lisp_Object Qsave_buffers_kill_emacs; | 473 Lisp_Object Qsave_buffers_kill_emacs; |
474 | 474 |
475 extern Lisp_Object Vlisp_EXEC_SUFFIXES; | |
476 | |
477 /* Nonzero if handling a fatal error already. */ | 475 /* Nonzero if handling a fatal error already. */ |
478 int fatal_error_in_progress; | 476 int fatal_error_in_progress; |
479 | 477 |
480 /* Nonzero means we're going down, so we better not run any hooks | 478 /* Nonzero means we're going down, so we better not run any hooks |
481 or do other non-essential stuff. */ | 479 or do other non-essential stuff. */ |
516 { | 514 { |
517 #ifdef WIN32_NATIVE | 515 #ifdef WIN32_NATIVE |
518 if (i == 0) | 516 if (i == 0) |
519 { | 517 { |
520 /* Do not trust to what crt0 has stuffed into argv[0] */ | 518 /* Do not trust to what crt0 has stuffed into argv[0] */ |
521 Extbyte full_exe_path[PATH_MAX]; | 519 Extbyte *full_exe_path; |
522 Lisp_Object fullpath; | 520 Lisp_Object fullpath; |
523 | 521 |
524 qxeGetModuleFileName (NULL, full_exe_path, PATH_MAX); | 522 full_exe_path = mswindows_get_module_file_name (); |
523 assert (full_exe_path); | |
525 fullpath = build_tstr_string (full_exe_path); | 524 fullpath = build_tstr_string (full_exe_path); |
525 xfree (full_exe_path); | |
526 result = Fcons (fullpath, result); | 526 result = Fcons (fullpath, result); |
527 #if defined(HAVE_SHLIB) | 527 #ifdef HAVE_SHLIB |
528 { | 528 { |
529 Extbyte *fullpathext; | 529 Extbyte *fullpathext; |
530 | 530 |
531 /* Don't use full_exe_path directly because it's probably | |
532 in a different format. */ | |
531 LISP_STRING_TO_EXTERNAL (fullpath, fullpathext, | 533 LISP_STRING_TO_EXTERNAL (fullpath, fullpathext, |
532 Qdll_filename_encoding); | 534 Qdll_filename_encoding); |
533 (void) dll_init (fullpathext); | 535 (void) dll_init (fullpathext); |
534 } | 536 } |
535 #endif | 537 #endif |
703 initialized==0 => temacs | 705 initialized==0 => temacs |
704 initialized!=0 && restart!=0 => run-temacs | 706 initialized!=0 && restart!=0 => run-temacs |
705 initialized!=0 && restart==0 => either xemacs after conventional dump, | 707 initialized!=0 && restart==0 => either xemacs after conventional dump, |
706 or xemacs post pdump_load() | 708 or xemacs post pdump_load() |
707 */ | 709 */ |
708 DECLARE_DOESNT_RETURN (main_1 (int, char **, char **, int)); | 710 DECLARE_DOESNT_RETURN (main_1 (int, Extbyte **, Extbyte **, int)); |
709 DOESNT_RETURN | 711 DOESNT_RETURN |
710 main_1 (int argc, char **argv, char **envp, int restart) | 712 main_1 (int argc, Extbyte **argv, Extbyte **envp, int restart) |
711 { | 713 { |
712 char stack_bottom_variable; | 714 char stack_bottom_variable; |
713 int skip_args = 0; | 715 int skip_args = 0; |
714 Lisp_Object load_me; | 716 Lisp_Object load_me; |
715 int inhibit_window_system; | 717 int inhibit_window_system; |
716 #ifdef NeXT | 718 #ifdef NeXT |
717 extern int malloc_cookie; | 719 extern int malloc_cookie; |
718 #endif | 720 #endif |
719 | 721 |
722 /* !!#### Under MS Windows, this should all be rewritten to deal with | |
723 Unicode arguments and environment. We need to retrieve the command | |
724 line with GetCommandLine and convert to argv format with | |
725 CommandLineToArgvW. Unfortunately we have a bootstrapping problem | |
726 currently because we can't initialize the Unicode tables until we've | |
727 computed the location of data-directory, which doesn't happen till | |
728 startup.el, which is way late. We need to be dumping the Unicode | |
729 data, which means we need to fix pdump to correctly dump the "union" | |
730 format used by the tables. */ | |
731 | |
720 #if (!defined (SYSTEM_MALLOC) && !defined (HAVE_LIBMCHECK) \ | 732 #if (!defined (SYSTEM_MALLOC) && !defined (HAVE_LIBMCHECK) \ |
721 && !defined (DOUG_LEA_MALLOC)) | 733 && !defined (DOUG_LEA_MALLOC)) |
722 /* Make sure that any libraries we link against haven't installed a | 734 /* Make sure that any libraries we link against haven't installed a |
723 hook for a gmalloc of a potentially incompatible version. */ | 735 hook for a gmalloc of a potentially incompatible version. */ |
724 /* If we're using libmcheck, the hooks have already been initialized, */ | 736 /* If we're using libmcheck, the hooks have already been initialized, */ |
1091 #else | 1103 #else |
1092 if (!initialized) | 1104 if (!initialized) |
1093 purify_flag = 1; | 1105 purify_flag = 1; |
1094 #endif | 1106 #endif |
1095 | 1107 |
1096 if (initialized) | |
1097 { | |
1098 /* Reset some vars that were also set during loadup (we called | |
1099 these same functions below) */ | |
1100 init_alloc_early (); | |
1101 } | |
1102 | |
1103 if (!initialized) | 1108 if (!initialized) |
1104 { | 1109 { |
1105 /* Initialize things so that new Lisp objects | 1110 /* Initialize things so that new Lisp objects |
1106 can be created and objects can be staticpro'd. | 1111 can be created and objects can be staticpro'd. |
1107 Must be basically the very first thing done | 1112 Must be basically the very first thing done |
1124 /* Make sure that hash tables can be created. */ | 1129 /* Make sure that hash tables can be created. */ |
1125 init_elhash_once_early (); | 1130 init_elhash_once_early (); |
1126 | 1131 |
1127 /* Make sure that eistrings can be created. */ | 1132 /* Make sure that eistrings can be created. */ |
1128 init_eistring_once_early (); | 1133 init_eistring_once_early (); |
1129 | 1134 } |
1130 /* Initialize some vars that will also be reset post-dumping | 1135 |
1131 (see above) */ | 1136 /* The following will get called in raw-temacs, post-dump/pdump-load XEmacs, |
1132 init_alloc_early (); | 1137 and run-temacs. */ |
1133 | 1138 |
1139 /* Initialize some vars that will also be reset post-dumping */ | |
1140 init_alloc_early (); | |
1141 | |
1142 if (!initialized) | |
1143 { | |
1134 /* Now declare all the symbols and define all the Lisp primitives. | 1144 /* Now declare all the symbols and define all the Lisp primitives. |
1135 | 1145 |
1136 The *only* thing that the syms_of_*() functions are allowed to do | 1146 The *only* thing that the syms_of_*() functions are allowed to do |
1137 is call one of the following: | 1147 is call one of the following: |
1138 | 1148 |
1149 syms_of_abbrev (); | 1159 syms_of_abbrev (); |
1150 syms_of_alloc (); | 1160 syms_of_alloc (); |
1151 syms_of_buffer (); | 1161 syms_of_buffer (); |
1152 syms_of_bytecode (); | 1162 syms_of_bytecode (); |
1153 syms_of_callint (); | 1163 syms_of_callint (); |
1164 #ifndef WIN32_NATIVE | |
1154 syms_of_callproc (); | 1165 syms_of_callproc (); |
1166 #endif | |
1155 syms_of_casefiddle (); | 1167 syms_of_casefiddle (); |
1156 syms_of_casetab (); | 1168 syms_of_casetab (); |
1157 syms_of_chartab (); | 1169 syms_of_chartab (); |
1158 syms_of_cmdloop (); | 1170 syms_of_cmdloop (); |
1159 syms_of_cmds (); | 1171 syms_of_cmds (); |
1648 vars_of_abbrev (); | 1660 vars_of_abbrev (); |
1649 vars_of_alloc (); | 1661 vars_of_alloc (); |
1650 vars_of_buffer (); | 1662 vars_of_buffer (); |
1651 vars_of_bytecode (); | 1663 vars_of_bytecode (); |
1652 vars_of_callint (); | 1664 vars_of_callint (); |
1653 vars_of_callproc (); | |
1654 vars_of_chartab (); | 1665 vars_of_chartab (); |
1655 vars_of_cmdloop (); | 1666 vars_of_cmdloop (); |
1656 vars_of_cmds (); | 1667 vars_of_cmds (); |
1657 vars_of_console (); | 1668 vars_of_console (); |
1658 vars_of_data (); | 1669 vars_of_data (); |
1671 vars_of_dragdrop (); | 1682 vars_of_dragdrop (); |
1672 #endif | 1683 #endif |
1673 vars_of_editfns (); | 1684 vars_of_editfns (); |
1674 vars_of_emacs (); | 1685 vars_of_emacs (); |
1675 vars_of_eval (); | 1686 vars_of_eval (); |
1676 init_eval_early (); | 1687 init_eval_semi_early (); |
1677 | 1688 |
1678 #ifdef HAVE_X_WINDOWS | 1689 #ifdef HAVE_X_WINDOWS |
1679 vars_of_event_Xt (); | 1690 vars_of_event_Xt (); |
1680 #endif | 1691 #endif |
1681 #if defined(HAVE_TTY) && (defined (DEBUG_TTY_EVENT_STREAM) || !defined (HAVE_X_WINDOWS)) | 1692 #if defined(HAVE_TTY) && (defined (DEBUG_TTY_EVENT_STREAM) || !defined (HAVE_X_WINDOWS)) |
1731 #ifdef HAVE_SHLIB | 1742 #ifdef HAVE_SHLIB |
1732 vars_of_module (); | 1743 vars_of_module (); |
1733 #endif | 1744 #endif |
1734 #ifdef WIN32_NATIVE | 1745 #ifdef WIN32_NATIVE |
1735 vars_of_nt (); | 1746 vars_of_nt (); |
1736 vars_of_ntproc (); | |
1737 #endif | 1747 #endif |
1738 vars_of_objects (); | 1748 vars_of_objects (); |
1739 vars_of_print (); | 1749 vars_of_print (); |
1740 | 1750 |
1741 #ifndef NO_SUBPROCESSES | 1751 #ifndef NO_SUBPROCESSES |
1751 vars_of_profile (); | 1761 vars_of_profile (); |
1752 #if defined (HAVE_MMAP) && defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC) | 1762 #if defined (HAVE_MMAP) && defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC) |
1753 vars_of_ralloc (); | 1763 vars_of_ralloc (); |
1754 #endif /* HAVE_MMAP && REL_ALLOC */ | 1764 #endif /* HAVE_MMAP && REL_ALLOC */ |
1755 vars_of_redisplay (); | 1765 vars_of_redisplay (); |
1766 vars_of_regex (); | |
1756 #ifdef HAVE_SCROLLBARS | 1767 #ifdef HAVE_SCROLLBARS |
1757 vars_of_scrollbar (); | 1768 vars_of_scrollbar (); |
1758 #endif | 1769 #endif |
1759 vars_of_search (); | 1770 vars_of_search (); |
1760 vars_of_select (); | 1771 vars_of_select (); |
1912 be handled above. There may be dependencies on variables | 1923 be handled above. There may be dependencies on variables |
1913 initialized above, and dependencies between one complex_vars_() | 1924 initialized above, and dependencies between one complex_vars_() |
1914 function and another. */ | 1925 function and another. */ |
1915 | 1926 |
1916 #ifdef MULE | 1927 #ifdef MULE |
1917 /* These two depend on hash tables and various variables declared | 1928 /* This depends on vars initialized in vars_of_unicode(). */ |
1918 earlier. The second may also depend on the first. */ | |
1919 complex_vars_of_mule_charset (); | 1929 complex_vars_of_mule_charset (); |
1920 #endif | 1930 #endif |
1931 /* This one doesn't depend on anything really, and could go into | |
1932 vars_of_(), but lots of lots of code gets called and it's easily | |
1933 possible that it could get changed to require being a | |
1934 complex_vars_of_(), for example if a charset appears anywhere, | |
1935 then we suddenly have dependence on the previous call. */ | |
1921 complex_vars_of_file_coding (); | 1936 complex_vars_of_file_coding (); |
1922 #ifdef HAVE_WIN32_CODING_SYSTEMS | 1937 #ifdef HAVE_WIN32_CODING_SYSTEMS |
1923 complex_vars_of_intl_win32 (); | 1938 complex_vars_of_intl_win32 (); |
1924 #endif | 1939 #endif |
1925 | |
1926 /* Calls Fmake_range_table(). */ | |
1927 complex_vars_of_regex (); | |
1928 /* Calls Fmake_range_table(). */ | |
1929 complex_vars_of_search (); | |
1930 | 1940 |
1931 /* Depends on specifiers. */ | 1941 /* Depends on specifiers. */ |
1932 complex_vars_of_faces (); | 1942 complex_vars_of_faces (); |
1933 | 1943 |
1934 /* This calls allocate_glyph(), which creates specifiers | 1944 /* This calls allocate_glyph(), which creates specifiers |
1958 #endif | 1968 #endif |
1959 | 1969 |
1960 #ifdef HAVE_SCROLLBARS | 1970 #ifdef HAVE_SCROLLBARS |
1961 /* This calls Fmake_glyph_internal(). */ | 1971 /* This calls Fmake_glyph_internal(). */ |
1962 complex_vars_of_scrollbar (); | 1972 complex_vars_of_scrollbar (); |
1963 #ifdef HAVE_MS_WINDOWS | |
1964 /* Calls make_lisp_hash_table(). */ | |
1965 complex_vars_of_scrollbar_mswindows (); | |
1966 #endif | |
1967 #endif | 1973 #endif |
1968 | 1974 |
1969 /* This calls allocate_glyph(). */ | 1975 /* This calls allocate_glyph(). */ |
1970 complex_vars_of_frame (); | 1976 complex_vars_of_frame (); |
1971 | 1977 |
2018 (note, we are inside ifdef PDUMP) */ | 2024 (note, we are inside ifdef PDUMP) */ |
2019 { | 2025 { |
2020 reinit_alloc_once_early (); | 2026 reinit_alloc_once_early (); |
2021 reinit_symbols_once_early (); | 2027 reinit_symbols_once_early (); |
2022 reinit_opaque_once_early (); | 2028 reinit_opaque_once_early (); |
2029 reinit_eistring_once_early (); | |
2023 | 2030 |
2024 reinit_console_type_create_stream (); | 2031 reinit_console_type_create_stream (); |
2025 #ifdef HAVE_TTY | 2032 #ifdef HAVE_TTY |
2026 reinit_console_type_create_tty (); | 2033 reinit_console_type_create_tty (); |
2027 #endif | 2034 #endif |
2146 | 2153 |
2147 /* CONGRATULATIONS!!! We have successfully initialized the Lisp | 2154 /* CONGRATULATIONS!!! We have successfully initialized the Lisp |
2148 engine. */ | 2155 engine. */ |
2149 | 2156 |
2150 if (initialized) | 2157 if (initialized) |
2151 init_eval_early (); | 2158 init_eval_semi_early (); |
2152 | 2159 |
2153 #ifdef MULE | 2160 #ifdef MULE |
2154 init_mule_charset (); | 2161 init_mule_charset (); |
2155 #endif | 2162 #endif |
2156 | 2163 |
2176 file-name coding systems, initialize the Unicode tables | 2183 file-name coding systems, initialize the Unicode tables |
2177 so that we will be able to process non-ASCII from here | 2184 so that we will be able to process non-ASCII from here |
2178 on out! */ | 2185 on out! */ |
2179 #endif | 2186 #endif |
2180 | 2187 |
2181 init_callproc (); /* Set up the process environment (so that egetenv | 2188 init_xemacs_process (); /* Set up the process environment (so that |
2182 works), the basic directory variables | 2189 egetenv works), the basic directory variables |
2183 (exec-directory and so on), and stuff | 2190 (exec-directory and so on), and stuff related |
2184 related to subprocesses. This should be | 2191 to subprocesses. This should be first because |
2185 first because many of the functions below | 2192 many of the functions below call egetenv() to |
2186 call egetenv() to get environment variables. */ | 2193 get environment variables. */ |
2187 | 2194 |
2188 #ifdef WIN32_NATIVE | 2195 #ifdef WIN32_NATIVE |
2189 /* | 2196 /* |
2190 * For Win32, call init_environment() to properly enter environment/registry | 2197 * For Win32, call init_environment() to properly enter environment/registry |
2191 * variables into Vprocess_environment. | 2198 * variables into Vprocess_environment. |
2192 */ | 2199 */ |
2193 init_environment (); | 2200 init_mswindows_environment (); |
2194 #endif | 2201 #endif |
2195 | 2202 |
2196 init_initial_directory (); /* get the directory to use for the | 2203 init_initial_directory (); /* get the directory to use for the |
2197 "*scratch*" buffer, etc. */ | 2204 "*scratch*" buffer, etc. */ |
2198 | 2205 |
2200 init_cmdargs (argc, (Extbyte **) argv, | 2207 init_cmdargs (argc, (Extbyte **) argv, |
2201 skip_args); /* Create list Vcommand_line_args */ | 2208 skip_args); /* Create list Vcommand_line_args */ |
2202 init_buffer_2 (); /* Set default directory of *scratch* buffer */ | 2209 init_buffer_2 (); /* Set default directory of *scratch* buffer */ |
2203 | 2210 |
2204 #ifdef WIN32_NATIVE | 2211 #ifdef WIN32_NATIVE |
2205 init_ntproc (); | 2212 init_nt (); |
2206 init_select_mswindows (); | 2213 init_select_mswindows (); |
2207 #endif | 2214 #endif |
2208 | 2215 |
2209 init_redisplay (); /* Determine terminal type. | 2216 init_redisplay (); /* Determine terminal type. |
2210 init_sys_modes uses results */ | 2217 init_sys_modes uses results */ |
2211 init_frame (); | 2218 init_frame (); |
2212 init_event_stream (); /* Set up so we can get user input. */ | 2219 init_event_stream (); /* Set up so we can get user input. */ |
2213 init_macros (); /* set up so we can run macros. */ | 2220 init_macros (); /* set up so we can run macros. */ |
2214 init_editfns (); /* Determine the name of the user we're running as */ | 2221 init_editfns (); /* Determine the name of the user we're running as */ |
2215 init_xemacs_process (); /* set up for calling subprocesses */ | |
2216 #ifdef SUNPRO | 2222 #ifdef SUNPRO |
2217 init_sunpro (); /* Set up Sunpro usage tracking */ | 2223 init_sunpro (); /* Set up Sunpro usage tracking */ |
2218 #endif | 2224 #endif |
2219 #if defined (WIN32_NATIVE) || defined (CYGWIN) | 2225 #if defined (WIN32_NATIVE) || defined (CYGWIN) |
2220 init_win32 (); | 2226 init_win32 (); |
2825 /* Also arrange for warnings when nearly out of space. */ | 2831 /* Also arrange for warnings when nearly out of space. */ |
2826 #ifndef SYSTEM_MALLOC | 2832 #ifndef SYSTEM_MALLOC |
2827 memory_warnings (my_edata, malloc_warning); | 2833 memory_warnings (my_edata, malloc_warning); |
2828 #endif | 2834 #endif |
2829 | 2835 |
2830 UNGCPRO; | 2836 garbage_collect_1 (); |
2831 | 2837 |
2838 #ifdef PDUMP | |
2839 pdump (); | |
2840 #elif defined (WIN32_NATIVE) | |
2841 unexec (XSTRING_DATA (filename), | |
2842 STRINGP (symfile) ? XSTRING_DATA (symfile) : 0, | |
2843 (uintptr_t) my_edata, 0, 0); | |
2844 #else | |
2832 { | 2845 { |
2833 Extbyte *filename_ext; | 2846 Extbyte *filename_ext; |
2834 Extbyte *symfile_ext; | 2847 Extbyte *symfile_ext; |
2835 | 2848 |
2836 LISP_STRING_TO_EXTERNAL (filename, filename_ext, Qfile_name); | 2849 LISP_STRING_TO_EXTERNAL (filename, filename_ext, Qfile_name); |
2838 if (STRINGP (symfile)) | 2851 if (STRINGP (symfile)) |
2839 LISP_STRING_TO_EXTERNAL (symfile, symfile_ext, Qfile_name); | 2852 LISP_STRING_TO_EXTERNAL (symfile, symfile_ext, Qfile_name); |
2840 else | 2853 else |
2841 symfile_ext = 0; | 2854 symfile_ext = 0; |
2842 | 2855 |
2843 garbage_collect_1 (); | 2856 # ifdef DOUG_LEA_MALLOC |
2844 | |
2845 #ifdef PDUMP | |
2846 pdump (); | |
2847 #else | |
2848 | |
2849 #ifdef DOUG_LEA_MALLOC | |
2850 malloc_state_ptr = malloc_get_state (); | 2857 malloc_state_ptr = malloc_get_state (); |
2851 #endif | 2858 # endif |
2852 /* here we break our rule that the filename conversion should | 2859 /* here we break our rule that the filename conversion should |
2853 be performed at the actual time that the system call is made. | 2860 be performed at the actual time that the system call is made. |
2854 It's a whole lot easier to do the conversion here than to | 2861 It's a whole lot easier to do the conversion here than to |
2855 modify all the unexec routines to ensure that filename | 2862 modify all the unexec routines to ensure that filename |
2856 conversion is applied everywhere. Don't worry about memory | 2863 conversion is applied everywhere. Don't worry about memory |
2857 leakage because this call only happens once. */ | 2864 leakage because this call only happens once. */ |
2858 unexec (filename_ext, symfile_ext, (uintptr_t) my_edata, 0, 0); | 2865 unexec (filename_ext, symfile_ext, (uintptr_t) my_edata, 0, 0); |
2859 #ifdef DOUG_LEA_MALLOC | 2866 # ifdef DOUG_LEA_MALLOC |
2860 free (malloc_state_ptr); | 2867 free (malloc_state_ptr); |
2861 #endif | 2868 # endif |
2862 #endif /* not PDUMP */ | |
2863 } | 2869 } |
2870 #endif /* not PDUMP, not WIN32_NATIVE */ | |
2864 | 2871 |
2865 purify_flag = opurify; | 2872 purify_flag = opurify; |
2866 | 2873 |
2874 UNGCPRO; | |
2867 return Qnil; | 2875 return Qnil; |
2868 } | 2876 } |
2869 | 2877 |
2870 #endif /* not CANNOT_DUMP */ | 2878 #endif /* not CANNOT_DUMP */ |
2871 | 2879 |
3279 | 3287 |
3280 /* -------------------------------- */ | 3288 /* -------------------------------- */ |
3281 /* abnormal shutdowns: GP faults */ | 3289 /* abnormal shutdowns: GP faults */ |
3282 /* -------------------------------- */ | 3290 /* -------------------------------- */ |
3283 | 3291 |
3292 /* This is somewhat ad-hoc ... figure out whether the user is developing | |
3293 XEmacs, which means (under MS Windows) they have a system debugger | |
3294 installed that catches GP faults in any application and lets them open | |
3295 up MS Dev Studio and start debugging the application -- similar to | |
3296 producing a core dump and then going back with a debugger to investigate | |
3297 the core dump, except that the program is still running. When this is | |
3298 installed, it's better not to "pause so user gets messages" because the | |
3299 debugger will pause anyway; and in case we're currently with a menu | |
3300 popped up or somewhere else inside of an internal modal loop, we will | |
3301 get wedged when we output the "pause". (It seems that the two modal | |
3302 loops will fight each other and the return key will never be passed to | |
3303 the "pause" handler so that XEmacs's GPF handler can return, resignal | |
3304 the GPF, and properly go into the debugger.) */ | |
3305 #if defined (ERROR_CHECK_TYPES) || defined (ERROR_CHECK_TEXT) || defined (ERROR_CHECK_GC) || defined (ERROR_CHECK_STRUCTURES) | |
3306 #define USER_IS_DEVELOPING_XEMACS | |
3307 #endif | |
3308 | |
3309 | |
3284 /* Handle bus errors, illegal instruction, etc: actual implementation. */ | 3310 /* Handle bus errors, illegal instruction, etc: actual implementation. */ |
3285 static void | 3311 static void |
3286 guts_of_fatal_error_signal (int sig) | 3312 guts_of_fatal_error_signal (int sig) |
3287 { | 3313 { |
3288 fatal_error_in_progress++; | 3314 fatal_error_in_progress++; |
3330 sprintf (buf, "%s %d >&2", pstack, (int)getpid()); | 3356 sprintf (buf, "%s %d >&2", pstack, (int)getpid()); |
3331 system (buf); | 3357 system (buf); |
3332 } | 3358 } |
3333 } | 3359 } |
3334 # endif | 3360 # endif |
3335 #ifdef HAVE_MS_WINDOWS | 3361 #if defined (HAVE_MS_WINDOWS) && !defined (USER_IS_DEVELOPING_XEMACS) |
3336 pause_so_user_can_read_messages (0); | 3362 pause_so_user_can_read_messages (0); |
3337 #endif | 3363 #endif |
3338 } | 3364 } |
3339 } | 3365 } |
3340 | 3366 |
3367 static DWORD | 3393 static DWORD |
3368 mswindows_handle_hardware_exceptions_1 (void) | 3394 mswindows_handle_hardware_exceptions_1 (void) |
3369 { | 3395 { |
3370 inhibit_non_essential_printing_operations = 1; | 3396 inhibit_non_essential_printing_operations = 1; |
3371 preparing_for_armageddon = 1; | 3397 preparing_for_armageddon = 1; |
3398 #if !defined (USER_IS_DEVELOPING_XEMACS) | |
3372 pause_so_user_can_read_messages (0); | 3399 pause_so_user_can_read_messages (0); |
3400 #endif | |
3373 return EXCEPTION_EXECUTE_HANDLER; | 3401 return EXCEPTION_EXECUTE_HANDLER; |
3374 } | 3402 } |
3375 | 3403 |
3376 /* This is called under MS Windows when an exception (this encompasses both | 3404 /* This is called under MS Windows when an exception (this encompasses both |
3377 user-defined exceptions and hardware exceptions such as GP faults aka | 3405 user-defined exceptions and hardware exceptions such as GP faults aka |