comparison src/emacs.c @ 5023:838630c0734f

error-checking, Windows shutdown changes -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-02-09 Ben Wing <ben@xemacs.org> * dynarr.c (Dynarr_insert_many): * dynarr.c (Dynarr_delete_many): * emacs.c: * emacs.c (pause_so_user_can_read_messages): * emacs.c (Fkill_emacs): * emacs.c (guts_of_fatal_error_signal): * lisp.h: * lisp.h (INLINE_ERROR_CHECK_ARGS): * lisp.h (Dynarr_set_length_1): * lisp.h (Dynarr_set_length): * lisp.h (Dynarr_pop): Add ERROR_CHECK_DYNARR, dynarr_checking_assert(). Use it. Sort existing error-check categories in lisp.h, remove most of the (unused) assert variations from most categories. Add a long comment about reorganizing the system by categories and subcategories. Create ERROR_CHECK_ANY if any error-checking categories defined, and use it in emacs.c to define USER_IS_DEVELOPING_XEMACS. In emacs.c and cmdloop.c, don't display a message at early shutdown or fatal shutdown when on Cygwin, only Windows native -- Cygwin has a working stderr that shows error output. Update comment in Dynarr_verify_pos_atp().
author Ben Wing <ben@xemacs.org>
date Tue, 09 Feb 2010 19:13:44 -0600
parents c2e0c3af5fe3
children 6f2158fa75ed b5df3737028a
comparison
equal deleted inserted replaced
5022:cfe36e196dc7 5023:838630c0734f
1 /* XEmacs -- Fully extensible Emacs, running on Unix and other platforms. 1 /* XEmacs -- Fully extensible Emacs, running on Unix and other platforms.
2 Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994 2 Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 Copyright (C) 1995 Sun Microsystems, Inc. 4 Copyright (C) 1995 Sun Microsystems, Inc.
5 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Ben Wing. 5 Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2010 Ben Wing.
6 6
7 This file is part of XEmacs. 7 This file is part of XEmacs.
8 8
9 XEmacs is free software; you can redistribute it and/or modify it 9 XEmacs is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published by the 10 under the terms of the GNU General Public License as published by the
3332 3332
3333 /************************************************************************/ 3333 /************************************************************************/
3334 /* exiting XEmacs (intended or not) */ 3334 /* exiting XEmacs (intended or not) */
3335 /************************************************************************/ 3335 /************************************************************************/
3336 3336
3337 /* Do we need to pause with a message box so that messages can be read
3338 at shutdown? We do this is we have support for native Windows frames
3339 and if we are native Windows. The first part is because only when compiled
3340 for native Windows frames do we have Fmswindows_message_box(), and
3341 the second part is because we don't want to do this under Cygwin, where
3342 we have a Unix-like environment and a working stderr where the messages
3343 go. The two conditions sound somewhat redundant (maybe we could just
3344 use the second?) but they aren't completely: Theoretically (maybe with
3345 MinGW?) we could imagine compiling under native Windows as the OS
3346 but e.g. targetting only X Windows as the window system. --ben */
3347
3348 #if defined (HAVE_MS_WINDOWS) && defined (WIN32_NATIVE)
3349 # define NEED_WINDOWS_MESSAGE_PAUSE
3350 #endif
3351
3337 /* 3352 /*
3338 3353
3339 Info on intended/unintended exits: 3354 Info on intended/unintended exits:
3340 3355
3341 (Info-goto-node "(internals)Exiting") 3356 (Info-goto-node "(internals)Exiting")
3466 dont_check_for_quit = 1; 3481 dont_check_for_quit = 1;
3467 Vinhibit_quit = Qt; 3482 Vinhibit_quit = Qt;
3468 Vquit_flag = Qnil; 3483 Vquit_flag = Qnil;
3469 } 3484 }
3470 3485
3471 #ifdef HAVE_MS_WINDOWS 3486 #ifdef NEED_WINDOWS_MESSAGE_PAUSE
3472 static void 3487 static void
3473 pause_so_user_can_read_messages (int allow_further) 3488 pause_so_user_can_read_messages (int allow_further)
3474 { 3489 {
3475 static int already_paused; 3490 static int already_paused;
3476 3491
3717 } 3732 }
3718 } 3733 }
3719 3734
3720 UNGCPRO; 3735 UNGCPRO;
3721 3736
3722 #ifdef HAVE_MS_WINDOWS 3737 #ifdef NEED_WINDOWS_MESSAGE_PAUSE
3723 pause_so_user_can_read_messages (1); 3738 pause_so_user_can_read_messages (1);
3724 #endif 3739 #endif
3725 3740
3726 shut_down_emacs (0, STRINGP (arg) ? arg : Qnil, 0); 3741 shut_down_emacs (0, STRINGP (arg) ? arg : Qnil, 0);
3727 3742
3753 popped up or somewhere else inside of an internal modal loop, we will 3768 popped up or somewhere else inside of an internal modal loop, we will
3754 get wedged when we output the "pause". (It seems that the two modal 3769 get wedged when we output the "pause". (It seems that the two modal
3755 loops will fight each other and the return key will never be passed to 3770 loops will fight each other and the return key will never be passed to
3756 the "pause" handler so that XEmacs's GPF handler can return, resignal 3771 the "pause" handler so that XEmacs's GPF handler can return, resignal
3757 the GPF, and properly go into the debugger.) */ 3772 the GPF, and properly go into the debugger.) */
3758 #if defined (ERROR_CHECK_TYPES) || defined (ERROR_CHECK_TEXT) || defined (ERROR_CHECK_GC) || defined (ERROR_CHECK_STRUCTURES) 3773 #ifdef ERROR_CHECK_ANY
3759 #define USER_IS_DEVELOPING_XEMACS 3774 #define USER_IS_DEVELOPING_XEMACS
3760 #endif 3775 #endif
3761 3776
3762 3777
3763 /* Handle bus errors, illegal instruction, etc: actual implementation. */ 3778 /* Handle bus errors, illegal instruction, etc: actual implementation. */
3809 sprintf (buf, "%s %d >&2", pstack, (int) getpid()); 3824 sprintf (buf, "%s %d >&2", pstack, (int) getpid());
3810 system (buf); 3825 system (buf);
3811 } 3826 }
3812 } 3827 }
3813 # endif 3828 # endif
3814 #if defined (HAVE_MS_WINDOWS) && !defined (USER_IS_DEVELOPING_XEMACS) 3829 #if defined (NEED_WINDOWS_MESSAGE_PAUSE) && !defined (USER_IS_DEVELOPING_XEMACS)
3815 pause_so_user_can_read_messages (0); 3830 pause_so_user_can_read_messages (0);
3816 #endif 3831 #endif
3817 } 3832 }
3818 } 3833 }
3819 3834