Mercurial > hg > xemacs-beta
diff 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 |
line wrap: on
line diff
--- a/src/emacs.c Sat Apr 13 20:44:53 2002 +0000 +++ b/src/emacs.c Sun Apr 14 12:43:31 2002 +0000 @@ -472,8 +472,6 @@ Lisp_Object Qkill_emacs_hook; Lisp_Object Qsave_buffers_kill_emacs; -extern Lisp_Object Vlisp_EXEC_SUFFIXES; - /* Nonzero if handling a fatal error already. */ int fatal_error_in_progress; @@ -518,16 +516,20 @@ if (i == 0) { /* Do not trust to what crt0 has stuffed into argv[0] */ - Extbyte full_exe_path[PATH_MAX]; + Extbyte *full_exe_path; Lisp_Object fullpath; - qxeGetModuleFileName (NULL, full_exe_path, PATH_MAX); + full_exe_path = mswindows_get_module_file_name (); + assert (full_exe_path); fullpath = build_tstr_string (full_exe_path); + xfree (full_exe_path); result = Fcons (fullpath, result); -#if defined(HAVE_SHLIB) +#ifdef HAVE_SHLIB { Extbyte *fullpathext; + /* Don't use full_exe_path directly because it's probably + in a different format. */ LISP_STRING_TO_EXTERNAL (fullpath, fullpathext, Qdll_filename_encoding); (void) dll_init (fullpathext); @@ -705,9 +707,9 @@ initialized!=0 && restart==0 => either xemacs after conventional dump, or xemacs post pdump_load() */ -DECLARE_DOESNT_RETURN (main_1 (int, char **, char **, int)); +DECLARE_DOESNT_RETURN (main_1 (int, Extbyte **, Extbyte **, int)); DOESNT_RETURN -main_1 (int argc, char **argv, char **envp, int restart) +main_1 (int argc, Extbyte **argv, Extbyte **envp, int restart) { char stack_bottom_variable; int skip_args = 0; @@ -717,6 +719,16 @@ extern int malloc_cookie; #endif + /* !!#### Under MS Windows, this should all be rewritten to deal with + Unicode arguments and environment. We need to retrieve the command + line with GetCommandLine and convert to argv format with + CommandLineToArgvW. Unfortunately we have a bootstrapping problem + currently because we can't initialize the Unicode tables until we've + computed the location of data-directory, which doesn't happen till + startup.el, which is way late. We need to be dumping the Unicode + data, which means we need to fix pdump to correctly dump the "union" + format used by the tables. */ + #if (!defined (SYSTEM_MALLOC) && !defined (HAVE_LIBMCHECK) \ && !defined (DOUG_LEA_MALLOC)) /* Make sure that any libraries we link against haven't installed a @@ -1093,13 +1105,6 @@ purify_flag = 1; #endif - if (initialized) - { - /* Reset some vars that were also set during loadup (we called - these same functions below) */ - init_alloc_early (); - } - if (!initialized) { /* Initialize things so that new Lisp objects @@ -1126,11 +1131,16 @@ /* Make sure that eistrings can be created. */ init_eistring_once_early (); - - /* Initialize some vars that will also be reset post-dumping - (see above) */ - init_alloc_early (); - + } + + /* The following will get called in raw-temacs, post-dump/pdump-load XEmacs, + and run-temacs. */ + + /* Initialize some vars that will also be reset post-dumping */ + init_alloc_early (); + + if (!initialized) + { /* Now declare all the symbols and define all the Lisp primitives. The *only* thing that the syms_of_*() functions are allowed to do @@ -1151,7 +1161,9 @@ syms_of_buffer (); syms_of_bytecode (); syms_of_callint (); +#ifndef WIN32_NATIVE syms_of_callproc (); +#endif syms_of_casefiddle (); syms_of_casetab (); syms_of_chartab (); @@ -1650,7 +1662,6 @@ vars_of_buffer (); vars_of_bytecode (); vars_of_callint (); - vars_of_callproc (); vars_of_chartab (); vars_of_cmdloop (); vars_of_cmds (); @@ -1673,7 +1684,7 @@ vars_of_editfns (); vars_of_emacs (); vars_of_eval (); - init_eval_early (); + init_eval_semi_early (); #ifdef HAVE_X_WINDOWS vars_of_event_Xt (); @@ -1733,7 +1744,6 @@ #endif #ifdef WIN32_NATIVE vars_of_nt (); - vars_of_ntproc (); #endif vars_of_objects (); vars_of_print (); @@ -1753,6 +1763,7 @@ vars_of_ralloc (); #endif /* HAVE_MMAP && REL_ALLOC */ vars_of_redisplay (); + vars_of_regex (); #ifdef HAVE_SCROLLBARS vars_of_scrollbar (); #endif @@ -1914,20 +1925,19 @@ function and another. */ #ifdef MULE - /* These two depend on hash tables and various variables declared - earlier. The second may also depend on the first. */ + /* This depends on vars initialized in vars_of_unicode(). */ complex_vars_of_mule_charset (); #endif + /* This one doesn't depend on anything really, and could go into + vars_of_(), but lots of lots of code gets called and it's easily + possible that it could get changed to require being a + complex_vars_of_(), for example if a charset appears anywhere, + then we suddenly have dependence on the previous call. */ complex_vars_of_file_coding (); #ifdef HAVE_WIN32_CODING_SYSTEMS complex_vars_of_intl_win32 (); #endif - /* Calls Fmake_range_table(). */ - complex_vars_of_regex (); - /* Calls Fmake_range_table(). */ - complex_vars_of_search (); - /* Depends on specifiers. */ complex_vars_of_faces (); @@ -1960,10 +1970,6 @@ #ifdef HAVE_SCROLLBARS /* This calls Fmake_glyph_internal(). */ complex_vars_of_scrollbar (); -#ifdef HAVE_MS_WINDOWS - /* Calls make_lisp_hash_table(). */ - complex_vars_of_scrollbar_mswindows (); -#endif #endif /* This calls allocate_glyph(). */ @@ -2020,6 +2026,7 @@ reinit_alloc_once_early (); reinit_symbols_once_early (); reinit_opaque_once_early (); + reinit_eistring_once_early (); reinit_console_type_create_stream (); #ifdef HAVE_TTY @@ -2148,7 +2155,7 @@ engine. */ if (initialized) - init_eval_early (); + init_eval_semi_early (); #ifdef MULE init_mule_charset (); @@ -2178,19 +2185,19 @@ on out! */ #endif - init_callproc (); /* Set up the process environment (so that egetenv - works), the basic directory variables - (exec-directory and so on), and stuff - related to subprocesses. This should be - first because many of the functions below - call egetenv() to get environment variables. */ + init_xemacs_process (); /* Set up the process environment (so that + egetenv works), the basic directory variables + (exec-directory and so on), and stuff related + to subprocesses. This should be first because + many of the functions below call egetenv() to + get environment variables. */ #ifdef WIN32_NATIVE /* * For Win32, call init_environment() to properly enter environment/registry * variables into Vprocess_environment. */ - init_environment (); + init_mswindows_environment (); #endif init_initial_directory (); /* get the directory to use for the @@ -2202,7 +2209,7 @@ init_buffer_2 (); /* Set default directory of *scratch* buffer */ #ifdef WIN32_NATIVE - init_ntproc (); + init_nt (); init_select_mswindows (); #endif @@ -2212,7 +2219,6 @@ init_event_stream (); /* Set up so we can get user input. */ init_macros (); /* set up so we can run macros. */ init_editfns (); /* Determine the name of the user we're running as */ - init_xemacs_process (); /* set up for calling subprocesses */ #ifdef SUNPRO init_sunpro (); /* Set up Sunpro usage tracking */ #endif @@ -2827,8 +2833,15 @@ memory_warnings (my_edata, malloc_warning); #endif - UNGCPRO; - + garbage_collect_1 (); + +#ifdef PDUMP + pdump (); +#elif defined (WIN32_NATIVE) + unexec (XSTRING_DATA (filename), + STRINGP (symfile) ? XSTRING_DATA (symfile) : 0, + (uintptr_t) my_edata, 0, 0); +#else { Extbyte *filename_ext; Extbyte *symfile_ext; @@ -2840,15 +2853,9 @@ else symfile_ext = 0; - garbage_collect_1 (); - -#ifdef PDUMP - pdump (); -#else - -#ifdef DOUG_LEA_MALLOC +# ifdef DOUG_LEA_MALLOC malloc_state_ptr = malloc_get_state (); -#endif +# endif /* here we break our rule that the filename conversion should be performed at the actual time that the system call is made. It's a whole lot easier to do the conversion here than to @@ -2856,14 +2863,15 @@ conversion is applied everywhere. Don't worry about memory leakage because this call only happens once. */ unexec (filename_ext, symfile_ext, (uintptr_t) my_edata, 0, 0); -#ifdef DOUG_LEA_MALLOC +# ifdef DOUG_LEA_MALLOC free (malloc_state_ptr); -#endif -#endif /* not PDUMP */ +# endif } +#endif /* not PDUMP, not WIN32_NATIVE */ purify_flag = opurify; + UNGCPRO; return Qnil; } @@ -3281,6 +3289,24 @@ /* abnormal shutdowns: GP faults */ /* -------------------------------- */ +/* This is somewhat ad-hoc ... figure out whether the user is developing + XEmacs, which means (under MS Windows) they have a system debugger + installed that catches GP faults in any application and lets them open + up MS Dev Studio and start debugging the application -- similar to + producing a core dump and then going back with a debugger to investigate + the core dump, except that the program is still running. When this is + installed, it's better not to "pause so user gets messages" because the + debugger will pause anyway; and in case we're currently with a menu + popped up or somewhere else inside of an internal modal loop, we will + get wedged when we output the "pause". (It seems that the two modal + loops will fight each other and the return key will never be passed to + the "pause" handler so that XEmacs's GPF handler can return, resignal + the GPF, and properly go into the debugger.) */ +#if defined (ERROR_CHECK_TYPES) || defined (ERROR_CHECK_TEXT) || defined (ERROR_CHECK_GC) || defined (ERROR_CHECK_STRUCTURES) +#define USER_IS_DEVELOPING_XEMACS +#endif + + /* Handle bus errors, illegal instruction, etc: actual implementation. */ static void guts_of_fatal_error_signal (int sig) @@ -3332,7 +3358,7 @@ } } # endif -#ifdef HAVE_MS_WINDOWS +#if defined (HAVE_MS_WINDOWS) && !defined (USER_IS_DEVELOPING_XEMACS) pause_so_user_can_read_messages (0); #endif } @@ -3369,7 +3395,9 @@ { inhibit_non_essential_printing_operations = 1; preparing_for_armageddon = 1; +#if !defined (USER_IS_DEVELOPING_XEMACS) pause_so_user_can_read_messages (0); +#endif return EXCEPTION_EXECUTE_HANDLER; }