Mercurial > hg > xemacs-beta
comparison src/emacs.c @ 771:943eaba38521
[xemacs-hg @ 2002-03-13 08:51:24 by ben]
The big ben-mule-21-5 check-in!
Various files were added and deleted. See CHANGES-ben-mule.
There are still some test suite failures. No crashes, though.
Many of the failures have to do with problems in the test suite itself
rather than in the actual code. I'll be addressing these in the next
day or so -- none of the test suite failures are at all critical.
Meanwhile I'll be trying to address the biggest issues -- i.e. build
or run failures, which will almost certainly happen on various platforms.
All comments should be sent to ben@xemacs.org -- use a Cc: if necessary
when sending to mailing lists. There will be pre- and post- tags,
something like
pre-ben-mule-21-5-merge-in, and
post-ben-mule-21-5-merge-in.
author | ben |
---|---|
date | Wed, 13 Mar 2002 08:54:06 +0000 |
parents | fdefd0186b75 |
children | 79940b592197 |
comparison
equal
deleted
inserted
replaced
770:336a418893b5 | 771:943eaba38521 |
---|---|
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 Ben Wing. | 5 Copyright (C) 2000, 2001, 2002 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 |
22 Boston, MA 02111-1307, USA. */ | 22 Boston, MA 02111-1307, USA. */ |
23 | 23 |
24 /* Synched up with: Mule 2.0, FSF 19.28. */ | 24 /* Synched up with: Mule 2.0, FSF 19.28. */ |
25 | 25 |
26 /* Capsule summary of the various releases of Lucid Emacs/XEmacs and | 26 /* Capsule summary of the various releases of Lucid Emacs/XEmacs and |
27 FSF/GNU Emacs. Provided here for use in cross-referencing version | 27 FSF/GNU Emacs. (Copied from the Internals Manual, where the |
28 releases and dates in comments, esp. in the authorship comments at | 28 canonical version lives.) Provided here for use in cross-referencing |
29 the beginning of each file. More information about history can be | 29 version releases and dates in comments, esp. in the authorship |
30 found in the beginning of the Internals Manual and in the About page. | 30 comments at the beginning of each file. More information about |
31 history can be found in the beginning of the Internals Manual and | |
32 in the About page. | |
31 | 33 |
32 | 34 |
33 -- A time line for Lucid Emacs/XEmacs is | 35 -- A time line for Lucid Emacs/XEmacs is |
34 | 36 |
35 version 19.0 shipped with Energize 1.0, April 1992. | 37 version 19.0 shipped with Energize 1.0, April 1992. |
52 version 20.0 released February 9, 1997. | 54 version 20.0 released February 9, 1997. |
53 version 19.15 released March 28, 1997. | 55 version 19.15 released March 28, 1997. |
54 version 20.1 (not released to the net) April 15, 1997. | 56 version 20.1 (not released to the net) April 15, 1997. |
55 version 20.2 released May 16, 1997. | 57 version 20.2 released May 16, 1997. |
56 version 19.16 released October 31, 1997. | 58 version 19.16 released October 31, 1997. |
57 version 20.3 (the first stable version of XEmacs 20.x) released | 59 version 20.3 (the first stable version of XEmacs 20.x) released November 30, |
58 November 30, 1997. | 60 1997. |
59 version 20.4 released February 28, 1998. | 61 version 20.4 released February 28, 1998. |
62 version 21.0.60 released December 10, 1998. (The version naming scheme was | |
63 changed at this point: [a] the second version number is odd for stable | |
64 versions, even for beta versions; [b] a third version number is added, | |
65 replacing the "beta xxx" ending for beta versions and allowing for | |
66 periodic maintenance releases for stable versions. Therefore, 21.0 was | |
67 never "officially" released; similarly for 21.2, etc.) | |
68 version 21.0.61 released January 4, 1999. | |
69 version 21.0.63 released February 3, 1999. | |
70 version 21.0.64 released March 1, 1999. | |
71 version 21.0.65 released March 5, 1999. | |
72 version 21.0.66 released March 12, 1999. | |
73 version 21.0.67 released March 25, 1999. | |
74 version 21.1.2 released May 14, 1999. (This is the followup to 21.0.67. | |
75 The second version number was bumped to indicate the beginning of the | |
76 "stable" series.) | |
77 version 21.1.3 released June 26, 1999. | |
78 version 21.1.4 released July 8, 1999. | |
79 version 21.1.6 released August 14, 1999. (There was no 21.1.5.) | |
80 version 21.1.7 released September 26, 1999. | |
81 version 21.1.8 released November 2, 1999. | |
82 version 21.1.9 released February 13, 2000. | |
83 version 21.1.10 released May 7, 2000. | |
84 version 21.1.10a released June 24, 2000. | |
85 version 21.1.11 released July 18, 2000. | |
86 version 21.1.12 released August 5, 2000. | |
87 version 21.1.13 released January 7, 2001. | |
88 version 21.1.14 released January 27, 2001. | |
89 version 21.2.9 released February 3, 1999. | |
90 version 21.2.10 released February 5, 1999. | |
91 version 21.2.11 released March 1, 1999. | |
92 version 21.2.12 released March 5, 1999. | |
93 version 21.2.13 released March 12, 1999. | |
94 version 21.2.14 released May 14, 1999. | |
95 version 21.2.15 released June 4, 1999. | |
96 version 21.2.16 released June 11, 1999. | |
97 version 21.2.17 released June 22, 1999. | |
98 version 21.2.18 released July 14, 1999. | |
99 version 21.2.19 released July 30, 1999. | |
100 version 21.2.20 released November 10, 1999. | |
101 version 21.2.21 released November 28, 1999. | |
102 version 21.2.22 released November 29, 1999. | |
103 version 21.2.23 released December 7, 1999. | |
104 version 21.2.24 released December 14, 1999. | |
105 version 21.2.25 released December 24, 1999. | |
106 version 21.2.26 released December 31, 1999. | |
107 version 21.2.27 released January 18, 2000. | |
108 version 21.2.28 released February 7, 2000. | |
109 version 21.2.29 released February 16, 2000. | |
110 version 21.2.30 released February 21, 2000. | |
111 version 21.2.31 released February 23, 2000. | |
112 version 21.2.32 released March 20, 2000. | |
113 version 21.2.33 released May 1, 2000. | |
114 version 21.2.34 released May 28, 2000. | |
115 version 21.2.35 released July 19, 2000. | |
116 version 21.2.36 released October 4, 2000. | |
117 version 21.2.37 released November 14, 2000. | |
118 version 21.2.38 released December 5, 2000. | |
119 version 21.2.39 released December 31, 2000. | |
120 version 21.2.40 released January 8, 2001. | |
121 version 21.2.41 released January 17, 2001. | |
122 version 21.2.42 released January 20, 2001. | |
123 version 21.2.43 released January 26, 2001. | |
124 version 21.2.44 released February 8, 2001. | |
125 version 21.2.45 released February 23, 2001. | |
126 version 21.2.46 released March 21, 2001. | |
60 | 127 |
61 | 128 |
62 -- A time line for GNU Emacs version 19 is | 129 -- A time line for GNU Emacs version 19 is |
63 | 130 |
64 version 19.7 (beta) (first beta release) released ??????; prob. late May 1993. | 131 version 19.7 (beta) (first beta release) released ??????; prob. late May 1993. |
177 | 244 |
178 #include "syssignal.h" /* Always include before systty.h */ | 245 #include "syssignal.h" /* Always include before systty.h */ |
179 #include "systty.h" | 246 #include "systty.h" |
180 #include "sysfile.h" | 247 #include "sysfile.h" |
181 #include "systime.h" | 248 #include "systime.h" |
249 #include "sysproc.h" /* for qxe_getpid() */ | |
182 | 250 |
183 #ifdef PDUMP | 251 #ifdef PDUMP |
184 #include "dumper.h" | 252 #include "dumper.h" |
185 #endif | 253 #endif |
186 | 254 |
187 #ifndef SEPCHAR | |
188 #define SEPCHAR ':' | |
189 #endif | |
190 | |
191 #ifdef QUANTIFY | 255 #ifdef QUANTIFY |
192 #include <quantify.h> | 256 #include <quantify.h> |
193 #endif | 257 #endif |
194 | 258 |
195 #ifdef HAVE_SHLIB | 259 #ifdef HAVE_SHLIB |
196 #include "sysdll.h" | 260 #include "sysdll.h" |
197 #endif | 261 #endif |
198 | 262 |
199 #if defined (HAVE_LOCALE_H) && \ | |
200 (defined (I18N2) || defined (I18N3) || defined (I18N4)) | |
201 #include <locale.h> | |
202 #endif | |
203 | |
204 #ifdef TOOLTALK | 263 #ifdef TOOLTALK |
205 #include TT_C_H_FILE | 264 #include TT_C_H_FILE |
206 #endif | 265 #endif |
207 | 266 |
208 #if defined (WIN32_NATIVE) | 267 #if defined (WIN32_NATIVE) || defined (CYGWIN) |
209 #include "nt.h" | 268 #include "syswindows.h" |
210 #endif | 269 #endif |
211 | 270 |
212 /* For PATH_EXEC */ | 271 /* For PATH_EXEC */ |
213 #include <paths.h> | 272 #include <paths.h> |
214 | 273 |
294 Lisp_Object Vconfigure_info_directory; | 353 Lisp_Object Vconfigure_info_directory; |
295 Lisp_Object Vsite_directory, Vconfigure_site_directory; | 354 Lisp_Object Vsite_directory, Vconfigure_site_directory; |
296 Lisp_Object Vconfigure_info_path; | 355 Lisp_Object Vconfigure_info_path; |
297 Lisp_Object Vinternal_error_checking; | 356 Lisp_Object Vinternal_error_checking; |
298 Lisp_Object Vmail_lock_methods, Vconfigure_mail_lock_method; | 357 Lisp_Object Vmail_lock_methods, Vconfigure_mail_lock_method; |
299 Lisp_Object Vpath_separator; | |
300 | 358 |
301 /* The default base directory XEmacs is installed under. */ | 359 /* The default base directory XEmacs is installed under. */ |
302 Lisp_Object Vconfigure_exec_prefix_directory, Vconfigure_prefix_directory; | 360 Lisp_Object Vconfigure_exec_prefix_directory, Vconfigure_prefix_directory; |
303 | 361 |
304 /* If nonzero, set XEmacs to run at this priority. This is also used | 362 /* If nonzero, set XEmacs to run at this priority. This is also used |
316 int display_arg; | 374 int display_arg; |
317 | 375 |
318 /* Type of display specified. We cannot use a Lisp symbol here because | 376 /* Type of display specified. We cannot use a Lisp symbol here because |
319 Lisp symbols may not initialized at the time that we set this | 377 Lisp symbols may not initialized at the time that we set this |
320 variable. */ | 378 variable. */ |
321 const char *display_use; | 379 const Char_ASCII *display_use; |
322 | 380 |
323 /* If non-zero, then the early error handler will only print the error | 381 /* If non-zero, then the early error handler will only print the error |
324 message and exit. */ | 382 message and exit. */ |
325 int suppress_early_error_handler_backtrace; | 383 int suppress_early_error_handler_backtrace; |
326 | 384 |
398 Lisp_Object Qkill_emacs_hook; | 456 Lisp_Object Qkill_emacs_hook; |
399 Lisp_Object Qsave_buffers_kill_emacs; | 457 Lisp_Object Qsave_buffers_kill_emacs; |
400 | 458 |
401 extern Lisp_Object Vlisp_EXEC_SUFFIXES; | 459 extern Lisp_Object Vlisp_EXEC_SUFFIXES; |
402 | 460 |
403 | |
404 | |
405 /* Ben's capsule summary about expected and unexpected exits from XEmacs. | |
406 | |
407 Expected exits occur when the user directs XEmacs to exit, for example | |
408 by pressing the close button on the only frame in XEmacs, or by typing | |
409 C-x C-c. This runs `save-buffers-kill-emacs', which saves any necessary | |
410 buffers, and then exits using the primitive `kill-emacs'. | |
411 | |
412 However, unexpected exits occur in a few different ways: | |
413 | |
414 -- a memory access violation or other hardware-generated exception | |
415 occurs. This is the worst possible problem to deal with, because | |
416 the fault can occur while XEmacs is in any state whatsoever, even | |
417 quite unstable ones. As a result, we need to be *extremely* careful | |
418 what we do. | |
419 -- we are using one X display (or if we've used more, we've closed the | |
420 others already), and some hardware or other problem happens and | |
421 suddenly we've lost our connection to the display. In this situation, | |
422 things are not so dire as in the last one; our code itself isn't | |
423 trashed, so we can continue execution as normal, after having set | |
424 things up so that we can exit at the appropriate time. Our exit | |
425 still needs to be of the emergency nature; we have no displays, so | |
426 any attempts to use them will fail. We simply want to auto-save | |
427 (the single most important thing to do during shut-down), do minimal | |
428 cleanup of stuff that has an independent existence outside of XEmacs, | |
429 and exit. | |
430 | |
431 Currently, both unexpected exit scenarios described above set | |
432 preparing_for_armageddon to indicate that nonessential and possibly | |
433 dangerous things should not be done, specifically: | |
434 | |
435 -- no garbage collection. | |
436 -- no hooks are run. | |
437 -- no messages of any sort from autosaving. | |
438 -- autosaving tries harder, ignoring certain failures. | |
439 -- existing frames are not deleted. | |
440 | |
441 (Also, all places that set preparing_for_armageddon also | |
442 set dont_check_for_quit. This happens separately because it's | |
443 also necessary to set other variables to make absolutely sure | |
444 no quitting happens.) | |
445 | |
446 In the first scenario above (the access violation), we also set | |
447 fatal_error_in_progress. This causes more things to not happen: | |
448 | |
449 -- assertion failures do not abort. | |
450 -- printing code does not do code conversion or gettext when | |
451 printing to stdout/stderr. | |
452 */ | |
453 | |
454 /* Nonzero if handling a fatal error already. */ | 461 /* Nonzero if handling a fatal error already. */ |
455 int fatal_error_in_progress; | 462 int fatal_error_in_progress; |
456 | 463 |
457 /* Non-nil means we're going down, so we better not run any hooks | 464 /* Nonzero means we're going down, so we better not run any hooks |
458 or do other non-essential stuff. */ | 465 or do other non-essential stuff. */ |
459 int preparing_for_armageddon; | 466 int preparing_for_armageddon; |
460 | 467 |
468 /* Nonzero means we're in an unstable situation and need to skip | |
469 i18n conversions and such during printing. */ | |
470 int inhibit_non_essential_printing_operations; | |
461 | 471 |
462 static JMP_BUF run_temacs_catch; | 472 static JMP_BUF run_temacs_catch; |
463 | 473 |
464 static int run_temacs_argc; | 474 static int run_temacs_argc; |
465 static Extbyte **run_temacs_argv; | 475 static Extbyte **run_temacs_argv; |
466 static Extbyte *run_temacs_args; | 476 static Extbyte *run_temacs_args; |
467 static int run_temacs_argv_size; | 477 static int run_temacs_argv_size; |
468 static int run_temacs_args_size; | 478 static int run_temacs_args_size; |
469 | 479 |
470 static void shut_down_emacs (int sig, Lisp_Object stuff, int no_auto_save); | |
471 | |
472 static void | |
473 ensure_no_quitting_from_now_on (void) | |
474 { | |
475 /* make sure no quitting from now on!! */ | |
476 dont_check_for_quit = 1; | |
477 Vinhibit_quit = Qt; | |
478 Vquit_flag = Qnil; | |
479 } | |
480 | |
481 /* Handle bus errors, illegal instruction, etc. */ | |
482 SIGTYPE | |
483 fatal_error_signal (int sig) | |
484 { | |
485 fatal_error_in_progress++; | |
486 preparing_for_armageddon = 1; | |
487 | |
488 ensure_no_quitting_from_now_on (); | |
489 | |
490 /* Unblock the signal so that if the same signal gets sent in the | |
491 code below, we avoid a deadlock. */ | |
492 EMACS_UNBLOCK_SIGNAL (sig); | |
493 | |
494 /* Only try auto-saving first time through. If we crash in auto-saving, | |
495 don't do it again. */ | |
496 if (fatal_error_in_progress == 1) | |
497 { | |
498 Fdo_auto_save (Qt, Qnil); /* do this before anything hazardous */ | |
499 /* Do this so that the variable has the same value of 2 regardless of | |
500 whether we made it through auto-saving correctly. */ | |
501 fatal_error_in_progress++; | |
502 } | |
503 else if (fatal_error_in_progress == 2) | |
504 stderr_out ("WARNING: Unable to auto-save your files properly.\n" | |
505 "Some or all may in fact have been auto-saved.\n" | |
506 "\n"); | |
507 | |
508 /* Now, reset our signal handler, so the next time, we just die. | |
509 Don't do this before auto-saving. */ | |
510 EMACS_SIGNAL (sig, SIG_DFL); | |
511 | |
512 /* Keep in mind that there's more than one signal that we can crash | |
513 on. */ | |
514 /* If fatal error occurs in code below, avoid infinite recursion. */ | |
515 if (fatal_error_in_progress <= 2) | |
516 { | |
517 shut_down_emacs (sig, Qnil, 1); | |
518 stderr_out ("\nLisp backtrace follows:\n\n"); | |
519 Fbacktrace (Qexternal_debugging_output, Qt); | |
520 # if 0 /* This is evil, rarely useful, and causes grief in some cases. */ | |
521 /* Check for Sun-style stack printing via /proc */ | |
522 { | |
523 const char *pstack = "/usr/proc/bin/pstack"; | |
524 if (access (pstack, X_OK) == 0) | |
525 { | |
526 char buf[100]; | |
527 stderr_out ("\nC backtrace follows:\n" | |
528 "(A real debugger may provide better information)\n\n"); | |
529 sprintf (buf, "%s %d >&2", pstack, (int)getpid()); | |
530 system (buf); | |
531 } | |
532 } | |
533 # endif | |
534 } | |
535 /* Signal the same code; this time it will really be fatal. */ | |
536 kill (getpid (), sig); | |
537 SIGRETURN; | |
538 } | |
539 | |
540 #ifdef _MSC_VER | 480 #ifdef _MSC_VER |
541 | 481 static DWORD mswindows_handle_hardware_exceptions (DWORD code); |
542 static DWORD | 482 #endif |
543 mswindows_handle_hardware_exceptions (DWORD code) | |
544 { | |
545 if (code != STATUS_ACCESS_VIOLATION && code != STATUS_ILLEGAL_INSTRUCTION | |
546 && code != STATUS_PRIVILEGED_INSTRUCTION | |
547 && code != STATUS_DATATYPE_MISALIGNMENT) | |
548 return EXCEPTION_CONTINUE_SEARCH; | |
549 | |
550 /* I don't know if this filter is still wrapped in the outer __try, but | |
551 it doesn't hurt to have another one. --ben | |
552 And it lets us control more exactly what we really want to do in such | |
553 a situation. */ | |
554 __try | |
555 { | |
556 fatal_error_in_progress++; | |
557 preparing_for_armageddon = 1; | |
558 | |
559 ensure_no_quitting_from_now_on (); | |
560 | |
561 /* Only try auto-saving first time through. If we crash in auto-saving, | |
562 don't do it again. */ | |
563 if (fatal_error_in_progress == 1) | |
564 { | |
565 Fdo_auto_save (Qt, Qnil); /* do this before anything hazardous */ | |
566 /* Do this so that the variable has the same value of 2 regardless of | |
567 whether we made it through auto-saving correctly. */ | |
568 fatal_error_in_progress++; | |
569 } | |
570 else if (fatal_error_in_progress == 2) | |
571 stderr_out ("WARNING: Unable to auto-save your files properly.\n" | |
572 "Some or all may in fact have been auto-saved.\n" | |
573 "\n"); | |
574 | |
575 /* If fatal error occurs in code below, avoid infinite recursion. */ | |
576 if (fatal_error_in_progress <= 2) | |
577 { | |
578 shut_down_emacs (-1, Qnil, 1); | |
579 stderr_out ("\nLisp backtrace follows:\n\n"); | |
580 Fbacktrace (Qexternal_debugging_output, Qt); | |
581 } | |
582 } | |
583 /* VC++ documentation says that | |
584 GetExceptionCode() cannot be called inside the filter itself. */ | |
585 | |
586 /* __except (mswindows_handle_hardware_exceptions (GetExceptionCode ())) {} | |
587 | |
588 The line above is original. Unfortunately, when an error is tripped | |
589 inside of the handler (e.g. during Fbacktrace()), and the handler for | |
590 the handler is invoked, it correctly notices that something is amiss | |
591 and it should just return -- but it returns EXCEPTION_CONTINUE_SEARCH, | |
592 which causes the debugger to be invoked debugging the handler code in | |
593 this function -- and WITH THE STACK UNWOUND so that you see main() | |
594 calling mswindows_handle_hardware_exceptions(), calling Fbacktrace(), | |
595 and a crash a couple of frames in -- AND NO SIGN OF THE ORIGINAL CRASH! | |
596 | |
597 There's some real weirdness going on in the stack handling -- unlike | |
598 in Unix, where further crashes just keep adding to the stack, it seems | |
599 that under the structured-exception-handling, the stack can actually | |
600 bounce back and forth between the full stack at the location of the | |
601 exception and the unwound stack at the place where the __try clause was | |
602 established. I don't completely understand it. What I do know is that | |
603 returning EXCEPTION_EXECUTE_HANDLER on nested crash has the effect of | |
604 aborting execution of the handler and going back to the outer filter | |
605 function, which returns EXCEPTION_CONTINUE_SEARCH and everything is | |
606 hunky-dorey -- your debugger sees a crash at the right location with | |
607 the right stack. | |
608 | |
609 I'm leaving in the trickier Unix-like code in the handler; someone who | |
610 understands better than me how the stack works in these handlers could | |
611 fix it up more. As it is, it works pretty well, so I'm not likely to | |
612 touch it more. --ben | |
613 */ | |
614 | |
615 __except (EXCEPTION_EXECUTE_HANDLER) {} | |
616 | |
617 | |
618 /* pretend we didn't handle this, so that the debugger is invoked and/or | |
619 the normal GPF box appears. */ | |
620 return EXCEPTION_CONTINUE_SEARCH; | |
621 } | |
622 | |
623 #endif /* _MSC_VER */ | |
624 | 483 |
625 | 484 |
626 | 485 /************************************************************************/ |
627 #ifdef SIGDANGER | 486 /* Functions to handle arguments */ |
628 | 487 /************************************************************************/ |
629 /* Handler for SIGDANGER. */ | 488 |
630 SIGTYPE | |
631 memory_warning_signal (int sig) | |
632 { | |
633 /* #### bad bad bad; this function shouldn't do anything except | |
634 set a flag, or weird corruption could happen. */ | |
635 EMACS_SIGNAL (sig, memory_warning_signal); | |
636 | |
637 malloc_warning | |
638 (GETTEXT ("Operating system warns that virtual memory is running low.\n")); | |
639 | |
640 /* It might be unsafe to call do_auto_save now. */ | |
641 force_auto_save_soon (); | |
642 } | |
643 #endif /* SIGDANGER */ | |
644 | |
645 /* Code for dealing with Lisp access to the Unix command line */ | 489 /* Code for dealing with Lisp access to the Unix command line */ |
646 | 490 |
647 static Lisp_Object | 491 static Lisp_Object |
648 make_arg_list_1 (int argc, Extbyte **argv, int skip_args) | 492 make_arg_list_1 (int argc, Extbyte **argv, int skip_args) |
649 { | 493 { |
659 { | 503 { |
660 /* Do not trust to what crt0 has stuffed into argv[0] */ | 504 /* Do not trust to what crt0 has stuffed into argv[0] */ |
661 Extbyte full_exe_path[PATH_MAX]; | 505 Extbyte full_exe_path[PATH_MAX]; |
662 Lisp_Object fullpath; | 506 Lisp_Object fullpath; |
663 | 507 |
664 GetModuleFileName (NULL, full_exe_path, PATH_MAX); | 508 qxeGetModuleFileName (NULL, full_exe_path, PATH_MAX); |
665 fullpath = build_ext_string (full_exe_path, Qmswindows_tstr); | 509 fullpath = build_tstr_string (full_exe_path); |
666 result = Fcons (fullpath, result); | 510 result = Fcons (fullpath, result); |
667 #if defined(HAVE_SHLIB) | 511 #if defined(HAVE_SHLIB) |
668 { | 512 { |
669 Extbyte *fullpathext; | 513 Extbyte *fullpathext; |
670 | 514 |
750 { | 594 { |
751 return Fcopy_sequence (Vinvocation_directory); | 595 return Fcopy_sequence (Vinvocation_directory); |
752 } | 596 } |
753 | 597 |
754 | 598 |
755 #ifdef I18N4 | |
756 /* #### - don't know why I18N4 on SunOS/JLE | |
757 can't deal with this. It's a potential | |
758 bug that needs to be looked at. */ | |
759 # undef RUN_TIME_REMAP | |
760 #endif | |
761 | 599 |
762 /* Test whether the next argument in ARGV matches SSTR or a prefix of | 600 /* Test whether the next argument in ARGV matches SSTR or a prefix of |
763 LSTR (at least MINLEN characters). If so, then if VALPTR is non-null | 601 LSTR (at least MINLEN characters). If so, then if VALPTR is non-null |
764 (the argument is supposed to have a value) store in *VALPTR either | 602 (the argument is supposed to have a value) store in *VALPTR either |
765 the next argument or the portion of this one after the equal sign. | 603 the next argument or the portion of this one after the equal sign. |
820 { | 658 { |
821 return 0; | 659 return 0; |
822 } | 660 } |
823 } | 661 } |
824 | 662 |
663 | |
664 /************************************************************************/ | |
665 /* main and friends: XEmacs startup */ | |
666 /************************************************************************/ | |
667 | |
825 /* Make stack traces always identify version + configuration */ | 668 /* Make stack traces always identify version + configuration */ |
826 #define main_1 STACK_TRACE_EYE_CATCHER | 669 #define main_1 STACK_TRACE_EYE_CATCHER |
827 | 670 |
828 /* This function is not static, so that the compiler is less likely to | 671 /* This function is not static, so that the compiler is less likely to |
829 inline it, which would make it not show up in stack traces. | 672 inline it, which would make it not show up in stack traces. |
830 | 673 |
831 The restart argument is a flag that indicates that main_1 is now | 674 The restart argument is a flag that indicates that main_1 is now |
832 being called for the second time in this invocation of xemacs; this can | 675 being called for the second time in this invocation of xemacs; this |
833 only happen in an xemacs that is not loaded with dumped data (temacs | 676 happens as a result of using `run-temacs' in the command line, when |
834 with the conventional dumper or xemacs -nd with the pdumper). See | 677 invoking a bare (without dumped data) XEmacs (i.e. `temacs' with |
678 the conventional dumper or `xemacs -nd' with the pdumper). See | |
835 Frun_emacs_from_temacs(). | 679 Frun_emacs_from_temacs(). |
836 | 680 |
837 restart interacts with initialized as follows (per Olivier Galibert): | 681 restart interacts with initialized as follows (per Olivier Galibert): |
838 | 682 |
839 It's perverted. | 683 It's perverted. |
840 | 684 |
841 initialized==0 => temacs | 685 initialized==0 => temacs |
842 initialized!=0 && restart!=0 => run-temacs | 686 initialized!=0 && restart!=0 => run-temacs |
843 initialized!=0 && restart==0 => xemacs/post pdump_load() | 687 initialized!=0 && restart==0 => either xemacs after conventional dump, |
688 or xemacs post pdump_load() | |
844 */ | 689 */ |
845 DECLARE_DOESNT_RETURN (main_1 (int, char **, char **, int)); | 690 DECLARE_DOESNT_RETURN (main_1 (int, char **, char **, int)); |
846 DOESNT_RETURN | 691 DOESNT_RETURN |
847 main_1 (int argc, char **argv, char **envp, int restart) | 692 main_1 (int argc, char **argv, char **envp, int restart) |
848 { | 693 { |
864 __realloc_hook = NULL; | 709 __realloc_hook = NULL; |
865 __free_hook = NULL; | 710 __free_hook = NULL; |
866 #endif /* not SYSTEM_MALLOC or HAVE_LIBMCHECK or DOUG_LEA_MALLOC */ | 711 #endif /* not SYSTEM_MALLOC or HAVE_LIBMCHECK or DOUG_LEA_MALLOC */ |
867 | 712 |
868 noninteractive = 0; | 713 noninteractive = 0; |
714 inhibit_non_essential_printing_operations = 1; | |
869 | 715 |
870 #ifdef NeXT | 716 #ifdef NeXT |
871 /* 19-Jun-1995 -baw | 717 /* 19-Jun-1995 -baw |
872 * NeXT secret magic, ripped from Emacs-for-NS by Carl Edman | 718 * NeXT secret magic, ripped from Emacs-for-NS by Carl Edman |
873 * <cedman@princeton.edu>. Note that even Carl doesn't know what this | 719 * <cedman@princeton.edu>. Note that even Carl doesn't know what this |
952 #else | 798 #else |
953 printf ("Portable dumper not configured; -sd just forces exit.\n"); | 799 printf ("Portable dumper not configured; -sd just forces exit.\n"); |
954 #endif | 800 #endif |
955 exit (0); | 801 exit (0); |
956 } | 802 } |
957 | 803 |
958 /* Handle the -t switch, which specifies filename to use as terminal */ | 804 /* Handle the -t switch, which specifies filename to use as terminal */ |
959 { | 805 { |
960 char *term; | 806 Extbyte *term; |
961 if (argmatch (argv, argc, "-t", "--terminal", 4, &term, &skip_args)) | 807 if (argmatch (argv, argc, "-t", "--terminal", 4, &term, &skip_args)) |
962 { | 808 { |
963 close (0); | 809 retry_close (0); |
964 close (1); | 810 retry_close (1); |
965 if (open (term, O_RDWR | OPEN_BINARY, 2) < 0) | 811 if (open (term, O_RDWR | OPEN_BINARY, 2) < 0) |
966 fatal ("%s: %s", term, strerror (errno)); | 812 fatal ("%s: %s", term, strerror (errno)); |
967 dup (0); | 813 dup (0); |
968 if (! isatty (0)) | 814 if (! isatty (0)) |
969 fatal ("%s: not a tty", term); | 815 fatal ("%s: not a tty", term); |
992 #if 0 /* I don't think this is correct. */ | 838 #if 0 /* I don't think this is correct. */ |
993 inhibit_autoloads = 1; | 839 inhibit_autoloads = 1; |
994 #endif | 840 #endif |
995 noninteractive = 1; | 841 noninteractive = 1; |
996 } | 842 } |
843 | |
844 #ifdef WIN32_NATIVE | |
845 /* Handle the -nuni switch, which forces XEmacs to use the ANSI | |
846 versions of Unicode-split API's even on Windows NT, which has | |
847 full Unicode support. This helps flush out problems in the code | |
848 we've written to convert between ANSI and Unicode. */ | |
849 if (argmatch (argv, argc, "-nuni", "--no-unicode-lib-calls", 6, NULL, | |
850 &skip_args)) | |
851 no_mswin_unicode_lib_calls = 1; | |
852 #endif /* WIN32_NATIVE */ | |
997 | 853 |
998 /* #### is it correct that -debug-paths is handled here (and presumably | 854 /* #### is it correct that -debug-paths is handled here (and presumably |
999 removed), and then checked again below? */ | 855 removed), and then checked again below? */ |
1000 if (argmatch (argv, argc, "-debug-paths", "--debug-paths", | 856 if (argmatch (argv, argc, "-debug-paths", "--debug-paths", |
1001 11, NULL, &skip_args)) | 857 11, NULL, &skip_args)) |
1121 if (dpy && dpy[0]) | 977 if (dpy && dpy[0]) |
1122 display_use = "gtk"; | 978 display_use = "gtk"; |
1123 } | 979 } |
1124 #endif | 980 #endif |
1125 #ifdef HAVE_MS_WINDOWS | 981 #ifdef HAVE_MS_WINDOWS |
1126 if (strcmp(display_use, "x") != 0) | 982 if (strcmp (display_use, "x") != 0) |
1127 display_use = "mswindows"; | 983 display_use = "mswindows"; |
1128 #endif /* HAVE_MS_WINDOWS */ | 984 #endif /* HAVE_MS_WINDOWS */ |
1129 } | 985 } |
1130 #endif /* HAVE_WINDOW_SYSTEM */ | 986 #endif /* HAVE_WINDOW_SYSTEM */ |
1131 | 987 |
1143 init_floatfns_very_early (); /* Catch floating-point math errors. */ | 999 init_floatfns_very_early (); /* Catch floating-point math errors. */ |
1144 #endif | 1000 #endif |
1145 init_process_times_very_early (); /* Initialize our process timers. | 1001 init_process_times_very_early (); /* Initialize our process timers. |
1146 As early as possible, of course, | 1002 As early as possible, of course, |
1147 so we can be fairly accurate. */ | 1003 so we can be fairly accurate. */ |
1148 init_intl_very_early (); /* set up the locale and domain for gettext and | 1004 |
1149 such. */ | 1005 #ifdef HAVE_WIN32_CODING_SYSTEMS |
1006 init_win32_very_early (); | |
1007 #endif | |
1150 #ifdef HAVE_MS_WINDOWS | 1008 #ifdef HAVE_MS_WINDOWS |
1151 init_mswindows_very_early (); /* Some things - like dde need to be | 1009 /* Depends on XEUNICODE_P, only accurate after the previous call */ |
1152 initialized early so that the | 1010 init_mswindows_dde_very_early (); /* DDE needs to be initialized early so |
1153 client doesn't give up waiting. */ | 1011 that the client doesn't give up |
1012 waiting. */ | |
1154 #endif | 1013 #endif |
1155 | 1014 |
1156 /* Now initialize the Lisp engine and the like. Done only during | 1015 /* Now initialize the Lisp engine and the like. Done only during |
1157 dumping. No dependence on anything that may be in the user's | 1016 dumping. No dependence on anything that may be in the user's |
1158 environment when the dumped XEmacs is run. | 1017 environment when the dumped XEmacs is run. |
1165 | 1024 |
1166 purify_flag = 0; | 1025 purify_flag = 0; |
1167 #ifdef PDUMP | 1026 #ifdef PDUMP |
1168 if (restart) | 1027 if (restart) |
1169 initialized = 1; | 1028 initialized = 1; |
1170 else if (nodumpfile) { | 1029 else if (nodumpfile) |
1171 initialized = 0; | 1030 { |
1172 purify_flag = 1; | 1031 initialized = 0; |
1173 } else { | |
1174 | |
1175 /* Keep command options from getting stomped. | |
1176 | |
1177 Some LISP-visible options are changed by XEmacs _after_ the data is | |
1178 dumped in building a --pdump XEmacs, but _before_ it is restored in | |
1179 normal operation. Thus the restored values overwrite the values | |
1180 XEmacs is getting at run-time. Such variables must be saved here, | |
1181 and restored after loading the dumped data. | |
1182 | |
1183 Boy, this is ugly, but how else to do it? | |
1184 */ | |
1185 | |
1186 /* noninteractive1 is saved in noninteractive, which isn't LISP-visible */ | |
1187 int inhibit_early_packages_save = inhibit_early_packages; | |
1188 int inhibit_autoloads_save = inhibit_autoloads; | |
1189 int debug_paths_save = debug_paths; | |
1190 /* #### Give inhibit-site-lisp a command switch? If so, uncomment: */ | |
1191 /* int inhibit_site_lisp_save = inhibit_site_lisp; */ | |
1192 int inhibit_site_modules_save = inhibit_site_modules; | |
1193 | |
1194 initialized = pdump_load (argv[0]); | |
1195 | |
1196 /* Now unstomp everything */ | |
1197 noninteractive1 = noninteractive; | |
1198 inhibit_early_packages = inhibit_early_packages_save; | |
1199 inhibit_autoloads = inhibit_autoloads_save; | |
1200 debug_paths = debug_paths_save; | |
1201 /* #### Give inhibit-site-lisp a command switch? If so, uncomment: */ | |
1202 /* inhibit_site_lisp = inhibit_site_lisp_save; */ | |
1203 inhibit_site_modules = inhibit_site_modules_save; | |
1204 | |
1205 if (initialized) | |
1206 run_temacs_argc = -1; | |
1207 else | |
1208 purify_flag = 1; | 1032 purify_flag = 1; |
1209 } | 1033 } |
1034 else | |
1035 { | |
1036 | |
1037 /* Keep command options from getting stomped. | |
1038 | |
1039 Some LISP-visible options are changed by XEmacs _after_ the data is | |
1040 dumped in building a --pdump XEmacs, but _before_ it is restored in | |
1041 normal operation. Thus the restored values overwrite the values | |
1042 XEmacs is getting at run-time. Such variables must be saved here, | |
1043 and restored after loading the dumped data. | |
1044 | |
1045 Boy, this is ugly, but how else to do it? | |
1046 */ | |
1047 | |
1048 /* noninteractive1 is saved in noninteractive, which isn't | |
1049 LISP-visible */ | |
1050 int inhibit_early_packages_save = inhibit_early_packages; | |
1051 int inhibit_autoloads_save = inhibit_autoloads; | |
1052 int debug_paths_save = debug_paths; | |
1053 /* #### Give inhibit-site-lisp a command switch? If so, uncomment: */ | |
1054 /* int inhibit_site_lisp_save = inhibit_site_lisp; */ | |
1055 int inhibit_site_modules_save = inhibit_site_modules; | |
1056 | |
1057 initialized = pdump_load (argv[0]); | |
1058 | |
1059 /* Now unstomp everything */ | |
1060 noninteractive1 = noninteractive; | |
1061 inhibit_early_packages = inhibit_early_packages_save; | |
1062 inhibit_autoloads = inhibit_autoloads_save; | |
1063 debug_paths = debug_paths_save; | |
1064 /* #### Give inhibit-site-lisp a command switch? If so, uncomment: */ | |
1065 /* inhibit_site_lisp = inhibit_site_lisp_save; */ | |
1066 inhibit_site_modules = inhibit_site_modules_save; | |
1067 | |
1068 if (initialized) | |
1069 run_temacs_argc = -1; | |
1070 else | |
1071 purify_flag = 1; | |
1072 } | |
1210 #else | 1073 #else |
1211 if (!initialized) | 1074 if (!initialized) |
1212 purify_flag = 1; | 1075 purify_flag = 1; |
1213 #endif | 1076 #endif |
1077 | |
1078 if (initialized) | |
1079 { | |
1080 /* Reset some vars that were also set during loadup (we called | |
1081 these same functions below) */ | |
1082 init_alloc_early (); | |
1083 } | |
1214 | 1084 |
1215 if (!initialized) | 1085 if (!initialized) |
1216 { | 1086 { |
1217 /* Initialize things so that new Lisp objects | 1087 /* Initialize things so that new Lisp objects |
1218 can be created and objects can be staticpro'd. | 1088 can be created and objects can be staticpro'd. |
1230 So that DEFERROR*() can be called. */ | 1100 So that DEFERROR*() can be called. */ |
1231 init_errors_once_early (); | 1101 init_errors_once_early (); |
1232 | 1102 |
1233 /* Make sure that opaque pointers can be created. */ | 1103 /* Make sure that opaque pointers can be created. */ |
1234 init_opaque_once_early (); | 1104 init_opaque_once_early (); |
1105 | |
1106 /* Make sure that hash tables can be created. */ | |
1107 init_elhash_once_early (); | |
1108 | |
1109 /* Make sure that eistrings can be created. */ | |
1110 init_eistring_once_early (); | |
1111 | |
1112 /* Initialize some vars that will also be reset post-dumping | |
1113 (see above) */ | |
1114 init_alloc_early (); | |
1235 | 1115 |
1236 /* Now declare all the symbols and define all the Lisp primitives. | 1116 /* Now declare all the symbols and define all the Lisp primitives. |
1237 | 1117 |
1238 The *only* thing that the syms_of_*() functions are allowed to do | 1118 The *only* thing that the syms_of_*() functions are allowed to do |
1239 is call one of the following: | 1119 is call one of the following: |
1342 syms_of_symbols (); | 1222 syms_of_symbols (); |
1343 syms_of_syntax (); | 1223 syms_of_syntax (); |
1344 #ifdef HAVE_SCROLLBARS | 1224 #ifdef HAVE_SCROLLBARS |
1345 syms_of_scrollbar (); | 1225 syms_of_scrollbar (); |
1346 #endif | 1226 #endif |
1227 syms_of_text (); | |
1347 #ifdef HAVE_TOOLBARS | 1228 #ifdef HAVE_TOOLBARS |
1348 syms_of_toolbar (); | 1229 syms_of_toolbar (); |
1349 #endif | 1230 #endif |
1350 syms_of_undo (); | 1231 syms_of_undo (); |
1351 syms_of_widget (); | 1232 syms_of_widget (); |
1352 syms_of_window (); | 1233 syms_of_window (); |
1353 | 1234 |
1354 #ifdef HAVE_TTY | 1235 #ifdef HAVE_TTY |
1355 syms_of_console_tty (); | 1236 syms_of_console_tty (); |
1356 syms_of_device_tty (); | 1237 syms_of_device_tty (); |
1238 syms_of_frame_tty (); | |
1357 syms_of_objects_tty (); | 1239 syms_of_objects_tty (); |
1358 #endif | 1240 #endif |
1359 | 1241 |
1360 #ifdef HAVE_GTK | 1242 #ifdef HAVE_GTK |
1361 syms_of_device_gtk (); | 1243 syms_of_device_gtk (); |
1370 #ifdef HAVE_MENUBARS | 1252 #ifdef HAVE_MENUBARS |
1371 syms_of_menubar_gtk (); | 1253 syms_of_menubar_gtk (); |
1372 #endif | 1254 #endif |
1373 syms_of_select_gtk (); | 1255 syms_of_select_gtk (); |
1374 | 1256 |
1375 #if defined (HAVE_MENUBARS) || defined(HAVE_SCROLLBARS) || defined(HAVE_DIALOGS) || defined(HAVE_TOOLBARS) | 1257 #ifdef HAVE_GUI_OBJECTS |
1376 syms_of_gui_gtk (); | 1258 syms_of_gui_gtk (); |
1377 #endif | 1259 #endif |
1378 #endif /* HAVE_GTK */ | 1260 #endif /* HAVE_GTK */ |
1379 | 1261 |
1380 #ifdef HAVE_X_WINDOWS | 1262 #ifdef HAVE_X_WINDOWS |
1381 #ifdef HAVE_BALLOON_HELP | 1263 #ifdef HAVE_BALLOON_HELP |
1382 syms_of_balloon_x (); | 1264 syms_of_balloon_x (); |
1383 #endif | 1265 #endif |
1384 syms_of_device_x (); | 1266 syms_of_device_x (); |
1385 #ifdef HAVE_DIALOGS | 1267 #ifdef HAVE_X_DIALOGS |
1386 syms_of_dialog_x (); | 1268 syms_of_dialog_x (); |
1387 #endif | 1269 #endif |
1388 syms_of_frame_x (); | 1270 syms_of_frame_x (); |
1389 syms_of_glyphs_x (); | 1271 syms_of_glyphs_x (); |
1390 syms_of_objects_x (); | 1272 syms_of_objects_x (); |
1391 #ifdef HAVE_MENUBARS | 1273 #ifdef HAVE_MENUBARS |
1392 syms_of_menubar_x (); | 1274 syms_of_menubar_x (); |
1393 #endif | 1275 #endif |
1394 syms_of_select_x (); | 1276 syms_of_select_x (); |
1395 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS) | 1277 #ifdef HAVE_GUI_OBJECTS |
1396 syms_of_gui_x (); | 1278 syms_of_gui_x (); |
1397 #endif | 1279 #endif |
1280 syms_of_intl_x (); | |
1398 #ifdef HAVE_XIM | 1281 #ifdef HAVE_XIM |
1399 #ifdef XIM_XLIB | 1282 #ifdef XIM_XLIB |
1400 syms_of_input_method_xlib (); | 1283 syms_of_input_method_xlib (); |
1401 #endif | 1284 #endif |
1402 #endif /* HAVE_XIM */ | 1285 #endif /* HAVE_XIM */ |
1403 #endif /* HAVE_X_WINDOWS */ | 1286 #endif /* HAVE_X_WINDOWS */ |
1404 | 1287 |
1405 #ifdef HAVE_MS_WINDOWS | 1288 #ifdef HAVE_MS_WINDOWS |
1406 syms_of_console_mswindows (); | 1289 syms_of_console_mswindows (); |
1407 syms_of_device_mswindows (); | 1290 syms_of_device_mswindows (); |
1291 #ifdef HAVE_DIALOGS | |
1408 syms_of_dialog_mswindows (); | 1292 syms_of_dialog_mswindows (); |
1293 #endif | |
1409 syms_of_frame_mswindows (); | 1294 syms_of_frame_mswindows (); |
1410 syms_of_objects_mswindows (); | 1295 syms_of_objects_mswindows (); |
1411 syms_of_select_mswindows (); | 1296 syms_of_select_mswindows (); |
1412 syms_of_glyphs_mswindows (); | 1297 syms_of_glyphs_mswindows (); |
1298 #ifdef HAVE_GUI_OBJECTS | |
1413 syms_of_gui_mswindows (); | 1299 syms_of_gui_mswindows (); |
1300 #endif | |
1414 #ifdef HAVE_MENUBARS | 1301 #ifdef HAVE_MENUBARS |
1415 syms_of_menubar_mswindows (); | 1302 syms_of_menubar_mswindows (); |
1416 #endif | 1303 #endif |
1417 #ifdef HAVE_SCROLLBARS | 1304 #ifdef HAVE_SCROLLBARS |
1418 syms_of_scrollbar_mswindows (); | 1305 syms_of_scrollbar_mswindows (); |
1420 #endif /* HAVE_MS_WINDOWS */ | 1307 #endif /* HAVE_MS_WINDOWS */ |
1421 #ifdef HAVE_MSW_C_DIRED | 1308 #ifdef HAVE_MSW_C_DIRED |
1422 syms_of_dired_mswindows (); | 1309 syms_of_dired_mswindows (); |
1423 #endif | 1310 #endif |
1424 #ifdef WIN32_NATIVE | 1311 #ifdef WIN32_NATIVE |
1425 syms_of_ntproc (); | 1312 syms_of_nt (); |
1426 #endif | 1313 #endif |
1427 #if defined (WIN32_NATIVE) || defined (CYGWIN) | 1314 #if defined (WIN32_NATIVE) || defined (CYGWIN) |
1428 syms_of_win32 (); | 1315 syms_of_win32 (); |
1429 #endif | 1316 #endif |
1430 | 1317 |
1318 syms_of_file_coding (); | |
1319 syms_of_unicode (); | |
1431 #ifdef MULE | 1320 #ifdef MULE |
1432 syms_of_mule (); | |
1433 syms_of_mule_ccl (); | 1321 syms_of_mule_ccl (); |
1434 syms_of_mule_charset (); | 1322 syms_of_mule_charset (); |
1435 #endif | 1323 syms_of_mule_coding (); |
1436 #ifdef FILE_CODING | |
1437 syms_of_file_coding (); | |
1438 #endif | |
1439 #ifdef MULE | |
1440 #ifdef HAVE_WNN | 1324 #ifdef HAVE_WNN |
1441 syms_of_mule_wnn (); | 1325 syms_of_mule_wnn (); |
1442 #endif | 1326 #endif |
1443 #ifdef HAVE_CANNA | 1327 #ifdef HAVE_CANNA |
1444 syms_of_mule_canna (); | 1328 syms_of_mule_canna (); |
1445 #endif /* HAVE_CANNA */ | 1329 #endif /* HAVE_CANNA */ |
1446 #endif /* MULE */ | 1330 #endif /* MULE */ |
1331 | |
1332 #ifdef HAVE_WIN32_CODING_SYSTEMS | |
1333 syms_of_intl_win32 (); | |
1334 #endif | |
1447 | 1335 |
1448 #ifdef SYMS_SYSTEM | 1336 #ifdef SYMS_SYSTEM |
1449 SYMS_SYSTEM; | 1337 SYMS_SYSTEM; |
1450 #endif | 1338 #endif |
1451 | 1339 |
1546 console_type_create_scrollbar_x (); | 1434 console_type_create_scrollbar_x (); |
1547 #endif | 1435 #endif |
1548 #ifdef HAVE_TOOLBARS | 1436 #ifdef HAVE_TOOLBARS |
1549 console_type_create_toolbar_x (); | 1437 console_type_create_toolbar_x (); |
1550 #endif | 1438 #endif |
1551 #ifdef HAVE_DIALOGS | 1439 #ifdef HAVE_X_DIALOGS |
1552 console_type_create_dialog_x (); | 1440 console_type_create_dialog_x (); |
1553 #endif | 1441 #endif |
1554 #endif /* HAVE_X_WINDOWS */ | 1442 #endif /* HAVE_X_WINDOWS */ |
1555 | 1443 |
1556 #ifdef HAVE_MS_WINDOWS | 1444 #ifdef HAVE_MS_WINDOWS |
1592 specifier_type_create_objects (); | 1480 specifier_type_create_objects (); |
1593 #ifdef HAVE_TOOLBARS | 1481 #ifdef HAVE_TOOLBARS |
1594 specifier_type_create_toolbar (); | 1482 specifier_type_create_toolbar (); |
1595 #endif | 1483 #endif |
1596 | 1484 |
1485 /* Now initialize the coding system types and associated symbols. | |
1486 Other than the first function below, the functions may | |
1487 make exactly the following function/macro calls: | |
1488 | |
1489 INITIALIZE_CODING_SYSTEM_TYPE() | |
1490 CODING_SYSTEM_HAS_METHOD() | |
1491 | |
1492 For any given coding system type, the former macro must be called | |
1493 before the any calls to the latter macro. */ | |
1494 | |
1495 coding_system_type_create (); | |
1496 coding_system_type_create_unicode (); | |
1497 #ifdef HAVE_WIN32_CODING_SYSTEMS | |
1498 coding_system_type_create_intl_win32 (); | |
1499 #endif | |
1500 #ifdef MULE | |
1501 coding_system_type_create_mule_coding (); | |
1502 #endif | |
1503 | |
1597 /* Now initialize the structure types and associated symbols. | 1504 /* Now initialize the structure types and associated symbols. |
1598 Other than the first function below, the functions may | 1505 Other than the first function below, the functions may |
1599 make exactly the following function/macro calls: | 1506 make exactly the following function/macro calls: |
1600 | 1507 |
1601 define_structure_type() | 1508 define_structure_type() |
1644 LSTREAM_HAS_METHOD() | 1551 LSTREAM_HAS_METHOD() |
1645 | 1552 |
1646 */ | 1553 */ |
1647 | 1554 |
1648 lstream_type_create (); | 1555 lstream_type_create (); |
1649 #ifdef FILE_CODING | |
1650 lstream_type_create_file_coding (); | 1556 lstream_type_create_file_coding (); |
1651 #endif | |
1652 #if defined (HAVE_MS_WINDOWS) && !defined(HAVE_MSG_SELECT) | 1557 #if defined (HAVE_MS_WINDOWS) && !defined(HAVE_MSG_SELECT) |
1653 lstream_type_create_mswindows_selectable (); | 1558 lstream_type_create_mswindows_selectable (); |
1654 #endif | 1559 #endif |
1655 | 1560 |
1656 /* Initialize processes implementation. | 1561 /* Initialize processes implementation. |
1667 | 1572 |
1668 /* Now initialize most variables. | 1573 /* Now initialize most variables. |
1669 | 1574 |
1670 These functions may do exactly the following: | 1575 These functions may do exactly the following: |
1671 | 1576 |
1672 DEFVAR_INT() | 1577 -- assigning a symbol or constant value to a variable |
1673 DEFVAR_LISP() | 1578 -- using a global variable that has been initialized |
1674 DEFVAR_BOOL() | 1579 earlier on in the same function |
1675 DEFER_GETTEXT() | 1580 -- DEFVAR_INT() |
1676 Dynarr_*() | 1581 -- DEFVAR_LISP() |
1677 Blocktype_*() | 1582 -- DEFVAR_BOOL() |
1678 staticpro() | 1583 -- DEFER_GETTEXT() |
1679 Fprovide(symbol) | 1584 -- staticpro*() |
1680 intern() | 1585 -- xmalloc*(), xnew*(), and friends |
1681 Fput() | 1586 -- Dynarr_*() |
1682 xmalloc() | 1587 -- Blocktype_*() |
1683 defsymbol(), if it's absolutely necessary and you're sure that | 1588 -- Fprovide(symbol) |
1684 the symbol isn't referenced anywhere else in the initialization | 1589 -- intern() |
1685 code | 1590 -- Fput() |
1686 Fset() on a symbol that is unbound | 1591 -- dump_add_*() |
1687 assigning a symbol or constant value to a variable | 1592 -- C library functions with no external dependencies, e.g. str*() |
1688 using a global variable that has been initialized | 1593 -- defsymbol(), if it's absolutely necessary and you're sure that |
1689 earlier on in the same function | 1594 the symbol isn't referenced anywhere else in the initialization |
1690 | 1595 code |
1691 Any of the object-creating functions in alloc.c: e.g. | 1596 -- Fset() on a symbol that is unbound |
1692 | 1597 -- Any of the object-creating functions in alloc.c: e.g. |
1693 make_pure_*() | 1598 - make_string() |
1694 make_string() | 1599 - build_intstring() |
1695 build_string() | 1600 - build_string() |
1696 make_vector() | 1601 - make_vector() |
1697 make_int() | 1602 - make_int() |
1698 make_extent() | 1603 - make_char() |
1699 alloc_lcrecord() | 1604 - make_extent() |
1700 Fcons() | 1605 - alloc_lcrecord() |
1701 listN() | 1606 - Fcons() |
1702 make_opaque_ptr() | 1607 - listN() |
1608 - make_lcrecord_list() | |
1609 -- make_opaque_ptr() | |
1610 -- make_lisp_hash_table() (not allowed in 21.4!) | |
1611 -- certain specifier creation functions (but be careful; see | |
1612 glyphs.c for examples) | |
1703 | 1613 |
1704 perhaps a few others. | 1614 perhaps a few others. |
1615 | |
1616 NO EXTERNAL-FORMAT CONVERSIONS. | |
1705 | 1617 |
1706 NB: Initialization or assignment should not be done here to certain | 1618 NB: Initialization or assignment should not be done here to certain |
1707 variables settable from the command line. See the comment above | 1619 variables settable from the command line. See the comment above |
1708 the call to pdump_load() in main_1(). This caveat should only | 1620 the call to pdump_load() in main_1(). This caveat should only |
1709 apply to vars_of_emacs(). | 1621 apply to vars_of_emacs(). |
1739 vars_of_doc (); | 1651 vars_of_doc (); |
1740 #ifdef HAVE_DRAGNDROP | 1652 #ifdef HAVE_DRAGNDROP |
1741 vars_of_dragdrop (); | 1653 vars_of_dragdrop (); |
1742 #endif | 1654 #endif |
1743 vars_of_editfns (); | 1655 vars_of_editfns (); |
1744 vars_of_elhash (); | |
1745 vars_of_emacs (); | 1656 vars_of_emacs (); |
1746 vars_of_eval (); | 1657 vars_of_eval (); |
1658 init_eval_early (); | |
1747 | 1659 |
1748 #ifdef HAVE_X_WINDOWS | 1660 #ifdef HAVE_X_WINDOWS |
1749 vars_of_event_Xt (); | 1661 vars_of_event_Xt (); |
1750 #endif | 1662 #endif |
1751 #if defined(HAVE_TTY) && (defined (DEBUG_TTY_EVENT_STREAM) || !defined (HAVE_X_WINDOWS)) | 1663 #if defined(HAVE_TTY) && (defined (DEBUG_TTY_EVENT_STREAM) || !defined (HAVE_X_WINDOWS)) |
1757 vars_of_event_stream (); | 1669 vars_of_event_stream (); |
1758 | 1670 |
1759 vars_of_events (); | 1671 vars_of_events (); |
1760 vars_of_extents (); | 1672 vars_of_extents (); |
1761 vars_of_faces (); | 1673 vars_of_faces (); |
1674 vars_of_file_coding (); | |
1762 vars_of_fileio (); | 1675 vars_of_fileio (); |
1763 #ifdef CLASH_DETECTION | 1676 #ifdef CLASH_DETECTION |
1764 vars_of_filelock (); | 1677 vars_of_filelock (); |
1765 #endif | 1678 #endif |
1766 vars_of_floatfns (); | 1679 vars_of_floatfns (); |
1680 vars_of_fns (); | |
1767 vars_of_font_lock (); | 1681 vars_of_font_lock (); |
1768 vars_of_frame (); | 1682 vars_of_frame (); |
1769 vars_of_glyphs (); | 1683 vars_of_glyphs (); |
1770 vars_of_glyphs_eimage (); | 1684 vars_of_glyphs_eimage (); |
1771 vars_of_glyphs_widget (); | 1685 vars_of_glyphs_widget (); |
1772 vars_of_gui (); | 1686 vars_of_gui (); |
1773 vars_of_gutter (); | 1687 vars_of_gutter (); |
1774 vars_of_indent (); | 1688 vars_of_indent (); |
1775 vars_of_insdel (); | 1689 vars_of_insdel (); |
1776 vars_of_intl (); | 1690 vars_of_intl (); |
1691 #ifdef HAVE_WIN32_CODING_SYSTEMS | |
1692 vars_of_intl_win32 (); | |
1693 #endif | |
1777 #ifdef HAVE_XIM | 1694 #ifdef HAVE_XIM |
1778 #ifdef XIM_MOTIF | 1695 #ifdef XIM_MOTIF |
1779 vars_of_input_method_motif (); | 1696 vars_of_input_method_motif (); |
1780 #else /* XIM_XLIB */ | 1697 #else /* XIM_XLIB */ |
1781 vars_of_input_method_xlib (); | 1698 vars_of_input_method_xlib (); |
1824 vars_of_search (); | 1741 vars_of_search (); |
1825 vars_of_select (); | 1742 vars_of_select (); |
1826 vars_of_sound (); | 1743 vars_of_sound (); |
1827 vars_of_symbols (); | 1744 vars_of_symbols (); |
1828 vars_of_syntax (); | 1745 vars_of_syntax (); |
1746 vars_of_text (); | |
1829 #ifdef HAVE_TOOLBARS | 1747 #ifdef HAVE_TOOLBARS |
1830 vars_of_toolbar (); | 1748 vars_of_toolbar (); |
1831 #endif | 1749 #endif |
1832 vars_of_undo (); | 1750 vars_of_undo (); |
1833 vars_of_window (); | 1751 vars_of_window (); |
1752 #if defined (WIN32_NATIVE) || defined (CYGWIN) | |
1753 vars_of_win32 (); | |
1754 #endif | |
1834 | 1755 |
1835 #ifdef HAVE_TTY | 1756 #ifdef HAVE_TTY |
1836 vars_of_console_tty (); | 1757 vars_of_console_tty (); |
1837 vars_of_frame_tty (); | 1758 vars_of_frame_tty (); |
1838 vars_of_objects_tty (); | 1759 vars_of_objects_tty (); |
1863 #ifdef HAVE_X_WINDOWS | 1784 #ifdef HAVE_X_WINDOWS |
1864 #ifdef HAVE_BALLOON_HELP | 1785 #ifdef HAVE_BALLOON_HELP |
1865 vars_of_balloon_x (); | 1786 vars_of_balloon_x (); |
1866 #endif | 1787 #endif |
1867 vars_of_device_x (); | 1788 vars_of_device_x (); |
1868 #ifdef HAVE_DIALOGS | 1789 #ifdef HAVE_X_DIALOGS |
1869 vars_of_dialog_x (); | 1790 vars_of_dialog_x (); |
1870 #endif | 1791 #endif |
1871 vars_of_frame_x (); | 1792 vars_of_frame_x (); |
1872 vars_of_glyphs_x (); | 1793 vars_of_glyphs_x (); |
1873 #ifdef HAVE_MENUBARS | 1794 #ifdef HAVE_MENUBARS |
1876 vars_of_objects_x (); | 1797 vars_of_objects_x (); |
1877 vars_of_select_x (); | 1798 vars_of_select_x (); |
1878 #ifdef HAVE_SCROLLBARS | 1799 #ifdef HAVE_SCROLLBARS |
1879 vars_of_scrollbar_x (); | 1800 vars_of_scrollbar_x (); |
1880 #endif | 1801 #endif |
1881 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS) | 1802 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_X_DIALOGS) || defined (HAVE_TOOLBARS) |
1882 vars_of_gui_x (); | 1803 vars_of_gui_x (); |
1883 #endif | 1804 #endif |
1884 #endif /* HAVE_X_WINDOWS */ | 1805 #endif /* HAVE_X_WINDOWS */ |
1885 | 1806 |
1886 | 1807 |
1904 vars_of_dialog_mswindows (); | 1825 vars_of_dialog_mswindows (); |
1905 #endif | 1826 #endif |
1906 #endif /* HAVE_MS_WINDOWS */ | 1827 #endif /* HAVE_MS_WINDOWS */ |
1907 | 1828 |
1908 #ifdef MULE | 1829 #ifdef MULE |
1909 vars_of_mule (); | |
1910 vars_of_mule_ccl (); | 1830 vars_of_mule_ccl (); |
1911 vars_of_mule_charset (); | 1831 vars_of_mule_charset (); |
1912 #endif | 1832 #endif |
1913 #ifdef FILE_CODING | |
1914 vars_of_file_coding (); | 1833 vars_of_file_coding (); |
1915 #endif | 1834 vars_of_unicode (); |
1916 #ifdef MULE | 1835 #ifdef MULE |
1836 vars_of_mule_coding (); | |
1917 #ifdef HAVE_WNN | 1837 #ifdef HAVE_WNN |
1918 vars_of_mule_wnn (); | 1838 vars_of_mule_wnn (); |
1919 #endif | 1839 #endif |
1920 #ifdef HAVE_CANNA | 1840 #ifdef HAVE_CANNA |
1921 vars_of_mule_canna (); | 1841 vars_of_mule_canna (); |
1933 #ifdef HAVE_LDAP | 1853 #ifdef HAVE_LDAP |
1934 vars_of_eldap (); | 1854 vars_of_eldap (); |
1935 #endif | 1855 #endif |
1936 | 1856 |
1937 #ifdef HAVE_POSTGRESQL | 1857 #ifdef HAVE_POSTGRESQL |
1938 vars_of_postgresql(); | 1858 vars_of_postgresql (); |
1939 #endif | 1859 #endif |
1940 | 1860 |
1941 #ifdef HAVE_GPM | 1861 #ifdef HAVE_GPM |
1942 vars_of_gpmevent (); | 1862 vars_of_gpmevent (); |
1943 #endif | 1863 #endif |
1973 /* Now comes all the rest of the variables that couldn't | 1893 /* Now comes all the rest of the variables that couldn't |
1974 be handled above. There may be dependencies on variables | 1894 be handled above. There may be dependencies on variables |
1975 initialized above, and dependencies between one complex_vars_() | 1895 initialized above, and dependencies between one complex_vars_() |
1976 function and another. */ | 1896 function and another. */ |
1977 | 1897 |
1898 #ifdef MULE | |
1899 /* These two depend on hash tables and various variables declared | |
1900 earlier. The second may also depend on the first. */ | |
1901 complex_vars_of_mule_charset (); | |
1902 #endif | |
1903 complex_vars_of_file_coding (); | |
1904 #ifdef HAVE_WIN32_CODING_SYSTEMS | |
1905 complex_vars_of_intl_win32 (); | |
1906 #endif | |
1907 | |
1978 /* Calls Fmake_range_table(). */ | 1908 /* Calls Fmake_range_table(). */ |
1979 complex_vars_of_regex (); | 1909 complex_vars_of_regex (); |
1980 /* Calls Fmake_range_table(). */ | 1910 /* Calls Fmake_range_table(). */ |
1981 complex_vars_of_search (); | 1911 complex_vars_of_search (); |
1982 | 1912 |
1983 /* Calls make_lisp_hash_table(). */ | 1913 /* Depends on specifiers. */ |
1984 complex_vars_of_extents (); | |
1985 | |
1986 /* Depends on hash tables and specifiers. */ | |
1987 complex_vars_of_faces (); | 1914 complex_vars_of_faces (); |
1988 | |
1989 #ifdef MULE | |
1990 /* These two depend on hash tables and various variables declared | |
1991 earlier. The second may also depend on the first. */ | |
1992 complex_vars_of_mule_charset (); | |
1993 #endif | |
1994 #ifdef FILE_CODING | |
1995 complex_vars_of_file_coding (); | |
1996 #endif | |
1997 | 1915 |
1998 /* This calls allocate_glyph(), which creates specifiers | 1916 /* This calls allocate_glyph(), which creates specifiers |
1999 and also relies on a variable (Vthe_nothing_vector) initialized | 1917 and also relies on a variable (Vthe_nothing_vector) initialized |
2000 above. It also calls make_ext_string(), which under Mule | 1918 above. */ |
2001 could require that the charsets be initialized. */ | |
2002 complex_vars_of_glyphs (); | 1919 complex_vars_of_glyphs (); |
2003 | 1920 |
2004 /* These rely on the glyphs just created in the previous function, | 1921 /* These rely on the glyphs just created in the previous function, |
2005 and call Fadd_spec_to_specifier(), which relies on various | 1922 and call Fadd_spec_to_specifier(), which relies on various |
2006 variables initialized above. */ | 1923 variables initialized above. */ |
2068 hash tables and Ffset() (both of which depend on some variables | 1985 hash tables and Ffset() (both of which depend on some variables |
2069 initialized in the vars_of_*() section) and possibly other | 1986 initialized in the vars_of_*() section) and possibly other |
2070 stuff. */ | 1987 stuff. */ |
2071 complex_vars_of_keymap (); | 1988 complex_vars_of_keymap (); |
2072 | 1989 |
2073 /* Calls make_lisp_hash_table() and creates a keymap */ | |
2074 complex_vars_of_event_stream (); | |
2075 | |
2076 #ifdef ERROR_CHECK_GC | 1990 #ifdef ERROR_CHECK_GC |
2077 { | 1991 { |
2078 extern int always_gc; | 1992 extern int always_gc; |
2079 if (always_gc) /* purification debugging hack */ | 1993 if (always_gc) /* purification debugging hack */ |
2080 garbage_collect_1 (); | 1994 garbage_collect_1 (); |
2081 } | 1995 } |
2082 #endif | 1996 #endif |
2083 #ifdef PDUMP | 1997 #ifdef PDUMP |
2084 } else if (!restart) { /* after successful pdump_load() */ | 1998 } |
1999 else if (!restart) /* after successful pdump_load() | |
2000 (note, we are inside ifdef PDUMP) */ | |
2001 { | |
2085 reinit_alloc_once_early (); | 2002 reinit_alloc_once_early (); |
2086 reinit_symbols_once_early (); | 2003 reinit_symbols_once_early (); |
2087 reinit_opaque_once_early (); | 2004 reinit_opaque_once_early (); |
2088 | 2005 |
2089 reinit_console_type_create_stream (); | 2006 reinit_console_type_create_stream (); |
2109 reinit_specifier_type_create_toolbar (); | 2026 reinit_specifier_type_create_toolbar (); |
2110 #endif | 2027 #endif |
2111 | 2028 |
2112 structure_type_create (); | 2029 structure_type_create (); |
2113 | 2030 |
2031 reinit_coding_system_type_create (); | |
2032 reinit_coding_system_type_create_unicode (); | |
2033 #ifdef HAVE_WIN32_CODING_SYSTEMS | |
2034 reinit_coding_system_type_create_intl_win32 (); | |
2035 #endif | |
2036 #ifdef MULE | |
2037 reinit_coding_system_type_create_mule_coding (); | |
2038 #endif | |
2039 | |
2114 structure_type_create_chartab (); | 2040 structure_type_create_chartab (); |
2115 structure_type_create_faces (); | 2041 structure_type_create_faces (); |
2116 structure_type_create_rangetab (); | 2042 structure_type_create_rangetab (); |
2117 structure_type_create_hash_table (); | 2043 structure_type_create_hash_table (); |
2118 | 2044 |
2119 lstream_type_create (); | 2045 lstream_type_create (); |
2120 #ifdef FILE_CODING | |
2121 lstream_type_create_file_coding (); | 2046 lstream_type_create_file_coding (); |
2122 #endif | 2047 #if defined (HAVE_MS_WINDOWS) && !defined (HAVE_MSG_SELECT) |
2123 #if defined (HAVE_MS_WINDOWS) && !defined(HAVE_MSG_SELECT) | |
2124 lstream_type_create_mswindows_selectable (); | 2048 lstream_type_create_mswindows_selectable (); |
2125 #endif | 2049 #endif |
2126 #ifdef HAVE_UNIX_PROCESSES | 2050 #ifdef HAVE_UNIX_PROCESSES |
2127 process_type_create_unix (); | 2051 process_type_create_unix (); |
2128 #endif | 2052 #endif |
2150 reinit_vars_of_event_mswindows (); | 2074 reinit_vars_of_event_mswindows (); |
2151 #endif | 2075 #endif |
2152 reinit_vars_of_event_stream (); | 2076 reinit_vars_of_event_stream (); |
2153 reinit_vars_of_events (); | 2077 reinit_vars_of_events (); |
2154 reinit_vars_of_extents (); | 2078 reinit_vars_of_extents (); |
2079 reinit_vars_of_file_coding (); | |
2155 reinit_vars_of_fileio (); | 2080 reinit_vars_of_fileio (); |
2156 reinit_vars_of_font_lock (); | 2081 reinit_vars_of_font_lock (); |
2157 reinit_vars_of_glyphs (); | 2082 reinit_vars_of_glyphs (); |
2158 reinit_vars_of_glyphs_widget (); | 2083 reinit_vars_of_glyphs_widget (); |
2159 reinit_vars_of_insdel (); | 2084 reinit_vars_of_insdel (); |
2164 reinit_vars_of_module (); | 2089 reinit_vars_of_module (); |
2165 #endif | 2090 #endif |
2166 reinit_vars_of_objects (); | 2091 reinit_vars_of_objects (); |
2167 reinit_vars_of_print (); | 2092 reinit_vars_of_print (); |
2168 reinit_vars_of_search (); | 2093 reinit_vars_of_search (); |
2094 reinit_vars_of_text (); | |
2169 reinit_vars_of_undo (); | 2095 reinit_vars_of_undo (); |
2096 reinit_vars_of_unicode (); | |
2170 reinit_vars_of_window (); | 2097 reinit_vars_of_window (); |
2171 | 2098 |
2172 #ifdef HAVE_MS_WINDOWS | 2099 #ifdef HAVE_MS_WINDOWS |
2173 reinit_vars_of_frame_mswindows (); | 2100 reinit_vars_of_frame_mswindows (); |
2174 #endif | 2101 #endif |
2184 #endif | 2111 #endif |
2185 #ifdef HAVE_MENUBARS | 2112 #ifdef HAVE_MENUBARS |
2186 reinit_vars_of_menubar_x (); | 2113 reinit_vars_of_menubar_x (); |
2187 #endif | 2114 #endif |
2188 reinit_vars_of_select_x (); | 2115 reinit_vars_of_select_x (); |
2189 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS) | 2116 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_X_DIALOGS) || defined (HAVE_TOOLBARS) |
2190 reinit_vars_of_gui_x (); | 2117 reinit_vars_of_gui_x (); |
2191 #endif | 2118 #endif |
2192 #endif /* HAVE_X_WINDOWS */ | 2119 #endif /* HAVE_X_WINDOWS */ |
2193 | 2120 |
2121 #ifdef MULE | |
2122 reinit_vars_of_mule_coding (); | |
2123 #endif | |
2194 #if defined (MULE) && defined (HAVE_WNN) | 2124 #if defined (MULE) && defined (HAVE_WNN) |
2195 reinit_vars_of_mule_wnn (); | 2125 reinit_vars_of_mule_wnn (); |
2196 #endif | 2126 #endif |
2197 | 2127 |
2198 reinit_complex_vars_of_buffer (); | 2128 reinit_complex_vars_of_buffer_runtime_only (); |
2199 reinit_complex_vars_of_console (); | 2129 reinit_complex_vars_of_console_runtime_only (); |
2200 reinit_complex_vars_of_minibuf (); | 2130 reinit_complex_vars_of_minibuf (); |
2201 #endif /* PDUMP */ | 2131 #endif /* PDUMP */ |
2202 } | 2132 } |
2203 | 2133 |
2204 | |
2205 /* CONGRATULATIONS!!! We have successfully initialized the Lisp | 2134 /* CONGRATULATIONS!!! We have successfully initialized the Lisp |
2206 engine. */ | 2135 engine. */ |
2207 | 2136 |
2208 if (initialized) | 2137 if (initialized) |
2209 { | 2138 init_eval_early (); |
2210 /* Stuff that should not be done at dump time, including stuff that | 2139 |
2211 needs to be reset at run time. Order below should not matter. | 2140 #ifdef MULE |
2212 | 2141 init_mule_charset (); |
2213 Many initializations taken from the environment should go here. */ | 2142 #endif |
2214 reinit_alloc (); | |
2215 reinit_eval (); | |
2216 #ifdef MULE_REGEXP | |
2217 reinit_mule_category (); | |
2218 #endif | |
2219 #ifdef HAVE_POSTGRESQL | |
2220 init_postgresql_from_environment(); | |
2221 #endif | |
2222 } | |
2223 | 2143 |
2224 /* Now do further initialization/setup of stuff that is not needed by the | 2144 /* Now do further initialization/setup of stuff that is not needed by the |
2225 syms_of_() routines. This involves stuff that only is enabled in | 2145 syms_of_() routines. This involves stuff that only is enabled in |
2226 an interactive run (redisplay, user input, etc.) and stuff that is | 2146 an interactive run (redisplay, user input, etc.) and stuff that is |
2227 not needed until we start loading Lisp code (the reader). A lot | 2147 not needed until we start loading Lisp code (the reader). A lot |
2228 of this stuff involves querying the current environment and needs | 2148 of this stuff involves querying the current environment and needs |
2229 to be done both at dump time and at run time. */ | 2149 to be done both at dump time and at run time. Some will be done |
2230 | 2150 only at run time, by querying the `initialized' variable. */ |
2231 init_initial_directory(); /* get the directory to use for the | 2151 |
2232 "*scratch*" buffer, etc. */ | 2152 #if defined (WIN32_NATIVE) || defined (CYGWIN) |
2233 | 2153 init_intl_win32 (); /* Under Windows, determine whether we use Unicode |
2234 #ifdef WIN32_NATIVE | 2154 or ANSI to call the system routines -- i.e. |
2235 /* | 2155 determine what the coding system `mswindows-tstr' |
2236 * For Win32, call init_environment() now, so that environment/registry | 2156 is aliased to */ |
2237 * variables will be properly entered into Vprocess_environment. | 2157 #endif |
2238 */ | 2158 init_buffer_1 (); /* Create *scratch* buffer; init_intl() is going to |
2239 init_environment(); | 2159 call Lisp code (the very first code we call), |
2160 and needs a current buffer */ | |
2161 #ifdef MULE | |
2162 init_intl (); /* Figure out the locale and set native and | |
2163 file-name coding systems, initialize the Unicode tables | |
2164 so that we will be able to process non-ASCII from here | |
2165 on out! */ | |
2240 #endif | 2166 #endif |
2241 | 2167 |
2242 init_callproc (); /* Set up the process environment (so that egetenv | 2168 init_callproc (); /* Set up the process environment (so that egetenv |
2243 works), the basic directory variables | 2169 works), the basic directory variables |
2244 (exec-directory and so on), and stuff | 2170 (exec-directory and so on), and stuff |
2245 related to subprocesses. This should be | 2171 related to subprocesses. This should be |
2246 first because many of the functions below | 2172 first because many of the functions below |
2247 call egetenv() to get environment variables. */ | 2173 call egetenv() to get environment variables. */ |
2174 | |
2175 #ifdef WIN32_NATIVE | |
2176 /* | |
2177 * For Win32, call init_environment() to properly enter environment/registry | |
2178 * variables into Vprocess_environment. | |
2179 */ | |
2180 init_environment (); | |
2181 #endif | |
2182 | |
2183 init_initial_directory (); /* get the directory to use for the | |
2184 "*scratch*" buffer, etc. */ | |
2185 | |
2248 init_lread (); /* Set up the Lisp reader. */ | 2186 init_lread (); /* Set up the Lisp reader. */ |
2249 init_cmdargs (argc, (Extbyte **) argv, | 2187 init_cmdargs (argc, (Extbyte **) argv, |
2250 skip_args); /* Create list Vcommand_line_args */ | 2188 skip_args); /* Create list Vcommand_line_args */ |
2251 init_buffer (); /* Set default directory of *scratch* buffer */ | 2189 init_buffer_2 (); /* Set default directory of *scratch* buffer */ |
2252 | 2190 |
2253 #ifdef WIN32_NATIVE | 2191 #ifdef WIN32_NATIVE |
2254 init_ntproc(); | 2192 init_ntproc (); |
2193 init_select_mswindows (); | |
2255 #endif | 2194 #endif |
2256 | 2195 |
2257 init_redisplay (); /* Determine terminal type. | 2196 init_redisplay (); /* Determine terminal type. |
2258 init_sys_modes uses results */ | 2197 init_sys_modes uses results */ |
2259 init_frame (); | 2198 init_frame (); |
2268 init_win32 (); | 2207 init_win32 (); |
2269 #endif | 2208 #endif |
2270 #if defined (HAVE_NATIVE_SOUND) && defined (hp9000s800) | 2209 #if defined (HAVE_NATIVE_SOUND) && defined (hp9000s800) |
2271 init_hpplay (); | 2210 init_hpplay (); |
2272 #endif | 2211 #endif |
2212 #ifdef HAVE_POSTGRESQL | |
2213 /* Set some values taken from environment variables */ | |
2214 init_postgresql_from_environment (); | |
2215 #endif | |
2273 #ifdef HAVE_TTY | 2216 #ifdef HAVE_TTY |
2274 init_device_tty (); | 2217 init_device_tty (); |
2275 #endif | 2218 #endif |
2276 init_console_stream (restart); /* Create the first console */ | 2219 init_console_stream (restart); /* Create the first console */ |
2277 | 2220 |
2278 /* try to get the actual pathname of the exec file we are running */ | 2221 /* try to get the actual pathname of the exec file we are running */ |
2279 if (!restart) | 2222 if (!restart) |
2280 { | 2223 { |
2281 Vinvocation_name = Fcar (Vcommand_line_args); | 2224 Vinvocation_name = Fcar (Vcommand_line_args); |
2282 if (XSTRING_DATA(Vinvocation_name)[0] == '-') | 2225 if (XSTRING_DATA(Vinvocation_name)[0] == '-') |
2283 { | 2226 { |
2284 /* XEmacs as a login shell, oh goody! */ | 2227 /* XEmacs as a login shell, oh goody! */ |
2285 Vinvocation_name = build_string(getenv("SHELL")); | 2228 Vinvocation_name = build_intstring (egetenv ("SHELL")); |
2286 } | 2229 } |
2287 Vinvocation_directory = Vinvocation_name; | |
2288 | |
2289 if (!NILP (Ffile_name_directory (Vinvocation_name))) | |
2290 { | |
2291 /* invocation-name includes a directory component -- presumably it | |
2292 is relative to cwd, not $PATH */ | |
2293 Vinvocation_directory = Fexpand_file_name (Vinvocation_name, | |
2294 Qnil); | |
2295 Vinvocation_path = Qnil; | |
2296 } | |
2297 else | |
2298 { | |
2299 Vinvocation_path = decode_env_path ("PATH", NULL); | |
2300 locate_file (Vinvocation_path, Vinvocation_name, | |
2301 Vlisp_EXEC_SUFFIXES, | |
2302 &Vinvocation_directory, X_OK); | |
2303 } | |
2304 | |
2305 if (NILP (Vinvocation_directory)) | |
2306 Vinvocation_directory = Vinvocation_name; | 2230 Vinvocation_directory = Vinvocation_name; |
2307 | 2231 |
2308 Vinvocation_name = Ffile_name_nondirectory (Vinvocation_directory); | 2232 if (!NILP (Ffile_name_directory (Vinvocation_name))) |
2309 Vinvocation_directory = Ffile_name_directory (Vinvocation_directory); | 2233 { |
2310 } | 2234 /* invocation-name includes a directory component -- presumably it |
2235 is relative to cwd, not $PATH */ | |
2236 Vinvocation_directory = Fexpand_file_name (Vinvocation_name, | |
2237 Qnil); | |
2238 Vinvocation_path = Qnil; | |
2239 } | |
2240 else | |
2241 { | |
2242 Vinvocation_path = split_env_path ("PATH", NULL); | |
2243 locate_file (Vinvocation_path, Vinvocation_name, | |
2244 Vlisp_EXEC_SUFFIXES, | |
2245 &Vinvocation_directory, X_OK); | |
2246 } | |
2247 | |
2248 if (NILP (Vinvocation_directory)) | |
2249 Vinvocation_directory = Vinvocation_name; | |
2250 | |
2251 Vinvocation_name = Ffile_name_nondirectory (Vinvocation_directory); | |
2252 Vinvocation_directory = Ffile_name_directory (Vinvocation_directory); | |
2253 } | |
2311 | 2254 |
2312 #if defined(HAVE_SHLIB) && !defined(WIN32_NATIVE) | 2255 #if defined(HAVE_SHLIB) && !defined(WIN32_NATIVE) |
2313 /* This is Unix only. MS Windows NT has a library call that does | 2256 /* This is Unix only. MS Windows NT has a library call that does |
2314 The Right Thing on that system. Rumor has it, this must be | 2257 The Right Thing on that system. Rumor has it, this must be |
2315 called for GNU dld in temacs and xemacs. */ | 2258 called for GNU dld in temacs and xemacs. */ |
2318 + XSTRING_LENGTH (Vinvocation_name) | 2261 + XSTRING_LENGTH (Vinvocation_name) |
2319 + 2); | 2262 + 2); |
2320 sprintf (buf, "%s/%s", XSTRING_DATA (Vinvocation_directory), | 2263 sprintf (buf, "%s/%s", XSTRING_DATA (Vinvocation_directory), |
2321 XSTRING_DATA (Vinvocation_name)); | 2264 XSTRING_DATA (Vinvocation_name)); |
2322 | 2265 |
2266 C_STRING_TO_EXTERNAL (buf, buf, Qfile_name); | |
2323 /* All we can do is cry if an error happens, so ignore it. */ | 2267 /* All we can do is cry if an error happens, so ignore it. */ |
2324 (void) dll_init (buf); | 2268 (void) dll_init (buf); |
2325 } | 2269 } |
2326 #endif | 2270 #endif |
2327 | 2271 |
2337 load_me = Qnil; | 2281 load_me = Qnil; |
2338 if (!initialized) | 2282 if (!initialized) |
2339 { | 2283 { |
2340 /* Handle -l loadup-and-dump, args passed by Makefile. */ | 2284 /* Handle -l loadup-and-dump, args passed by Makefile. */ |
2341 if (argc > 2 + skip_args && !strcmp (argv[1 + skip_args], "-l")) | 2285 if (argc > 2 + skip_args && !strcmp (argv[1 + skip_args], "-l")) |
2286 /* !!#### need to be Mule-translating this, but later */ | |
2342 load_me = build_string (argv[2 + skip_args]); | 2287 load_me = build_string (argv[2 + skip_args]); |
2343 #if 0 /* CANNOT_DUMP - this can never be right in XEmacs --andyp */ | |
2344 /* Unless next switch is -nl, load "loadup.el" first thing. */ | |
2345 if (!(argc > 1 + skip_args && !strcmp (argv[1 + skip_args], "-nl"))) | |
2346 load_me = build_string ("loadup.el"); | |
2347 #endif /* CANNOT_DUMP */ | |
2348 } | 2288 } |
2349 | 2289 |
2350 #ifdef QUANTIFY | 2290 #ifdef QUANTIFY |
2351 if (initialized) | 2291 if (initialized) |
2352 quantify_start_recording_data (); | 2292 quantify_start_recording_data (); |
2353 #endif /* QUANTIFY */ | 2293 #endif /* QUANTIFY */ |
2354 | 2294 |
2355 initialized = 1; | 2295 initialized = 1; |
2296 inhibit_non_essential_printing_operations = 0; | |
2356 | 2297 |
2357 /* This never returns. */ | 2298 /* This never returns. */ |
2358 initial_command_loop (load_me); | 2299 initial_command_loop (load_me); |
2359 /* NOTREACHED */ | 2300 /* NOTREACHED */ |
2360 } | 2301 } |
2379 { "-sd", "--show-dump-id", 105, 0 }, | 2320 { "-sd", "--show-dump-id", 105, 0 }, |
2380 { "-t", "--terminal", 100, 1 }, | 2321 { "-t", "--terminal", 100, 1 }, |
2381 { "-nd", "--no-dump-file", 95, 0 }, | 2322 { "-nd", "--no-dump-file", 95, 0 }, |
2382 { "-nw", "--no-windows", 90, 0 }, | 2323 { "-nw", "--no-windows", 90, 0 }, |
2383 { "-batch", "--batch", 85, 0 }, | 2324 { "-batch", "--batch", 85, 0 }, |
2325 #ifdef WIN32_NATIVE | |
2326 { "-nuni", "--no-unicode-lib-calls", 83, 0 }, | |
2327 #endif /* WIN32_NATIVE */ | |
2384 { "-debug-paths", "--debug-paths", 82, 0 }, | 2328 { "-debug-paths", "--debug-paths", 82, 0 }, |
2385 { "-help", "--help", 80, 0 }, | 2329 { "-help", "--help", 80, 0 }, |
2386 { "-version", "--version", 75, 0 }, | 2330 { "-version", "--version", 75, 0 }, |
2387 { "-V", 0, 75, 0 }, | 2331 { "-V", 0, 75, 0 }, |
2388 { "-d", "--display", 80, 1 }, | 2332 { "-d", "--display", 80, 1 }, |
2400 { "-no-early-packages", "--no-early-packages", 35, 0 }, | 2344 { "-no-early-packages", "--no-early-packages", 35, 0 }, |
2401 { "-u", "--user", 30, 1 }, | 2345 { "-u", "--user", 30, 1 }, |
2402 { "-user", 0, 30, 1 }, | 2346 { "-user", 0, 30, 1 }, |
2403 { "-debug-init", "--debug-init", 20, 0 }, | 2347 { "-debug-init", "--debug-init", 20, 0 }, |
2404 { "-debug-paths", "--debug-paths", 20, 0 }, | 2348 { "-debug-paths", "--debug-paths", 20, 0 }, |
2349 { "-eol", "--enable-eol-detection", 20, 0 }, | |
2405 | 2350 |
2406 /* Xt options: */ | 2351 /* Xt options: */ |
2407 { "-i", "--icon-type", 15, 0 }, | 2352 { "-i", "--icon-type", 15, 0 }, |
2408 { "-itype", 0, 15, 0 }, | 2353 { "-itype", 0, 15, 0 }, |
2409 { "-iconic", "--iconic", 15, 0 }, | 2354 { "-iconic", "--iconic", 15, 0 }, |
2642 namesize += wampum_all_len[ac]; | 2587 namesize += wampum_all_len[ac]; |
2643 } | 2588 } |
2644 run_temacs_argv [nargs + 1] = 0; | 2589 run_temacs_argv [nargs + 1] = 0; |
2645 catchlist = NULL; /* Important! Otherwise free_cons() calls in | 2590 catchlist = NULL; /* Important! Otherwise free_cons() calls in |
2646 condition_case_unwind() may lead to GC death. */ | 2591 condition_case_unwind() may lead to GC death. */ |
2647 unbind_to (0, Qnil); /* this closes loadup.el */ | 2592 unbind_to (0); /* this closes loadup.el */ |
2648 purify_flag = 0; | 2593 purify_flag = 0; |
2649 run_temacs_argc = nargs + 1; | 2594 run_temacs_argc = nargs + 1; |
2650 #if defined (HEAP_IN_DATA) && !defined(PDUMP) | 2595 #if defined (HEAP_IN_DATA) && !defined(PDUMP) |
2651 report_sheap_usage (0); | 2596 report_sheap_usage (0); |
2652 #endif | 2597 #endif |
2702 #ifdef QUANTIFY | 2647 #ifdef QUANTIFY |
2703 quantify_stop_recording_data (); | 2648 quantify_stop_recording_data (); |
2704 quantify_clear_data (); | 2649 quantify_clear_data (); |
2705 #endif /* QUANTIFY */ | 2650 #endif /* QUANTIFY */ |
2706 | 2651 |
2652 inhibit_non_essential_printing_operations = 1; | |
2707 suppress_early_error_handler_backtrace = 0; | 2653 suppress_early_error_handler_backtrace = 0; |
2708 lim_data = 0; /* force reinitialization of this variable */ | 2654 lim_data = 0; /* force reinitialization of this variable */ |
2709 | 2655 |
2710 /* Lisp_Object must fit in a word; check VALBITS and GCTYPEBITS */ | 2656 /* Lisp_Object must fit in a word; check VALBITS and GCTYPEBITS */ |
2711 assert (sizeof (Lisp_Object) == sizeof (void *)); | 2657 assert (sizeof (Lisp_Object) == sizeof (void *)); |
2795 | 2741 |
2796 return 0; /* unreached */ | 2742 return 0; /* unreached */ |
2797 } | 2743 } |
2798 | 2744 |
2799 | 2745 |
2800 /* Dumping apparently isn't supported by versions of GCC >= 2.8. */ | 2746 /************************************************************************/ |
2801 /* The following needs conditionalization on whether either XEmacs or */ | 2747 /* dumping XEmacs (to a new EXE file) */ |
2802 /* various system shared libraries have been built and linked with */ | 2748 /************************************************************************/ |
2803 /* GCC >= 2.8. -slb */ | 2749 |
2804 #if defined(GNU_MALLOC) | 2750 #ifndef CANNOT_DUMP |
2805 static void | 2751 |
2806 voodoo_free_hook (void *mem) | 2752 #if !defined(PDUMP) || !defined(SYSTEM_MALLOC) |
2807 { | 2753 extern char my_edata[]; |
2808 /* Disable all calls to free() when XEmacs is exiting and it doesn't */ | 2754 #endif |
2809 /* matter. */ | 2755 |
2810 __free_hook = | 2756 extern void disable_free_hook (void); |
2811 #ifdef __GNUC__ /* prototype of __free_hook varies with glibc version */ | 2757 |
2812 (__typeof__ (__free_hook)) | 2758 DEFUN ("dump-emacs", Fdump_emacs, 2, 2, 0, /* |
2813 #endif | 2759 Dump current state of XEmacs into executable file FILENAME. |
2814 voodoo_free_hook; | 2760 Take symbols from SYMFILE (presumably the file you executed to run XEmacs). |
2815 } | 2761 This is used in the file `loadup.el' when building XEmacs. |
2816 #endif /* GNU_MALLOC */ | 2762 |
2817 | 2763 Remember to set `command-line-processed' to nil before dumping |
2818 DEFUN ("kill-emacs", Fkill_emacs, 0, 1, "P", /* | 2764 if you want the dumped XEmacs to process its command line |
2819 Exit the XEmacs job and kill it. Ask for confirmation, without argument. | 2765 and announce itself normally when it is run. |
2820 If ARG is an integer, return ARG as the exit program code. | |
2821 If ARG is a string, stuff it as keyboard input. | |
2822 | |
2823 The value of `kill-emacs-hook', if not void, | |
2824 is a list of functions (of no args), | |
2825 all of which are called before XEmacs is actually killed. | |
2826 */ | 2766 */ |
2827 (arg)) | 2767 (filename, symfile)) |
2828 { | 2768 { |
2829 /* This function can GC */ | 2769 /* This function can GC */ |
2830 struct gcpro gcpro1; | 2770 struct gcpro gcpro1, gcpro2; |
2831 | 2771 int opurify; |
2832 GCPRO1 (arg); | 2772 |
2833 | 2773 GCPRO2 (filename, symfile); |
2834 if (feof (stdin)) | 2774 |
2835 arg = Qt; | 2775 #ifdef FREE_CHECKING |
2836 | 2776 Freally_free (Qnil); |
2837 if (!preparing_for_armageddon && !noninteractive) | 2777 |
2838 run_hook (Qkill_emacs_hook); | 2778 /* When we're dumping, we can't use the debugging free() */ |
2839 | 2779 disable_free_hook (); |
2840 ensure_no_quitting_from_now_on (); | 2780 #endif |
2841 | 2781 |
2842 if (!preparing_for_armageddon) | 2782 CHECK_STRING (filename); |
2783 filename = Fexpand_file_name (filename, Qnil); | |
2784 if (!NILP (symfile)) | |
2843 { | 2785 { |
2844 Lisp_Object concons, nextcons; | 2786 CHECK_STRING (symfile); |
2845 | 2787 if (XSTRING_LENGTH (symfile) > 0) |
2846 /* Normally, go ahead and delete all the consoles now. | 2788 symfile = Fexpand_file_name (symfile, Qnil); |
2847 Some unmentionably lame window systems (MS Wwwww...... eek, | 2789 else |
2848 I can't even say it) don't properly clean up after themselves, | 2790 symfile = Qnil; |
2849 and even for those that do, it might be cleaner this way. | |
2850 If we're going down, however, we don't do this (might | |
2851 be too dangerous), and if we get a crash somewhere within | |
2852 this loop, we'll still autosave and won't try this again. */ | |
2853 | |
2854 LIST_LOOP_DELETING (concons, nextcons, Vconsole_list) | |
2855 { | |
2856 /* There is very little point in deleting the stream console. | |
2857 It uses stdio, which should flush any buffered output and | |
2858 something can only go wrong. -slb */ | |
2859 /* I changed my mind. There's a stupid hack in close to add | |
2860 a trailing newline. */ | |
2861 /*if (!CONSOLE_STREAM_P (XCONSOLE (XCAR (concons))))*/ | |
2862 delete_console_internal (XCONSOLE (XCAR (concons)), 1, 1, 0); | |
2863 } | |
2864 } | 2791 } |
2865 | 2792 |
2793 opurify = purify_flag; | |
2794 purify_flag = 0; | |
2795 | |
2796 #if defined (HEAP_IN_DATA) && !defined(PDUMP) | |
2797 report_sheap_usage (1); | |
2798 #endif | |
2799 | |
2800 clear_message (); | |
2801 | |
2802 fflush (stderr); | |
2803 fflush (stdout); | |
2804 | |
2805 disksave_object_finalization (); | |
2806 release_breathing_space (); | |
2807 | |
2808 /* Tell malloc where start of impure now is */ | |
2809 /* Also arrange for warnings when nearly out of space. */ | |
2810 #ifndef SYSTEM_MALLOC | |
2811 memory_warnings (my_edata, malloc_warning); | |
2812 #endif | |
2813 | |
2866 UNGCPRO; | 2814 UNGCPRO; |
2867 | 2815 |
2816 { | |
2817 Extbyte *filename_ext; | |
2818 Extbyte *symfile_ext; | |
2819 | |
2820 LISP_STRING_TO_EXTERNAL (filename, filename_ext, Qfile_name); | |
2821 | |
2822 if (STRINGP (symfile)) | |
2823 LISP_STRING_TO_EXTERNAL (symfile, symfile_ext, Qfile_name); | |
2824 else | |
2825 symfile_ext = 0; | |
2826 | |
2827 garbage_collect_1 (); | |
2828 | |
2829 #ifdef PDUMP | |
2830 pdump (); | |
2831 #else | |
2832 | |
2833 #ifdef DOUG_LEA_MALLOC | |
2834 malloc_state_ptr = malloc_get_state (); | |
2835 #endif | |
2836 /* here we break our rule that the filename conversion should | |
2837 be performed at the actual time that the system call is made. | |
2838 It's a whole lot easier to do the conversion here than to | |
2839 modify all the unexec routines to ensure that filename | |
2840 conversion is applied everywhere. Don't worry about memory | |
2841 leakage because this call only happens once. */ | |
2842 unexec (filename_ext, symfile_ext, (uintptr_t) my_edata, 0, 0); | |
2843 #ifdef DOUG_LEA_MALLOC | |
2844 free (malloc_state_ptr); | |
2845 #endif | |
2846 #endif /* not PDUMP */ | |
2847 } | |
2848 | |
2849 purify_flag = opurify; | |
2850 | |
2851 return Qnil; | |
2852 } | |
2853 | |
2854 #endif /* not CANNOT_DUMP */ | |
2855 | |
2856 | |
2857 /************************************************************************/ | |
2858 /* exiting XEmacs (intended or not) */ | |
2859 /************************************************************************/ | |
2860 | |
2861 /* Ben's capsule summary about expected and unexpected exits from XEmacs. | |
2862 | |
2863 Expected exits occur when the user directs XEmacs to exit, for example | |
2864 by pressing the close button on the only frame in XEmacs, or by typing | |
2865 C-x C-c. This runs `save-buffers-kill-emacs', which saves any necessary | |
2866 buffers, and then exits using the primitive `kill-emacs'. | |
2867 | |
2868 However, unexpected exits occur in a few different ways: | |
2869 | |
2870 -- a memory access violation or other hardware-generated exception | |
2871 occurs. This is the worst possible problem to deal with, because | |
2872 the fault can occur while XEmacs is in any state whatsoever, even | |
2873 quite unstable ones. As a result, we need to be *extremely* careful | |
2874 what we do. | |
2875 -- we are using one X display (or if we've used more, we've closed the | |
2876 others already), and some hardware or other problem happens and | |
2877 suddenly we've lost our connection to the display. In this situation, | |
2878 things are not so dire as in the last one; our code itself isn't | |
2879 trashed, so we can continue execution as normal, after having set | |
2880 things up so that we can exit at the appropriate time. Our exit | |
2881 still needs to be of the emergency nature; we have no displays, so | |
2882 any attempts to use them will fail. We simply want to auto-save | |
2883 (the single most important thing to do during shut-down), do minimal | |
2884 cleanup of stuff that has an independent existence outside of XEmacs, | |
2885 and exit. | |
2886 | |
2887 Currently, both unexpected exit scenarios described above set | |
2888 preparing_for_armageddon to indicate that nonessential and possibly | |
2889 dangerous things should not be done, specifically: | |
2890 | |
2891 -- no garbage collection. | |
2892 -- no hooks are run. | |
2893 -- no messages of any sort from autosaving. | |
2894 -- autosaving tries harder, ignoring certain failures. | |
2895 -- existing frames are not deleted. | |
2896 | |
2897 (Also, all places that set preparing_for_armageddon also | |
2898 set dont_check_for_quit. This happens separately because it's | |
2899 also necessary to set other variables to make absolutely sure | |
2900 no quitting happens.) | |
2901 | |
2902 In the first scenario above (the access violation), we also set | |
2903 fatal_error_in_progress. This causes more things to not happen: | |
2904 | |
2905 -- assertion failures do not abort. | |
2906 -- printing code does not do code conversion or gettext when | |
2907 printing to stdout/stderr. | |
2908 */ | |
2909 | |
2910 /* ------------------------------- */ | |
2911 /* low-level debugging functions */ | |
2912 /* ------------------------------- */ | |
2913 | |
2914 #if defined (WIN32_NATIVE) && defined (DEBUG_XEMACS) | |
2915 #define debugging_breakpoint() DebugBreak () | |
2916 #else | |
2917 #define debugging_breakpoint() | |
2918 #endif | |
2919 | |
2920 void | |
2921 debug_break (void) | |
2922 { | |
2923 debugging_breakpoint (); | |
2924 } | |
2925 | |
2926 #if defined (WIN32_NATIVE) || defined (CYGWIN) | |
2927 | |
2928 /* Return whether all bytes in the specified memory block can be read. */ | |
2929 int | |
2930 debug_can_access_memory (void *ptr, Bytecount len) | |
2931 { | |
2932 return !IsBadReadPtr (ptr, len); | |
2933 } | |
2934 | |
2935 #else /* !(defined (WIN32_NATIVE) || defined (CYGWIN)) */ | |
2936 | |
2937 /* #### There must be a better way!!!! */ | |
2938 | |
2939 static JMP_BUF memory_error_jump; | |
2940 | |
2941 static SIGTYPE | |
2942 debug_memory_error (int signum) | |
2943 { | |
2944 EMACS_REESTABLISH_SIGNAL (signum, debug_memory_error); | |
2945 EMACS_UNBLOCK_SIGNAL (signum); | |
2946 LONGJMP (memory_error_jump, 1); | |
2947 } | |
2948 | |
2949 /* Return whether all bytes in the specified memory block can be read. */ | |
2950 int | |
2951 debug_can_access_memory (void *ptr, Bytecount len) | |
2952 { | |
2953 /* Use volatile to protect variables from being clobbered by longjmp. */ | |
2954 SIGTYPE (*volatile old_sigbus) (int); | |
2955 SIGTYPE (*volatile old_sigsegv) (int); | |
2956 volatile int old_errno = errno; | |
2957 volatile int retval = 1; | |
2958 | |
2959 if (!SETJMP (memory_error_jump)) | |
2960 { | |
2961 old_sigbus = | |
2962 (SIGTYPE (*) (int)) EMACS_SIGNAL (SIGBUS, debug_memory_error); | |
2963 old_sigsegv = | |
2964 (SIGTYPE (*) (int)) EMACS_SIGNAL (SIGSEGV, debug_memory_error); | |
2965 | |
2966 if (len > 1) | |
2967 /* If we can, try to avoid problems with super-optimizing compilers | |
2968 that might decide that memcmp (ptr, ptr, len) can be optimized | |
2969 away since its result is always 1. */ | |
2970 memcmp (ptr, (char *) ptr + 1, len - 1); | |
2971 else | |
2972 memcmp (ptr, ptr, len); | |
2973 } | |
2974 else | |
2975 retval = 0; | |
2976 EMACS_SIGNAL (SIGBUS, old_sigbus); | |
2977 EMACS_SIGNAL (SIGSEGV, old_sigsegv); | |
2978 errno = old_errno; | |
2979 | |
2980 return retval; | |
2981 } | |
2982 | |
2983 #endif /* defined (WIN32_NATIVE) || defined (CYGWIN) */ | |
2984 | |
2985 #ifdef DEBUG_XEMACS | |
2986 | |
2987 DEFUN ("force-debugging-signal", Fforce_debugging_signal, 0, 1, 0, /* | |
2988 Cause XEmacs to enter the debugger. | |
2989 On some systems, there may be no way to do this gracefully; if so, | |
2990 nothing happens unless ABORT is non-nil, in which case XEmacs will | |
2991 abort() -- a sure-fire way to immediately get back to the debugger, | |
2992 but also a sure-fire way to kill XEmacs (and dump core on Unix | |
2993 systems)! | |
2994 */ | |
2995 (abort_)) | |
2996 { | |
2997 debugging_breakpoint (); | |
2998 if (!NILP (abort_)) | |
2999 abort (); | |
3000 return Qnil; | |
3001 } | |
3002 | |
3003 #endif /* DEBUG_XEMACS */ | |
3004 | |
3005 /* ------------------------------- */ | |
3006 /* some helper functions */ | |
3007 /* ------------------------------- */ | |
3008 | |
3009 static void | |
3010 ensure_no_quitting_from_now_on (void) | |
3011 { | |
3012 /* make sure no quitting from now on!! */ | |
3013 dont_check_for_quit = 1; | |
3014 Vinhibit_quit = Qt; | |
3015 Vquit_flag = Qnil; | |
3016 } | |
3017 | |
2868 #ifdef HAVE_MS_WINDOWS | 3018 #ifdef HAVE_MS_WINDOWS |
3019 static void | |
3020 pause_so_user_can_read_messages (int allow_further) | |
3021 { | |
3022 static int already_paused; | |
3023 | |
3024 if (already_paused) | |
3025 return; | |
3026 if (!allow_further) | |
3027 already_paused = 1; | |
2869 /* If we displayed a message on the console, then we must allow the | 3028 /* If we displayed a message on the console, then we must allow the |
2870 user to see this message. This may be unnecessary, but can't hurt, | 3029 user to see this message. This may be unnecessary, but can't hurt, |
2871 and we can't necessarily check arg; e.g. xemacs --help kills with | 3030 and we can't necessarily check arg; e.g. xemacs --help kills with |
2872 argument 0. */ | 3031 argument 0. */ |
2873 if (mswindows_message_outputted) | 3032 if (mswindows_message_outputted) |
2874 Fmswindows_message_box (build_string ("Messages outputted. XEmacs is exiting."), | 3033 Fmswindows_message_box |
2875 Qnil, Qnil); | 3034 (build_msg_string ("Messages outputted. XEmacs is exiting."), |
2876 #endif | 3035 Qnil, Qnil); |
2877 | |
2878 shut_down_emacs (0, STRINGP (arg) ? arg : Qnil, 0); | |
2879 | |
2880 #if defined(GNU_MALLOC) | |
2881 __free_hook = | |
2882 #ifdef __GNUC__ /* prototype of __free_hook varies with glibc version */ | |
2883 (__typeof__ (__free_hook)) | |
2884 #endif | |
2885 voodoo_free_hook; | |
2886 #endif | |
2887 | |
2888 exit (INTP (arg) ? XINT (arg) : 0); | |
2889 /* NOTREACHED */ | |
2890 return Qnil; /* I'm sick of the compiler warning */ | |
2891 } | 3036 } |
3037 #endif | |
3038 | |
3039 /* -------------------------------- */ | |
3040 /* a (more-or-less) normal shutdown */ | |
3041 /* -------------------------------- */ | |
2892 | 3042 |
2893 /* Perform an orderly shutdown of XEmacs. Autosave any modified | 3043 /* Perform an orderly shutdown of XEmacs. Autosave any modified |
2894 buffers, kill any child processes, clean up the terminal modes (if | 3044 buffers, kill any child processes, clean up the terminal modes (if |
2895 we're in the foreground), and other stuff like that. Don't perform | 3045 we're in the foreground), and other stuff like that. Don't perform |
2896 any redisplay; this may be called when XEmacs is shutting down in | 3046 any redisplay; this may be called when XEmacs is shutting down in |
2899 If SIG is a signal number, print a message for it. | 3049 If SIG is a signal number, print a message for it. |
2900 | 3050 |
2901 This is called by fatal signal handlers and Fkill_emacs. It used to | 3051 This is called by fatal signal handlers and Fkill_emacs. It used to |
2902 be called by X protocol error handlers, but instead they now call | 3052 be called by X protocol error handlers, but instead they now call |
2903 Fkill_emacs. */ | 3053 Fkill_emacs. */ |
3054 | |
2904 static void | 3055 static void |
2905 shut_down_emacs (int sig, Lisp_Object stuff, int no_auto_save) | 3056 shut_down_emacs (int sig, Lisp_Object stuff, int no_auto_save) |
2906 { | 3057 { |
2907 /* This function can GC */ | 3058 /* This function can GC */ |
2908 /* Prevent running of hooks and other non-essential stuff | 3059 /* Prevent running of hooks and other non-essential stuff |
3019 #if 0 | 3170 #if 0 |
3020 /* The following crashes when built on X11R5 and run on X11R6 */ | 3171 /* The following crashes when built on X11R5 and run on X11R6 */ |
3021 tt_close (); | 3172 tt_close (); |
3022 #endif | 3173 #endif |
3023 #endif /* TOOLTALK */ | 3174 #endif /* TOOLTALK */ |
3024 | |
3025 } | 3175 } |
3026 | 3176 |
3027 | 3177 /* Dumping apparently isn't supported by versions of GCC >= 2.8. */ |
3028 #ifndef CANNOT_DUMP | 3178 /* The following needs conditionalization on whether either XEmacs or */ |
3029 | 3179 /* various system shared libraries have been built and linked with */ |
3030 #if !defined(PDUMP) || !defined(SYSTEM_MALLOC) | 3180 /* GCC >= 2.8. -slb */ |
3031 extern char my_edata[]; | 3181 #if defined(GNU_MALLOC) |
3032 #endif | 3182 static void |
3033 | 3183 voodoo_free_hook (void *mem) |
3034 extern void disable_free_hook (void); | 3184 { |
3035 | 3185 /* Disable all calls to free() when XEmacs is exiting and it doesn't */ |
3036 DEFUN ("dump-emacs", Fdump_emacs, 2, 2, 0, /* | 3186 /* matter. */ |
3037 Dump current state of XEmacs into executable file FILENAME. | 3187 __free_hook = |
3038 Take symbols from SYMFILE (presumably the file you executed to run XEmacs). | 3188 #ifdef __GNUC__ /* prototype of __free_hook varies with glibc version */ |
3039 This is used in the file `loadup.el' when building XEmacs. | 3189 (__typeof__ (__free_hook)) |
3040 | 3190 #endif |
3041 Remember to set `command-line-processed' to nil before dumping | 3191 voodoo_free_hook; |
3042 if you want the dumped XEmacs to process its command line | 3192 } |
3043 and announce itself normally when it is run. | 3193 #endif /* GNU_MALLOC */ |
3194 | |
3195 DEFUN ("kill-emacs", Fkill_emacs, 0, 1, "P", /* | |
3196 Exit the XEmacs job and kill it. Ask for confirmation, without argument. | |
3197 If ARG is an integer, return ARG as the exit program code. | |
3198 If ARG is a string, stuff it as keyboard input. | |
3199 | |
3200 The value of `kill-emacs-hook', if not void, | |
3201 is a list of functions (of no args), | |
3202 all of which are called before XEmacs is actually killed. | |
3044 */ | 3203 */ |
3045 (filename, symfile)) | 3204 (arg)) |
3046 { | 3205 { |
3047 /* This function can GC */ | 3206 /* This function can GC */ |
3048 struct gcpro gcpro1, gcpro2; | 3207 struct gcpro gcpro1; |
3049 int opurify; | 3208 |
3050 | 3209 GCPRO1 (arg); |
3051 GCPRO2 (filename, symfile); | 3210 |
3052 | 3211 if (feof (stdin)) |
3053 #ifdef FREE_CHECKING | 3212 arg = Qt; |
3054 Freally_free (Qnil); | 3213 |
3055 | 3214 if (!preparing_for_armageddon && !noninteractive) |
3056 /* When we're dumping, we can't use the debugging free() */ | 3215 run_hook (Qkill_emacs_hook); |
3057 disable_free_hook (); | 3216 |
3058 #endif | 3217 ensure_no_quitting_from_now_on (); |
3059 | 3218 |
3060 CHECK_STRING (filename); | 3219 if (!preparing_for_armageddon) |
3061 filename = Fexpand_file_name (filename, Qnil); | |
3062 if (!NILP (symfile)) | |
3063 { | 3220 { |
3064 CHECK_STRING (symfile); | 3221 Lisp_Object concons, nextcons; |
3065 if (XSTRING_LENGTH (symfile) > 0) | 3222 |
3066 symfile = Fexpand_file_name (symfile, Qnil); | 3223 /* Normally, go ahead and delete all the consoles now. |
3067 else | 3224 Some unmentionably lame window systems (MS Wwwww...... eek, |
3068 symfile = Qnil; | 3225 I can't even say it) don't properly clean up after themselves, |
3226 and even for those that do, it might be cleaner this way. | |
3227 If we're going down, however, we don't do this (might | |
3228 be too dangerous), and if we get a crash somewhere within | |
3229 this loop, we'll still autosave and won't try this again. */ | |
3230 | |
3231 LIST_LOOP_DELETING (concons, nextcons, Vconsole_list) | |
3232 { | |
3233 /* There is very little point in deleting the stream console. | |
3234 It uses stdio, which should flush any buffered output and | |
3235 something can only go wrong. -slb */ | |
3236 /* I changed my mind. There's a stupid hack in close to add | |
3237 a trailing newline. */ | |
3238 /*if (!CONSOLE_STREAM_P (XCONSOLE (XCAR (concons))))*/ | |
3239 delete_console_internal (XCONSOLE (XCAR (concons)), 1, 1, 0); | |
3240 } | |
3069 } | 3241 } |
3070 | 3242 |
3071 opurify = purify_flag; | |
3072 purify_flag = 0; | |
3073 | |
3074 #if defined (HEAP_IN_DATA) && !defined(PDUMP) | |
3075 report_sheap_usage (1); | |
3076 #endif | |
3077 | |
3078 clear_message (); | |
3079 | |
3080 fflush (stderr); | |
3081 fflush (stdout); | |
3082 | |
3083 disksave_object_finalization (); | |
3084 release_breathing_space (); | |
3085 | |
3086 /* Tell malloc where start of impure now is */ | |
3087 /* Also arrange for warnings when nearly out of space. */ | |
3088 #ifndef SYSTEM_MALLOC | |
3089 memory_warnings (my_edata, malloc_warning); | |
3090 #endif | |
3091 | |
3092 UNGCPRO; | 3243 UNGCPRO; |
3093 | 3244 |
3094 { | 3245 #ifdef HAVE_MS_WINDOWS |
3095 char *filename_ext; | 3246 pause_so_user_can_read_messages (1); |
3096 char *symfile_ext; | 3247 #endif |
3097 | 3248 |
3098 LISP_STRING_TO_EXTERNAL (filename, filename_ext, Qfile_name); | 3249 shut_down_emacs (0, STRINGP (arg) ? arg : Qnil, 0); |
3099 | 3250 |
3100 if (STRINGP (symfile)) | 3251 #if defined(GNU_MALLOC) |
3101 LISP_STRING_TO_EXTERNAL (symfile, symfile_ext, Qfile_name); | 3252 __free_hook = |
3102 else | 3253 #ifdef __GNUC__ /* prototype of __free_hook varies with glibc version */ |
3103 symfile_ext = 0; | 3254 (__typeof__ (__free_hook)) |
3104 | 3255 #endif |
3105 garbage_collect_1 (); | 3256 voodoo_free_hook; |
3106 | 3257 #endif |
3107 #ifdef PDUMP | 3258 |
3108 pdump (); | 3259 exit (INTP (arg) ? XINT (arg) : 0); |
3260 /* NOTREACHED */ | |
3261 return Qnil; /* I'm sick of the compiler warning */ | |
3262 } | |
3263 | |
3264 /* -------------------------------- */ | |
3265 /* abnormal shutdowns: GP faults */ | |
3266 /* -------------------------------- */ | |
3267 | |
3268 /* Handle bus errors, illegal instruction, etc: actual implementation. */ | |
3269 static void | |
3270 guts_of_fatal_error_signal (int sig) | |
3271 { | |
3272 fatal_error_in_progress++; | |
3273 inhibit_non_essential_printing_operations = 1; | |
3274 preparing_for_armageddon = 1; | |
3275 | |
3276 ensure_no_quitting_from_now_on (); | |
3277 | |
3278 /* Only try auto-saving first time through. If we crash in auto-saving, | |
3279 don't do it again. */ | |
3280 if (fatal_error_in_progress == 1) | |
3281 { | |
3282 Fdo_auto_save (Qt, Qnil); /* do this before anything hazardous */ | |
3283 /* Do this so that the variable has the same value of 2 regardless of | |
3284 whether we made it through auto-saving correctly. */ | |
3285 fatal_error_in_progress++; | |
3286 } | |
3287 else if (fatal_error_in_progress == 2) | |
3288 stderr_out ("WARNING: Unable to auto-save your files properly.\n" | |
3289 "Some or all may in fact have been auto-saved.\n" | |
3290 "\n"); | |
3291 | |
3292 /* Now, reset our signal handler, so the next time, we just die. | |
3293 Don't do this before auto-saving. */ | |
3294 if (sig >= 0) | |
3295 EMACS_SIGNAL (sig, SIG_DFL); | |
3296 | |
3297 /* Keep in mind that there's more than one signal that we can crash | |
3298 on. */ | |
3299 /* If fatal error occurs in code below, avoid infinite recursion. */ | |
3300 if (fatal_error_in_progress <= 2) | |
3301 { | |
3302 shut_down_emacs (sig, Qnil, 1); | |
3303 stderr_out ("\nLisp backtrace follows:\n\n"); | |
3304 debug_backtrace (); | |
3305 # if 0 /* This is evil, rarely useful, and causes grief in some cases. */ | |
3306 /* Check for Sun-style stack printing via /proc */ | |
3307 { | |
3308 const Char_ASCII *pstack = "/usr/proc/bin/pstack"; | |
3309 if (access (pstack, X_OK) == 0) | |
3310 { | |
3311 Char_ASCII buf[100]; | |
3312 stderr_out ("\nC backtrace follows:\n" | |
3313 "(A real debugger may provide better information)\n\n"); | |
3314 sprintf (buf, "%s %d >&2", pstack, (int)getpid()); | |
3315 system (buf); | |
3316 } | |
3317 } | |
3318 # endif | |
3319 #ifdef HAVE_MS_WINDOWS | |
3320 pause_so_user_can_read_messages (0); | |
3321 #endif | |
3322 } | |
3323 } | |
3324 | |
3325 /* This is called when a fatal signal (SIGBUS aka "bus error", SIGSEGV aka | |
3326 "segmentation violation", SIGILL aka "illegal instruction", and many | |
3327 others) is sent to the program. This generally happens under Unix, | |
3328 not MS Windows. */ | |
3329 SIGTYPE | |
3330 fatal_error_signal (int sig) | |
3331 { | |
3332 /* Unblock the signal so that if the same signal gets sent in the | |
3333 code below, we avoid a deadlock. */ | |
3334 EMACS_UNBLOCK_SIGNAL (sig); | |
3335 | |
3336 guts_of_fatal_error_signal (sig); | |
3337 | |
3338 /* Signal the same code; this time it will really be fatal. */ | |
3339 #ifdef WIN32_NATIVE | |
3340 raise (sig); | |
3109 #else | 3341 #else |
3110 | 3342 kill (qxe_getpid (), sig); |
3111 #ifdef DOUG_LEA_MALLOC | 3343 #endif |
3112 malloc_state_ptr = malloc_get_state (); | 3344 SIGRETURN; |
3113 #endif | |
3114 /* here we break our rule that the filename conversion should | |
3115 be performed at the actual time that the system call is made. | |
3116 It's a whole lot easier to do the conversion here than to | |
3117 modify all the unexec routines to ensure that filename | |
3118 conversion is applied everywhere. Don't worry about memory | |
3119 leakage because this call only happens once. */ | |
3120 unexec (filename_ext, symfile_ext, (uintptr_t) my_edata, 0, 0); | |
3121 #ifdef DOUG_LEA_MALLOC | |
3122 free (malloc_state_ptr); | |
3123 #endif | |
3124 #endif /* not PDUMP */ | |
3125 } | |
3126 | |
3127 purify_flag = opurify; | |
3128 | |
3129 return Qnil; | |
3130 } | 3345 } |
3131 | 3346 |
3132 #endif /* not CANNOT_DUMP */ | 3347 #ifdef _MSC_VER |
3133 | 3348 |
3134 | 3349 #define STATUS_ASSERTION_FAILURE 0xE0000001 |
3135 /* Split STRING into a list of substrings. The substrings are the | 3350 |
3136 parts of original STRING separated by SEPCHAR. */ | 3351 static DWORD |
3137 static Lisp_Object | 3352 mswindows_handle_hardware_exceptions_1 (void) |
3138 split_string_by_emchar_1 (const Intbyte *string, Bytecount size, | |
3139 Emchar sepchar) | |
3140 { | 3353 { |
3141 Lisp_Object result = Qnil; | 3354 pause_so_user_can_read_messages (0); |
3142 const Intbyte *end = string + size; | 3355 return EXCEPTION_EXECUTE_HANDLER; |
3143 | 3356 } |
3144 while (1) | 3357 |
3358 /* This is called under MS Windows when an exception (this encompasses both | |
3359 user-defined exceptions and hardware exceptions such as GP faults aka | |
3360 SIGBUS or SIGSEGV) is triggered. */ | |
3361 | |
3362 static DWORD | |
3363 mswindows_handle_hardware_exceptions (DWORD code) | |
3364 { | |
3365 if (code != STATUS_ACCESS_VIOLATION && code != STATUS_ILLEGAL_INSTRUCTION | |
3366 && code != STATUS_PRIVILEGED_INSTRUCTION | |
3367 && code != STATUS_DATATYPE_MISALIGNMENT | |
3368 && code != STATUS_ASSERTION_FAILURE) | |
3369 return EXCEPTION_CONTINUE_SEARCH; | |
3370 | |
3371 /* I don't know if this filter is still wrapped in the outer __try, but | |
3372 it doesn't hurt to have another one, and it lets us control more | |
3373 exactly what we really want to do in such a situation. What we do is | |
3374 pause, if we haven't already done so, so that the user can see what's | |
3375 output. This is critical because otherwise the output is gone. */ | |
3376 __try | |
3145 { | 3377 { |
3146 const Intbyte *p = string; | 3378 guts_of_fatal_error_signal (-1); |
3147 while (p < end) | |
3148 { | |
3149 if (charptr_emchar (p) == sepchar) | |
3150 break; | |
3151 INC_CHARPTR (p); | |
3152 } | |
3153 result = Fcons (make_string (string, p - string), result); | |
3154 if (p < end) | |
3155 { | |
3156 string = p; | |
3157 INC_CHARPTR (string); /* skip sepchar */ | |
3158 } | |
3159 else | |
3160 break; | |
3161 } | 3379 } |
3162 return Fnreverse (result); | 3380 /* VC++ documentation says that |
3381 GetExceptionCode() cannot be called inside the filter itself. */ | |
3382 | |
3383 /* __except (mswindows_handle_hardware_exceptions (GetExceptionCode ())) {} | |
3384 | |
3385 The line above is original. Unfortunately, when an error is tripped | |
3386 inside of the handler (e.g. during Fbacktrace()), and the handler for | |
3387 the handler is invoked, it correctly notices that something is amiss | |
3388 and it should just return -- but it returns EXCEPTION_CONTINUE_SEARCH, | |
3389 which causes the debugger to be invoked debugging the handler code in | |
3390 this function -- and WITH THE STACK UNWOUND so that you see main() | |
3391 calling mswindows_handle_hardware_exceptions(), calling Fbacktrace(), | |
3392 and a crash a couple of frames in -- AND NO SIGN OF THE ORIGINAL CRASH! | |
3393 | |
3394 There's some real weirdness going on in the stack handling -- unlike | |
3395 in Unix, where further crashes just keep adding to the stack, it seems | |
3396 that under the structured-exception-handling, the stack can actually | |
3397 bounce back and forth between the full stack at the location of the | |
3398 exception and the unwound stack at the place where the __try clause was | |
3399 established. I don't completely understand it. What I do know is that | |
3400 returning EXCEPTION_EXECUTE_HANDLER on nested crash has the effect of | |
3401 aborting execution of the handler and going back to the outer filter | |
3402 function, which returns EXCEPTION_CONTINUE_SEARCH and everything is | |
3403 hunky-dorey -- your debugger sees a crash at the right location with | |
3404 the right stack. | |
3405 | |
3406 I'm leaving in the trickier Unix-like code in the handler; someone who | |
3407 understands better than me how the stack works in these handlers could | |
3408 fix it up more. As it is, it works pretty well, so I'm not likely to | |
3409 touch it more. --ben | |
3410 */ | |
3411 | |
3412 __except (mswindows_handle_hardware_exceptions_1 ()) {} | |
3413 | |
3414 /* pretend we didn't handle this, so that the debugger is invoked and/or | |
3415 the normal GPF box appears. */ | |
3416 return EXCEPTION_CONTINUE_SEARCH; | |
3163 } | 3417 } |
3164 | 3418 |
3165 /* The same as the above, except PATH is an external C string (it is | 3419 #endif /* _MSC_VER */ |
3166 converted using Qfile_name), and sepchar is hardcoded to SEPCHAR | 3420 |
3167 (':' or whatever). */ | 3421 /* -------------------------------------- */ |
3168 Lisp_Object | 3422 /* abnormal shutdowns: assertion failures */ |
3169 decode_path (const char *path) | 3423 /* -------------------------------------- */ |
3170 { | |
3171 Bytecount newlen; | |
3172 Intbyte *newpath; | |
3173 if (!path) | |
3174 return Qnil; | |
3175 | |
3176 TO_INTERNAL_FORMAT (C_STRING, path, ALLOCA, (newpath, newlen), Qfile_name); | |
3177 | |
3178 /* #### Does this make sense? It certainly does for | |
3179 decode_env_path(), but it looks dubious here. Does any code | |
3180 depend on decode_path("") returning nil instead of an empty | |
3181 string? */ | |
3182 if (!newlen) | |
3183 return Qnil; | |
3184 | |
3185 return split_string_by_emchar_1 (newpath, newlen, SEPCHAR); | |
3186 } | |
3187 | |
3188 Lisp_Object | |
3189 decode_env_path (const char *evarname, const char *default_) | |
3190 { | |
3191 const char *path = 0; | |
3192 if (evarname) | |
3193 path = egetenv (evarname); | |
3194 if (!path) | |
3195 path = default_; | |
3196 return decode_path (path); | |
3197 } | |
3198 | |
3199 /* Ben thinks this function should not exist or be exported to Lisp. | |
3200 We use it to define split-path-string in subr.el (not!). */ | |
3201 | |
3202 DEFUN ("split-string-by-char", Fsplit_string_by_char, 1, 2, 0, /* | |
3203 Split STRING into a list of substrings originally separated by SEPCHAR. | |
3204 */ | |
3205 (string, sepchar)) | |
3206 { | |
3207 CHECK_STRING (string); | |
3208 CHECK_CHAR (sepchar); | |
3209 return split_string_by_emchar_1 (XSTRING_DATA (string), | |
3210 XSTRING_LENGTH (string), | |
3211 XCHAR (sepchar)); | |
3212 } | |
3213 | |
3214 /* #### This was supposed to be in subr.el, but is used VERY early in | |
3215 the bootstrap process, so it goes here. Damn. */ | |
3216 | |
3217 DEFUN ("split-path", Fsplit_path, 1, 1, 0, /* | |
3218 Explode a search path into a list of strings. | |
3219 The path components are separated with the characters specified | |
3220 with `path-separator'. | |
3221 */ | |
3222 (path)) | |
3223 { | |
3224 CHECK_STRING (path); | |
3225 | |
3226 while (!STRINGP (Vpath_separator) | |
3227 || (XSTRING_CHAR_LENGTH (Vpath_separator) != 1)) | |
3228 Vpath_separator = signal_continuable_error | |
3229 (Qinvalid_state, | |
3230 "`path-separator' should be set to a single-character string", | |
3231 Vpath_separator); | |
3232 | |
3233 return (split_string_by_emchar_1 | |
3234 (XSTRING_DATA (path), XSTRING_LENGTH (path), | |
3235 charptr_emchar (XSTRING_DATA (Vpath_separator)))); | |
3236 } | |
3237 | |
3238 DEFUN ("noninteractive", Fnoninteractive, 0, 0, 0, /* | |
3239 Non-nil return value means XEmacs is running without interactive terminal. | |
3240 */ | |
3241 ()) | |
3242 { | |
3243 return noninteractive ? Qt : Qnil; | |
3244 } | |
3245 | 3424 |
3246 /* This flag is useful to define if you're under a debugger; this way, you | 3425 /* This flag is useful to define if you're under a debugger; this way, you |
3247 can put a breakpoint of assert_failed() and debug multiple problems | 3426 can put a breakpoint of assert_failed() and debug multiple problems |
3248 in one session without having to recompile. */ | 3427 in one session without having to recompile. */ |
3249 /* #define ASSERTIONS_DONT_ABORT */ | 3428 /* #define ASSERTIONS_DONT_ABORT */ |
3250 | 3429 |
3251 #ifdef USE_ASSERTIONS | 3430 #ifdef USE_ASSERTIONS |
3252 /* This highly dubious kludge ... shut up Jamie, I'm tired of your slagging. */ | 3431 /* This highly dubious kludge ... shut up Jamie, I'm tired of your slagging. */ |
3253 | 3432 |
3433 /* Nonzero if handling an assertion failure. (Bumped by one each time | |
3434 we recursively hit such a failure.) */ | |
3254 static int in_assert_failed; | 3435 static int in_assert_failed; |
3436 | |
3255 static const char *assert_failed_file; | 3437 static const char *assert_failed_file; |
3256 static int assert_failed_line; | 3438 static int assert_failed_line; |
3257 static const char *assert_failed_expr; | 3439 static const char *assert_failed_expr; |
3258 | 3440 |
3259 #ifdef fprintf | 3441 #ifdef fprintf |
3260 #undef fprintf | 3442 #undef fprintf |
3261 #endif | 3443 #endif |
3262 | 3444 |
3263 #undef abort /* avoid infinite #define loop... */ | 3445 /* This is called when an assert() fails or when abort() is called -- both |
3264 | 3446 of those are defined in the preprocessor to an expansion involving |
3265 #if defined (WIN32_NATIVE) && defined (DEBUG_XEMACS) | 3447 assert_failed(). */ |
3266 #define enter_debugger() DebugBreak () | |
3267 #else | |
3268 #define enter_debugger() | |
3269 #endif | |
3270 | |
3271 void | 3448 void |
3272 assert_failed (const char *file, int line, const char *expr) | 3449 assert_failed (const char *file, int line, const char *expr) |
3273 { | 3450 { |
3274 /* If we're already crashing, let's not crash again. This might be | 3451 /* If we're already crashing, let's not crash again. This might be |
3275 critical to getting auto-saving working properly. */ | 3452 critical to getting auto-saving working properly. */ |
3277 return; | 3454 return; |
3278 | 3455 |
3279 /* We are extremely paranoid so we sensibly deal with recursive | 3456 /* We are extremely paranoid so we sensibly deal with recursive |
3280 assertion failures. */ | 3457 assertion failures. */ |
3281 in_assert_failed++; | 3458 in_assert_failed++; |
3459 inhibit_non_essential_printing_operations = 1; | |
3282 | 3460 |
3283 if (in_assert_failed >= 4) | 3461 if (in_assert_failed >= 4) |
3284 _exit (-1); | 3462 _exit (-1); |
3285 else if (in_assert_failed == 3) | 3463 else if (in_assert_failed == 3) |
3286 { | 3464 { |
3287 enter_debugger (); | 3465 debugging_breakpoint (); |
3288 _exit (-1); | 3466 _exit (-1); |
3289 } | 3467 } |
3290 else if (in_assert_failed == 2) | 3468 else if (in_assert_failed == 2) |
3291 { | 3469 { |
3292 /* Not stderr_out(), which does additional things and may trigger | 3470 /* Ultra-paranoia. stderr_out() tries very hard not to do |
3293 a recursive assertion failure. fprintf was undeffed above, in | 3471 anything during assertion failures that might trigger more |
3294 case it was encapsulated. */ | 3472 failures; but we might have messed up somewhere. fprintf was |
3473 undeffed above, in case it was encapsulated. */ | |
3295 fprintf (stderr, | 3474 fprintf (stderr, |
3296 "Fatal error: recursive assertion failure, " | 3475 "Fatal error: recursive assertion failure, " |
3297 "file %s, line %d, %s\n", | 3476 "file %s, line %d, %s\n", |
3298 file, line, expr); | 3477 file, line, expr); |
3299 fprintf (stderr, | 3478 fprintf (stderr, |
3304 { | 3483 { |
3305 assert_failed_file = file; | 3484 assert_failed_file = file; |
3306 assert_failed_line = line; | 3485 assert_failed_line = line; |
3307 assert_failed_expr = expr; | 3486 assert_failed_expr = expr; |
3308 | 3487 |
3309 if (!initialized) | 3488 stderr_out ("\nFatal error: assertion failed, file %s, line %d, %s\n", |
3310 fprintf (stderr, | 3489 file, line, expr); |
3311 "Fatal error: assertion failed, file %s, line %d, %s\n", | |
3312 file, line, expr); | |
3313 else | |
3314 stderr_out ("Fatal error: assertion failed, file %s, line %d, %s\n", | |
3315 file, line, expr); | |
3316 } | 3490 } |
3317 | 3491 |
3318 enter_debugger (); | 3492 /* Enable the following if you want a breakpoint right away to the |
3493 debugger, without the whole shutdown processing first. This can be | |
3494 useful if you're afraid the shutdown processing will modify state that | |
3495 you're trying to debug (generally fairly unlikely); but you then don't | |
3496 get the auto-save behavior, which may be extremely important if you | |
3497 were in the middle of doing something */ | |
3498 /* debugging_breakpoint (); */ | |
3319 #if !defined (ASSERTIONS_DONT_ABORT) | 3499 #if !defined (ASSERTIONS_DONT_ABORT) |
3320 abort (); | 3500 #ifdef _MSC_VER |
3321 #endif | 3501 /* Calling abort() directly just seems to exit, in a way we can't |
3502 trap. (#### The docs say it does raise(SIGABRT), which we should be | |
3503 able to trap. Perhaps we're messing up somewhere? Or perhaps MS is | |
3504 messed up.) | |
3505 | |
3506 So, instead we cause an exception and enter into the structured | |
3507 exception-handling mechanism, which is just like what happens when a | |
3508 GPF occurs, and is cleaner anyway. (If we entered into one of the | |
3509 signal handlers, a crash in there would enter anyway into the | |
3510 structured exception stuff, and you'd get some weird mixture. Cleaner | |
3511 to keep it all in the expected way.) | |
3512 */ | |
3513 /* Either of the following work in terms of causing an exception. The | |
3514 second one looks cleaner but you get an odd message about "Unknown | |
3515 software exception ..." without the obvious "OK to terminate", "Cancel | |
3516 to debug"; instead, you just get OK/Cancel, which in fact do those | |
3517 same things. */ | |
3518 * ((int *) 0) = 666; | |
3519 /* RaiseException (STATUS_ASSERTION_FAILURE, EXCEPTION_NONCONTINUABLE, 0, | |
3520 0); */ | |
3521 #else | |
3522 really_abort (); | |
3523 #endif /* _MSC_VER */ | |
3524 #endif /* !defined (ASSERTIONS_DONT_ABORT) */ | |
3525 inhibit_non_essential_printing_operations = 0; | |
3322 in_assert_failed = 0; | 3526 in_assert_failed = 0; |
3323 } | 3527 } |
3324 #endif /* USE_ASSERTIONS */ | 3528 #endif /* USE_ASSERTIONS */ |
3325 | 3529 |
3326 | 3530 /* -------------------------------------- */ |
3327 #ifdef DEBUG_XEMACS | 3531 /* low-memory notification */ |
3328 | 3532 /* -------------------------------------- */ |
3329 DEFUN ("force-debugging-signal", Fforce_debugging_signal, 0, 1, 0, /* | 3533 |
3330 Cause XEmacs to enter the debugger. | 3534 #ifdef SIGDANGER |
3331 On some systems, there may be no way to do this gracefully; if so, | 3535 |
3332 nothing happens unless ABORT is non-nil, in which case XEmacs will | 3536 /* Handler for SIGDANGER. */ |
3333 abort() -- a sure-fire way to immediately get back to the debugger, | 3537 SIGTYPE |
3334 but also a sure-fire way to kill XEmacs (and dump core on Unix | 3538 memory_warning_signal (int sig) |
3335 systems)! | 3539 { |
3540 /* #### bad bad bad; this function shouldn't do anything except | |
3541 set a flag, or weird corruption could happen. */ | |
3542 EMACS_SIGNAL (sig, memory_warning_signal); | |
3543 | |
3544 malloc_warning | |
3545 (GETTEXT ("Operating system warns that virtual memory is running low.\n")); | |
3546 | |
3547 /* It might be unsafe to call do_auto_save now. */ | |
3548 force_auto_save_soon (); | |
3549 } | |
3550 #endif /* SIGDANGER */ | |
3551 | |
3552 | |
3553 /************************************************************************/ | |
3554 /* Miscellaneous */ | |
3555 /************************************************************************/ | |
3556 | |
3557 DEFUN ("noninteractive", Fnoninteractive, 0, 0, 0, /* | |
3558 Non-nil return value means XEmacs is running without interactive terminal. | |
3336 */ | 3559 */ |
3337 (abort_)) | 3560 ()) |
3338 { | 3561 { |
3339 enter_debugger (); | 3562 return noninteractive ? Qt : Qnil; |
3340 if (!NILP (abort_)) | |
3341 abort (); | |
3342 return Qnil; | |
3343 } | 3563 } |
3344 | |
3345 #endif /* DEBUG_XEMACS */ | |
3346 | 3564 |
3347 #ifdef QUANTIFY | 3565 #ifdef QUANTIFY |
3348 DEFUN ("quantify-start-recording-data", Fquantify_start_recording_data, | 3566 DEFUN ("quantify-start-recording-data", Fquantify_start_recording_data, |
3349 0, 0, "", /* | 3567 0, 0, "", /* |
3350 Start recording Quantify data. | 3568 Start recording Quantify data. |
3397 DEFSUBR (Fquantify_start_recording_data); | 3615 DEFSUBR (Fquantify_start_recording_data); |
3398 DEFSUBR (Fquantify_stop_recording_data); | 3616 DEFSUBR (Fquantify_stop_recording_data); |
3399 DEFSUBR (Fquantify_clear_data); | 3617 DEFSUBR (Fquantify_clear_data); |
3400 #endif /* QUANTIFY */ | 3618 #endif /* QUANTIFY */ |
3401 | 3619 |
3402 DEFSUBR (Fsplit_string_by_char); | |
3403 DEFSUBR (Fsplit_path); /* #### */ | |
3404 | |
3405 DEFSYMBOL (Qkill_emacs_hook); | 3620 DEFSYMBOL (Qkill_emacs_hook); |
3406 DEFSYMBOL (Qsave_buffers_kill_emacs); | 3621 DEFSYMBOL (Qsave_buffers_kill_emacs); |
3407 } | 3622 } |
3408 | 3623 |
3409 void | 3624 void |
3444 | 3659 |
3445 DEFVAR_LISP ("system-type", &Vsystem_type /* | 3660 DEFVAR_LISP ("system-type", &Vsystem_type /* |
3446 Symbol indicating type of operating system you are using. | 3661 Symbol indicating type of operating system you are using. |
3447 */ ); | 3662 */ ); |
3448 Vsystem_type = intern (SYSTEM_TYPE); | 3663 Vsystem_type = intern (SYSTEM_TYPE); |
3449 Fprovide (intern(SYSTEM_TYPE)); | 3664 Fprovide (Vsystem_type); |
3450 | 3665 |
3451 #ifndef EMACS_CONFIGURATION | 3666 #ifndef EMACS_CONFIGURATION |
3452 # define EMACS_CONFIGURATION "UNKNOWN" | 3667 # define EMACS_CONFIGURATION "UNKNOWN" |
3453 #endif | 3668 #endif |
3454 DEFVAR_LISP ("system-configuration", &Vsystem_configuration /* | 3669 DEFVAR_LISP ("system-configuration", &Vsystem_configuration /* |
3640 Mail spool locking method suggested by configure. This is one | 3855 Mail spool locking method suggested by configure. This is one |
3641 of the symbols in MAIL-LOCK-METHODS. | 3856 of the symbols in MAIL-LOCK-METHODS. |
3642 */ ); | 3857 */ ); |
3643 { | 3858 { |
3644 #if defined(MAIL_LOCK_FLOCK) && defined(HAVE_FLOCK) | 3859 #if defined(MAIL_LOCK_FLOCK) && defined(HAVE_FLOCK) |
3645 Vconfigure_mail_lock_method = intern("flock"); | 3860 Vconfigure_mail_lock_method = intern ("flock"); |
3646 #elif defined(MAIL_LOCK_LOCKF) && defined(HAVE_LOCKF) | 3861 #elif defined(MAIL_LOCK_LOCKF) && defined(HAVE_LOCKF) |
3647 Vconfigure_mail_lock_method = intern("lockf"); | 3862 Vconfigure_mail_lock_method = intern ("lockf"); |
3648 #elif defined(MAIL_LOCK_MMDF) && defined(HAVE_MMDF) | 3863 #elif defined(MAIL_LOCK_MMDF) && defined(HAVE_MMDF) |
3649 Vconfigure_mail_lock_method = intern("mmdf"); | 3864 Vconfigure_mail_lock_method = intern ("mmdf"); |
3650 #elif defined(MAIL_LOCK_LOCKING) && defined(HAVE_LOCKING) | 3865 #elif defined(MAIL_LOCK_LOCKING) && defined(HAVE_LOCKING) |
3651 Vconfigure_mail_lock_method = intern("locking"); | 3866 Vconfigure_mail_lock_method = intern ("locking"); |
3652 #else | 3867 #else |
3653 Vconfigure_mail_lock_method = intern("dot"); | 3868 Vconfigure_mail_lock_method = intern ("dot"); |
3654 #endif | 3869 #endif |
3655 } | |
3656 | |
3657 DEFVAR_LISP ("path-separator", &Vpath_separator /* | |
3658 The directory separator in search paths, as a string. | |
3659 */ ); | |
3660 { | |
3661 char c = SEPCHAR; | |
3662 Vpath_separator = make_string ((Intbyte *)&c, 1); | |
3663 } | 3870 } |
3664 } | 3871 } |
3665 | 3872 |
3666 void | 3873 void |
3667 complex_vars_of_emacs (void) | 3874 complex_vars_of_emacs (void) |
3671 DEFVAR_LISP ("emacs-program-name", &Vemacs_program_name /* | 3878 DEFVAR_LISP ("emacs-program-name", &Vemacs_program_name /* |
3672 *Name of the Emacs variant. | 3879 *Name of the Emacs variant. |
3673 For example, this may be \"xemacs\" or \"infodock\". | 3880 For example, this may be \"xemacs\" or \"infodock\". |
3674 This is mainly meant for use in path searching. | 3881 This is mainly meant for use in path searching. |
3675 */ ); | 3882 */ ); |
3676 Vemacs_program_name = build_string ((char *) PATH_PROGNAME); | 3883 Vemacs_program_name = build_ext_string (PATH_PROGNAME, Qfile_name); |
3677 | 3884 |
3678 DEFVAR_LISP ("emacs-program-version", &Vemacs_program_version /* | 3885 DEFVAR_LISP ("emacs-program-version", &Vemacs_program_version /* |
3679 *Version of the Emacs variant. | 3886 *Version of the Emacs variant. |
3680 This typically has the form NN.NN-bNN. | 3887 This typically has the form NN.NN-bNN. |
3681 This is mainly meant for use in path searching. | 3888 This is mainly meant for use in path searching. |
3682 */ ); | 3889 */ ); |
3683 Vemacs_program_version = build_string ((char *) PATH_VERSION); | 3890 Vemacs_program_version = build_ext_string (PATH_VERSION, Qfile_name); |
3684 | 3891 |
3685 DEFVAR_LISP ("exec-path", &Vexec_path /* | 3892 DEFVAR_LISP ("exec-path", &Vexec_path /* |
3686 *List of directories to search programs to run in subprocesses. | 3893 *List of directories to search programs to run in subprocesses. |
3687 Each element is a string (directory name) or nil (try default directory). | 3894 Each element is a string (directory name) or nil (try default directory). |
3688 */ ); | 3895 */ ); |
3698 For internal use by the build procedure only. | 3905 For internal use by the build procedure only. |
3699 configure's idea of what `exec-directory' will be. | 3906 configure's idea of what `exec-directory' will be. |
3700 */ ); | 3907 */ ); |
3701 #ifdef PATH_EXEC | 3908 #ifdef PATH_EXEC |
3702 Vconfigure_exec_directory = Ffile_name_as_directory | 3909 Vconfigure_exec_directory = Ffile_name_as_directory |
3703 (build_string ((char *) PATH_EXEC)); | 3910 (build_ext_string (PATH_EXEC, Qfile_name)); |
3704 #else | 3911 #else |
3705 Vconfigure_exec_directory = Qnil; | 3912 Vconfigure_exec_directory = Qnil; |
3706 #endif | 3913 #endif |
3707 | 3914 |
3708 DEFVAR_LISP ("lisp-directory", &Vlisp_directory /* | 3915 DEFVAR_LISP ("lisp-directory", &Vlisp_directory /* |
3714 For internal use by the build procedure only. | 3921 For internal use by the build procedure only. |
3715 configure's idea of what `lisp-directory' will be. | 3922 configure's idea of what `lisp-directory' will be. |
3716 */ ); | 3923 */ ); |
3717 #ifdef PATH_LOADSEARCH | 3924 #ifdef PATH_LOADSEARCH |
3718 Vconfigure_lisp_directory = Ffile_name_as_directory | 3925 Vconfigure_lisp_directory = Ffile_name_as_directory |
3719 (build_string ((char *) PATH_LOADSEARCH)); | 3926 (build_ext_string (PATH_LOADSEARCH, Qfile_name)); |
3720 #else | 3927 #else |
3721 Vconfigure_lisp_directory = Qnil; | 3928 Vconfigure_lisp_directory = Qnil; |
3722 #endif | 3929 #endif |
3723 | 3930 |
3724 DEFVAR_LISP ("mule-lisp-directory", &Vmule_lisp_directory /* | 3931 DEFVAR_LISP ("mule-lisp-directory", &Vmule_lisp_directory /* |
3746 For internal use by the build procedure only. | 3953 For internal use by the build procedure only. |
3747 configure's idea of what `module-directory' will be. | 3954 configure's idea of what `module-directory' will be. |
3748 */ ); | 3955 */ ); |
3749 #ifdef PATH_MODULESEARCH | 3956 #ifdef PATH_MODULESEARCH |
3750 Vconfigure_module_directory = Ffile_name_as_directory | 3957 Vconfigure_module_directory = Ffile_name_as_directory |
3751 (build_string ((char *) PATH_MODULESEARCH)); | 3958 (build_ext_string (PATH_MODULESEARCH, Qfile_name)); |
3752 #else | 3959 #else |
3753 Vconfigure_module_directory = Qnil; | 3960 Vconfigure_module_directory = Qnil; |
3754 #endif | 3961 #endif |
3755 | 3962 |
3756 DEFVAR_LISP ("configure-package-path", &Vconfigure_package_path /* | 3963 DEFVAR_LISP ("configure-package-path", &Vconfigure_package_path /* |
3757 For internal use by the build procedure only. | 3964 For internal use by the build procedure only. |
3758 configure's idea of what the package path will be. | 3965 configure's idea of what the package path will be. |
3759 */ ); | 3966 */ ); |
3760 #ifdef PATH_PACKAGEPATH | 3967 #ifdef PATH_PACKAGEPATH |
3761 Vconfigure_package_path = decode_path (PATH_PACKAGEPATH); | 3968 Vconfigure_package_path = split_external_path (PATH_PACKAGEPATH); |
3762 #else | 3969 #else |
3763 Vconfigure_package_path = Qnil; | 3970 Vconfigure_package_path = Qnil; |
3764 #endif | 3971 #endif |
3765 | 3972 |
3766 DEFVAR_LISP ("data-directory", &Vdata_directory /* | 3973 DEFVAR_LISP ("data-directory", &Vdata_directory /* |
3776 For internal use by the build procedure only. | 3983 For internal use by the build procedure only. |
3777 configure's idea of what `data-directory' will be. | 3984 configure's idea of what `data-directory' will be. |
3778 */ ); | 3985 */ ); |
3779 #ifdef PATH_DATA | 3986 #ifdef PATH_DATA |
3780 Vconfigure_data_directory = Ffile_name_as_directory | 3987 Vconfigure_data_directory = Ffile_name_as_directory |
3781 (build_string ((char *) PATH_DATA)); | 3988 (build_ext_string (PATH_DATA, Qfile_name)); |
3782 #else | 3989 #else |
3783 Vconfigure_data_directory = Qnil; | 3990 Vconfigure_data_directory = Qnil; |
3784 #endif | 3991 #endif |
3785 | 3992 |
3786 DEFVAR_LISP ("data-directory-list", &Vdata_directory_list /* | 3993 DEFVAR_LISP ("data-directory-list", &Vdata_directory_list /* |
3798 For internal use by the build procedure only. | 4005 For internal use by the build procedure only. |
3799 configure's idea of what `site-directory' will be. | 4006 configure's idea of what `site-directory' will be. |
3800 */ ); | 4007 */ ); |
3801 #ifdef PATH_SITE | 4008 #ifdef PATH_SITE |
3802 Vconfigure_site_directory = Ffile_name_as_directory | 4009 Vconfigure_site_directory = Ffile_name_as_directory |
3803 (build_string ((char *) PATH_SITE)); | 4010 (build_ext_string (PATH_SITE, Qfile_name)); |
3804 #else | 4011 #else |
3805 Vconfigure_site_directory = Qnil; | 4012 Vconfigure_site_directory = Qnil; |
3806 #endif | 4013 #endif |
3807 | 4014 |
3808 DEFVAR_LISP ("site-module-directory", &Vsite_module_directory /* | 4015 DEFVAR_LISP ("site-module-directory", &Vsite_module_directory /* |
3814 For internal use by the build procedure only. | 4021 For internal use by the build procedure only. |
3815 configure's idea of what `site-directory' will be. | 4022 configure's idea of what `site-directory' will be. |
3816 */ ); | 4023 */ ); |
3817 #ifdef PATH_SITE_MODULES | 4024 #ifdef PATH_SITE_MODULES |
3818 Vconfigure_site_module_directory = Ffile_name_as_directory | 4025 Vconfigure_site_module_directory = Ffile_name_as_directory |
3819 (build_string ((char *) PATH_SITE_MODULES)); | 4026 (build_ext_string (PATH_SITE_MODULES, Qfile_name)); |
3820 #else | 4027 #else |
3821 Vconfigure_site_module_directory = Qnil; | 4028 Vconfigure_site_module_directory = Qnil; |
3822 #endif | 4029 #endif |
3823 | 4030 |
3824 DEFVAR_LISP ("doc-directory", &Vdoc_directory /* | 4031 DEFVAR_LISP ("doc-directory", &Vdoc_directory /* |
3831 For internal use by the build procedure only. | 4038 For internal use by the build procedure only. |
3832 configure's idea of what `doc-directory' will be. | 4039 configure's idea of what `doc-directory' will be. |
3833 */ ); | 4040 */ ); |
3834 #ifdef PATH_DOC | 4041 #ifdef PATH_DOC |
3835 Vconfigure_doc_directory = Ffile_name_as_directory | 4042 Vconfigure_doc_directory = Ffile_name_as_directory |
3836 (build_string ((char *) PATH_DOC)); | 4043 (build_ext_string (PATH_DOC, Qfile_name)); |
3837 #else | 4044 #else |
3838 Vconfigure_doc_directory = Qnil; | 4045 Vconfigure_doc_directory = Qnil; |
3839 #endif | 4046 #endif |
3840 | 4047 |
3841 DEFVAR_LISP ("configure-exec-prefix-directory", &Vconfigure_exec_prefix_directory /* | 4048 DEFVAR_LISP ("configure-exec-prefix-directory", &Vconfigure_exec_prefix_directory /* |
3842 For internal use by the build procedure only. | 4049 For internal use by the build procedure only. |
3843 configure's idea of what `exec-prefix-directory' will be. | 4050 configure's idea of what `exec-prefix-directory' will be. |
3844 */ ); | 4051 */ ); |
3845 #ifdef PATH_EXEC_PREFIX | 4052 #ifdef PATH_EXEC_PREFIX |
3846 Vconfigure_exec_prefix_directory = Ffile_name_as_directory | 4053 Vconfigure_exec_prefix_directory = Ffile_name_as_directory |
3847 (build_string ((char *) PATH_EXEC_PREFIX)); | 4054 (build_ext_string (PATH_EXEC_PREFIX, Qfile_name)); |
3848 #else | 4055 #else |
3849 Vconfigure_exec_prefix_directory = Qnil; | 4056 Vconfigure_exec_prefix_directory = Qnil; |
3850 #endif | 4057 #endif |
3851 | 4058 |
3852 DEFVAR_LISP ("configure-prefix-directory", &Vconfigure_prefix_directory /* | 4059 DEFVAR_LISP ("configure-prefix-directory", &Vconfigure_prefix_directory /* |
3853 For internal use by the build procedure only. | 4060 For internal use by the build procedure only. |
3854 configure's idea of what `prefix-directory' will be. | 4061 configure's idea of what `prefix-directory' will be. |
3855 */ ); | 4062 */ ); |
3856 #ifdef PATH_PREFIX | 4063 #ifdef PATH_PREFIX |
3857 Vconfigure_prefix_directory = Ffile_name_as_directory | 4064 Vconfigure_prefix_directory = Ffile_name_as_directory |
3858 (build_string ((char *) PATH_PREFIX)); | 4065 (build_ext_string (PATH_PREFIX, Qfile_name)); |
3859 #else | 4066 #else |
3860 Vconfigure_prefix_directory = Qnil; | 4067 Vconfigure_prefix_directory = Qnil; |
3861 #endif | 4068 #endif |
3862 | 4069 |
3863 DEFVAR_LISP ("configure-info-directory", &Vconfigure_info_directory /* | 4070 DEFVAR_LISP ("configure-info-directory", &Vconfigure_info_directory /* |
3866 Emacs's info files; the default value for Info-default-directory-list | 4073 Emacs's info files; the default value for Info-default-directory-list |
3867 includes this. | 4074 includes this. |
3868 */ ); | 4075 */ ); |
3869 #ifdef PATH_INFO | 4076 #ifdef PATH_INFO |
3870 Vconfigure_info_directory = | 4077 Vconfigure_info_directory = |
3871 Ffile_name_as_directory (build_string (PATH_INFO)); | 4078 Ffile_name_as_directory (build_ext_string (PATH_INFO, Qfile_name)); |
3872 #else | 4079 #else |
3873 Vconfigure_info_directory = Qnil; | 4080 Vconfigure_info_directory = Qnil; |
3874 #endif | 4081 #endif |
3875 | 4082 |
3876 DEFVAR_LISP ("configure-info-path", &Vconfigure_info_path /* | 4083 DEFVAR_LISP ("configure-info-path", &Vconfigure_info_path /* |
3877 The configured initial path for info documentation. | 4084 The configured initial path for info documentation. |
3878 */ ); | 4085 */ ); |
3879 #ifdef PATH_INFOPATH | 4086 #ifdef PATH_INFOPATH |
3880 Vconfigure_info_path = decode_path (PATH_INFOPATH); | 4087 Vconfigure_info_path = split_external_path (PATH_INFOPATH); |
3881 #else | 4088 #else |
3882 Vconfigure_info_path = Qnil; | 4089 Vconfigure_info_path = Qnil; |
3883 #endif | 4090 #endif |
3884 } | 4091 } |
3885 | 4092 |
3895 __sti__iflPNGFile_c___ (void) | 4102 __sti__iflPNGFile_c___ (void) |
3896 { | 4103 { |
3897 } | 4104 } |
3898 | 4105 |
3899 #endif | 4106 #endif |
4107 | |
4108 #undef abort /* Get access to the real version of abort. We put this all | |
4109 the way at the end to make sure that all calls to abort() | |
4110 anywhere in the above code go through assert_failed(). */ | |
4111 | |
4112 void | |
4113 really_abort (void) | |
4114 { | |
4115 abort (); | |
4116 } |