comparison src/emacs.c @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents de805c49cfc1
children da8ed4261e83
comparison
equal deleted inserted replaced
411:12e008d41344 412:697ef44129c6
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.
6 5
7 This file is part of XEmacs. 6 This file is part of XEmacs.
8 7
9 XEmacs is free software; you can redistribute it and/or modify it 8 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 9 under the terms of the GNU General Public License as published by the
20 along with XEmacs; see the file COPYING. If not, write to 19 along with XEmacs; see the file COPYING. If not, write to
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 Boston, MA 02111-1307, USA. */ 21 Boston, MA 02111-1307, USA. */
23 22
24 /* Synched up with: Mule 2.0, FSF 19.28. */ 23 /* Synched up with: Mule 2.0, FSF 19.28. */
25
26 /* Capsule summary of the various releases of Lucid Emacs/XEmacs and
27 FSF/GNU Emacs. Provided here for use in cross-referencing version
28 releases and dates in comments, esp. in the authorship comments at
29 the beginning of each file. More information about history can be
30 found in the beginning of the Internals Manual and in the About page.
31
32
33 -- A time line for Lucid Emacs/XEmacs is
34
35 version 19.0 shipped with Energize 1.0, April 1992.
36 version 19.1 released June 4, 1992.
37 version 19.2 released June 19, 1992.
38 version 19.3 released September 9, 1992.
39 version 19.4 released January 21, 1993.
40 version 19.5 was a repackaging of 19.4 with a few bug fixes and
41 shipped with Energize 2.0. Never released to the net.
42 version 19.6 released April 9, 1993.
43 version 19.7 was a repackaging of 19.6 with a few bug fixes and
44 shipped with Energize 2.1. Never released to the net.
45 version 19.8 released September 6, 1993.
46 version 19.9 released January 12, 1994.
47 version 19.10 released May 27, 1994.
48 version 19.11 (first XEmacs) released September 13, 1994.
49 version 19.12 released June 23, 1995.
50 version 19.13 released September 1, 1995.
51 version 19.14 released June 23, 1996.
52 version 20.0 released February 9, 1997.
53 version 19.15 released March 28, 1997.
54 version 20.1 (not released to the net) April 15, 1997.
55 version 20.2 released May 16, 1997.
56 version 19.16 released October 31, 1997.
57 version 20.3 (the first stable version of XEmacs 20.x) released
58 November 30, 1997.
59 version 20.4 released February 28, 1998.
60
61
62 -- A time line for GNU Emacs version 19 is
63
64 version 19.7 (beta) (first beta release) released ??????; prob. late May 1993.
65 version 19.8 (beta) released May 27, 1993.
66 version 19.9 (beta) released May 27, 1993.
67 version 19.10 (beta) released May 30, 1993.
68 version 19.11 (beta) released June 1, 1993.
69 version 19.12 (beta) released June 2, 1993.
70 version 19.13 (beta) released June 8, 1993.
71 version 19.14 (beta) released June 17, 1993.
72 version 19.15 (beta) released June 19, 1993.
73 version 19.16 (beta) released July 6, 1993.
74 version 19.17 (beta) released late July, 1993.
75 version 19.18 (beta) released August 9, 1993.
76 version 19.19 (beta) released August 15, 1993.
77 version 19.20 (beta) released November 17, 1993.
78 version 19.21 (beta) released November 17, 1993.
79 version 19.22 (beta) released November 28, 1993.
80 version 19.23 (beta) released May 17, 1994.
81 version 19.24 (beta) released May 16, 1994.
82 version 19.25 (beta) released June 3, 1994.
83 version 19.26 (beta) released September 11, 1994.
84 version 19.27 (beta) released September 14, 1994.
85 version 19.28 (first ``official'' release) released November 1, 1994.
86 version 19.29 released June 21, 1995.
87 version 19.30 released November 24, 1995.
88 version 19.31 released May 25, 1996.
89 version 19.32 released July 31, 1996.
90 version 19.33 released August 11, 1996.
91 version 19.34 released August 21, 1996.
92 version 19.34b released September 6, 1996.
93
94
95 -- A time line for GNU Emacs version 20 is
96
97 version 20.1 released September 17, 1997.
98 version 20.2 released September 20, 1997.
99 version 20.3 released August 19, 1998.
100
101
102 -- A time line for GNU Emacs version 18 and older is
103
104 GNU Emacs version 15 (15.34) was released sometime in 1984 or 1985 and
105 shared some code with a version of Emacs written by James Gosling (the
106 same James Gosling who later created the Java language).
107 GNU Emacs version 16 (first released version was 16.56) was released on
108 July 15, 1985. All Gosling code was removed due to potential copyright
109 problems with the code.
110 version 16.57: released on September 16, 1985.
111 versions 16.58, 16.59: released on September 17, 1985.
112 version 16.60: released on September 19, 1985. These later version 16's
113 incorporated patches from the net, esp. for getting Emacs to work under
114 System V.
115 version 17.36 (first official v17 release) released on December 20, 1985.
116 Included a TeX-able user manual. First official unpatched version that
117 worked on vanilla System V machines.
118 version 17.43 (second official v17 release) released on January 25, 1986.
119 version 17.45 released on January 30, 1986.
120 version 17.46 released on February 4, 1986.
121 version 17.48 released on February 10, 1986.
122 version 17.49 released on February 12, 1986.
123 version 17.55 released on March 18, 1986.
124 version 17.57 released on March 27, 1986.
125 version 17.58 released on April 4, 1986.
126 version 17.61 released on April 12, 1986.
127 version 17.63 released on May 7, 1986.
128 version 17.64 released on May 12, 1986.
129 version 18.24 (a beta version) released on October 2, 1986.
130 version 18.30 (a beta version) released on November 15, 1986.
131 version 18.31 (a beta version) released on November 23, 1986.
132 version 18.32 (a beta version) released on December 7, 1986.
133 version 18.33 (a beta version) released on December 12, 1986.
134 version 18.35 (a beta version) released on January 5, 1987.
135 version 18.36 (a beta version) released on January 21, 1987.
136 January 27, 1987: The Great Usenet Renaming. net.emacs is now comp.emacs.
137 version 18.37 (a beta version) released on February 12, 1987.
138 version 18.38 (a beta version) released on March 3, 1987.
139 version 18.39 (a beta version) released on March 14, 1987.
140 version 18.40 (a beta version) released on March 18, 1987.
141 version 18.41 (the first ``official'' release) released on March 22, 1987.
142 version 18.45 released on June 2, 1987.
143 version 18.46 released on June 9, 1987.
144 version 18.47 released on June 18, 1987.
145 version 18.48 released on September 3, 1987.
146 version 18.49 released on September 18, 1987.
147 version 18.50 released on February 13, 1988.
148 version 18.51 released on May 7, 1988.
149 version 18.52 released on September 1, 1988.
150 version 18.53 released on February 24, 1989.
151 version 18.54 released on April 26, 1989.
152 version 18.55 released on August 23, 1989. This is the earliest version
153 that is still available by FTP.
154 version 18.56 released on January 17, 1991.
155 version 18.57 released late January, 1991.
156 version 18.58 released ?????.
157 version 18.59 released October 31, 1992.
158
159 */
160 24
161 /* Note: It is necessary to specify <config.h> and not "config.h" in 25 /* Note: It is necessary to specify <config.h> and not "config.h" in
162 order for the --srcdir type of compilation to work properly. 26 order for the --srcdir type of compilation to work properly.
163 Otherwise the config.h from the srcdir, rather than the one from 27 Otherwise the config.h from the srcdir, rather than the one from
164 the build dir, will be used. */ 28 the build dir, will be used. */
170 #include "buffer.h" 34 #include "buffer.h"
171 #include "commands.h" 35 #include "commands.h"
172 #include "console.h" 36 #include "console.h"
173 #include "process.h" 37 #include "process.h"
174 #include "redisplay.h" 38 #include "redisplay.h"
175 #include "frame.h"
176 #include "sysdep.h" 39 #include "sysdep.h"
177 40
178 #include "syssignal.h" /* Always include before systty.h */ 41 #include "syssignal.h" /* Always include before systty.h */
179 #include "systty.h" 42 #include "systty.h"
180 #include "sysfile.h" 43 #include "sysfile.h"
181 #include "systime.h" 44 #include "systime.h"
182 45
183 #ifdef PDUMP
184 #include "dump-id.h"
185 #include "dumper.h"
186 #endif
187
188 #ifndef SEPCHAR
189 #define SEPCHAR ':'
190 #endif
191
192 #ifdef QUANTIFY 46 #ifdef QUANTIFY
193 #include <quantify.h> 47 #include <quantify.h>
194 #endif 48 #endif
195 49
196 #ifdef HAVE_SHLIB 50 #ifdef HAVE_SHLIB
201 (defined (I18N2) || defined (I18N3) || defined (I18N4)) 55 (defined (I18N2) || defined (I18N3) || defined (I18N4))
202 #include <locale.h> 56 #include <locale.h>
203 #endif 57 #endif
204 58
205 #ifdef TOOLTALK 59 #ifdef TOOLTALK
206 #include TT_C_H_FILE 60 #include TT_C_H_PATH
207 #endif 61 #endif
208 62
209 #if defined (WIN32_NATIVE) 63 #ifdef APOLLO
210 #include "nt.h" 64 #ifndef APOLLO_SR10
65 #include <default_acl.h>
66 #endif
67 #endif
68
69 #if defined (WINDOWSNT)
70 #include <windows.h>
211 #endif 71 #endif
212 72
213 /* For PATH_EXEC */ 73 /* For PATH_EXEC */
214 #include <paths.h> 74 #include <paths.h>
215 75
216 #if defined (HEAP_IN_DATA) && !defined(PDUMP) 76 #if !defined SYSTEM_MALLOC && !defined DOUG_LEA_MALLOC
217 void report_sheap_usage (int die_if_pure_storage_exceeded);
218 #endif
219
220 #if !defined (SYSTEM_MALLOC) && !defined (DOUG_LEA_MALLOC)
221 extern void *(*__malloc_hook)(size_t); 77 extern void *(*__malloc_hook)(size_t);
222 extern void *(*__realloc_hook)(void *, size_t); 78 extern void *(*__realloc_hook)(void *, size_t);
223 extern void (*__free_hook)(void *); 79 extern void (*__free_hook)(void *);
224 #endif /* not SYSTEM_MALLOC && not DOUG_LEA_MALLOC */ 80 #endif /* not SYSTEM_MALLOC && not DOUG_LEA_MALLOC */
225 81
253 Lisp_Object Vsystem_configuration_options; 109 Lisp_Object Vsystem_configuration_options;
254 110
255 /* Version numbers and strings */ 111 /* Version numbers and strings */
256 Lisp_Object Vemacs_major_version; 112 Lisp_Object Vemacs_major_version;
257 Lisp_Object Vemacs_minor_version; 113 Lisp_Object Vemacs_minor_version;
258 Lisp_Object Vemacs_patch_level;
259 Lisp_Object Vemacs_beta_version; 114 Lisp_Object Vemacs_beta_version;
260 Lisp_Object Vxemacs_codename; 115 Lisp_Object Vxemacs_codename;
261 #ifdef INFODOCK 116 #ifdef INFODOCK
262 Lisp_Object Vinfodock_major_version; 117 Lisp_Object Vinfodock_major_version;
263 Lisp_Object Vinfodock_minor_version; 118 Lisp_Object Vinfodock_minor_version;
289 Lisp_Object Vconfigure_package_path; 144 Lisp_Object Vconfigure_package_path;
290 Lisp_Object Vdata_directory, Vconfigure_data_directory; 145 Lisp_Object Vdata_directory, Vconfigure_data_directory;
291 Lisp_Object Vdoc_directory, Vconfigure_doc_directory; 146 Lisp_Object Vdoc_directory, Vconfigure_doc_directory;
292 Lisp_Object Vconfigure_lock_directory; 147 Lisp_Object Vconfigure_lock_directory;
293 Lisp_Object Vdata_directory_list; 148 Lisp_Object Vdata_directory_list;
294 Lisp_Object Vconfigure_info_directory; 149 Lisp_Object Vinfo_directory, Vconfigure_info_directory;
295 Lisp_Object Vsite_directory, Vconfigure_site_directory; 150 Lisp_Object Vsite_directory, Vconfigure_site_directory;
296 Lisp_Object Vconfigure_info_path; 151 Lisp_Object Vconfigure_info_path;
297 Lisp_Object Vinternal_error_checking; 152 Lisp_Object Vinternal_error_checking;
298 Lisp_Object Vmail_lock_methods, Vconfigure_mail_lock_method;
299 Lisp_Object Vpath_separator; 153 Lisp_Object Vpath_separator;
300 154
301 /* The default base directory XEmacs is installed under. */ 155 /* The default base directory XEmacs is installed under. */
302 Lisp_Object Vconfigure_exec_prefix_directory, Vconfigure_prefix_directory; 156 Lisp_Object Vconfigure_exec_prefix_directory, Vconfigure_prefix_directory;
303 157
304 /* If nonzero, set XEmacs to run at this priority. This is also used 158 /* If nonzero, set XEmacs to run at this priority. This is also used
305 in child_setup and sys_suspend to make sure subshells run at normal 159 in child_setup and sys_suspend to make sure subshells run at normal
306 priority. */ 160 priority. */
307 int emacs_priority; 161 int emacs_priority;
308 162
309 /* Some FSF junk with running_asynch_code, to preserve the match 163 /* If non-zero a filter or a sentinel is running. Tested to save the match
310 data. Not necessary because we don't call process filters 164 data on the first attempt to change it inside asynchronous code. */
311 asynchronously (i.e. from within QUIT). */
312 /* #### Delete this when merging the rest of my code */
313 int running_asynch_code; 165 int running_asynch_code;
314 166
315 /* If non-zero, a window-system was specified on the command line. */ 167 /* If non-zero, a window-system was specified on the command line. */
316 int display_arg; 168 int display_arg;
317 169
318 /* Type of display specified. We cannot use a Lisp symbol here because 170 /* 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 171 Lisp symbols may not initialized at the time that we set this
320 variable. */ 172 variable. */
321 const char *display_use; 173 CONST char *display_use;
322 174
323 /* If non-zero, then the early error handler will only print the error 175 /* If non-zero, then the early error handler will only print the error
324 message and exit. */ 176 message and exit. */
325 int suppress_early_error_handler_backtrace; 177 int suppress_early_error_handler_backtrace;
326 178
358 int inhibit_early_packages; 210 int inhibit_early_packages;
359 211
360 /* Nonzero means don't load package autoloads at startup */ 212 /* Nonzero means don't load package autoloads at startup */
361 int inhibit_autoloads; 213 int inhibit_autoloads;
362 214
363 /* Nonzero means don't load the dump file (ignored if not PDUMP) */
364
365 int nodumpfile;
366
367 /* Nonzero means print debug information about path searching */ 215 /* Nonzero means print debug information about path searching */
368 int debug_paths; 216 int debug_paths;
369 217
370 /* Save argv and argc. */ 218 /* Save argv and argc. */
371 static char **initial_argv; 219 char **initial_argv;
372 static int initial_argc; 220 int initial_argc;
373 221
374 static void sort_args (int argc, char **argv); 222 static void sort_args (int argc, char **argv);
375 223
376 Lisp_Object Qkill_emacs_hook; 224 Lisp_Object Qkill_emacs_hook;
377 Lisp_Object Qsave_buffers_kill_emacs; 225 Lisp_Object Qsave_buffers_kill_emacs;
378 226
379 extern Lisp_Object Vlisp_EXEC_SUFFIXES; 227 extern Lisp_Object Vlisp_EXEC_SUFFIXES;
380 228
381 229
382 230 /* Signal code for the fatal signal that was received */
383 /* Ben's capsule summary about expected and unexpected exits from XEmacs. 231 static int fatal_error_code;
384 232
385 Expected exits occur when the user directs XEmacs to exit, for example 233 /* Nonzero if handling a fatal error already */
386 by pressing the close button on the only frame in XEmacs, or by typing 234 static int fatal_error_in_progress;
387 C-x C-c. This runs `save-buffers-kill-emacs', which saves any necessary 235
388 buffers, and then exits using the primitive `kill-emacs'. 236 static void shut_down_emacs (int sig, Lisp_Object stuff);
389
390 However, unexpected exits occur in a few different ways:
391
392 -- a memory access violation or other hardware-generated exception
393 occurs. This is the worst possible problem to deal with, because
394 the fault can occur while XEmacs is in any state whatsoever, even
395 quite unstable ones. As a result, we need to be *extremely* careful
396 what we do.
397 -- we are using one X display (or if we've used more, we've closed the
398 others already), and some hardware or other problem happens and
399 suddenly we've lost our connection to the display. In this situation,
400 things are not so dire as in the last one; our code itself isn't
401 trashed, so we can continue execution as normal, after having set
402 things up so that we can exit at the appropriate time. Our exit
403 still needs to be of the emergency nature; we have no displays, so
404 any attempts to use them will fail. We simply want to auto-save
405 (the single most important thing to do during shut-down), do minimal
406 cleanup of stuff that has an independent existence outside of XEmacs,
407 and exit.
408
409 Currently, both unexpected exit scenarios described above set
410 preparing_for_armageddon to indicate that nonessential and possibly
411 dangerous things should not be done, specifically:
412
413 -- no garbage collection.
414 -- no hooks are run.
415 -- no messages of any sort from autosaving.
416 -- autosaving tries harder, ignoring certain failures.
417 -- existing frames are not deleted.
418
419 (Also, all places that set preparing_for_armageddon also
420 set dont_check_for_quit. This happens separately because it's
421 also necessary to set other variables to make absolutely sure
422 no quitting happens.)
423
424 In the first scenario above (the access violation), we also set
425 fatal_error_in_progress. This causes more things to not happen:
426
427 -- assertion failures do not abort.
428 -- printing code does not do code conversion or gettext when
429 printing to stdout/stderr.
430 */
431
432 /* Nonzero if handling a fatal error already. */
433 int fatal_error_in_progress;
434
435 /* Non-nil means we're going down, so we better not run any hooks
436 or do other non-essential stuff. */
437 int preparing_for_armageddon;
438
439
440 static JMP_BUF run_temacs_catch;
441
442 static int run_temacs_argc;
443 static char **run_temacs_argv;
444 static char *run_temacs_args;
445 static size_t run_temacs_argv_size;
446 static size_t run_temacs_args_size;
447
448 static void shut_down_emacs (int sig, Lisp_Object stuff, int no_auto_save);
449
450 static void
451 ensure_no_quitting_from_now_on (void)
452 {
453 /* make sure no quitting from now on!! */
454 dont_check_for_quit = 1;
455 Vinhibit_quit = Qt;
456 Vquit_flag = Qnil;
457 }
458 237
459 /* Handle bus errors, illegal instruction, etc. */ 238 /* Handle bus errors, illegal instruction, etc. */
460 SIGTYPE 239 SIGTYPE
461 fatal_error_signal (int sig) 240 fatal_error_signal (int sig)
462 { 241 {
463 fatal_error_in_progress++; 242 fatal_error_code = sig;
464 preparing_for_armageddon = 1; 243 signal (sig, SIG_DFL);
465
466 ensure_no_quitting_from_now_on ();
467
468 /* Unblock the signal so that if the same signal gets sent in the 244 /* Unblock the signal so that if the same signal gets sent in the
469 code below, we avoid a deadlock. */ 245 code below, we avoid a deadlock. */
470 EMACS_UNBLOCK_SIGNAL (sig); 246 EMACS_UNBLOCK_SIGNAL (fatal_error_code);
471 247
472 /* Only try auto-saving first time through. If we crash in auto-saving, 248 /* If fatal error occurs in code below, avoid infinite recursion. */
473 don't do it again. */ 249 if (! fatal_error_in_progress)
474 if (fatal_error_in_progress == 1)
475 { 250 {
476 Fdo_auto_save (Qt, Qnil); /* do this before anything hazardous */ 251 fatal_error_in_progress = dont_check_for_quit = 1;
477 /* Do this so that the variable has the same value of 2 regardless of 252 shut_down_emacs (sig, Qnil);
478 whether we made it through auto-saving correctly. */
479 fatal_error_in_progress++;
480 }
481 else if (fatal_error_in_progress == 2)
482 stderr_out ("WARNING: Unable to auto-save your files properly.\n"
483 "Some or all may in fact have been auto-saved.\n"
484 "\n");
485
486 /* Now, reset our signal handler, so the next time, we just die.
487 Don't do this before auto-saving. */
488 signal (sig, SIG_DFL);
489
490 /* Keep in mind that there's more than one signal that we can crash
491 on. */
492 /* If fatal error occurs in code below, avoid infinite recursion. */
493 if (fatal_error_in_progress <= 2)
494 {
495 shut_down_emacs (sig, Qnil, 1);
496 stderr_out ("\nLisp backtrace follows:\n\n"); 253 stderr_out ("\nLisp backtrace follows:\n\n");
497 Fbacktrace (Qexternal_debugging_output, Qt); 254 Fbacktrace (Qexternal_debugging_output, Qt);
498 # if 0 /* This is evil, rarely useful, and causes grief in some cases. */ 255 # if 0 /* This is evil, rarely useful, and causes grief in some cases. */
499 /* Check for Sun-style stack printing via /proc */ 256 /* Check for Sun-style stack printing via /proc */
500 { 257 {
501 const char *pstack = "/usr/proc/bin/pstack"; 258 CONST char *pstack = "/usr/proc/bin/pstack";
502 if (access (pstack, X_OK) == 0) 259 if (access (pstack, X_OK) == 0)
503 { 260 {
504 char buf[100]; 261 char buf[100];
505 stderr_out ("\nC backtrace follows:\n" 262 stderr_out ("\nC backtrace follows:\n"
506 "(A real debugger may provide better information)\n\n"); 263 "(A real debugger may provide better information)\n\n");
509 } 266 }
510 } 267 }
511 # endif 268 # endif
512 } 269 }
513 /* Signal the same code; this time it will really be fatal. */ 270 /* Signal the same code; this time it will really be fatal. */
514 kill (getpid (), sig); 271 kill (getpid (), fatal_error_code);
515 SIGRETURN; 272 SIGRETURN;
516 } 273 }
517
518 #ifdef _MSC_VER
519
520 static DWORD
521 mswindows_handle_hardware_exceptions (DWORD code)
522 {
523 if (code != STATUS_ACCESS_VIOLATION && code != STATUS_ILLEGAL_INSTRUCTION
524 && code != STATUS_PRIVILEGED_INSTRUCTION
525 && code != STATUS_DATATYPE_MISALIGNMENT)
526 return EXCEPTION_CONTINUE_SEARCH;
527
528 /* I don't know if this filter is still wrapped in the outer __try, but
529 it doesn't hurt to have another one. --ben
530 And it lets us control more exactly what we really want to do in such
531 a situation. */
532 __try
533 {
534 fatal_error_in_progress++;
535 preparing_for_armageddon = 1;
536
537 ensure_no_quitting_from_now_on ();
538
539 /* Only try auto-saving first time through. If we crash in auto-saving,
540 don't do it again. */
541 if (fatal_error_in_progress == 1)
542 {
543 Fdo_auto_save (Qt, Qnil); /* do this before anything hazardous */
544 /* Do this so that the variable has the same value of 2 regardless of
545 whether we made it through auto-saving correctly. */
546 fatal_error_in_progress++;
547 }
548 else if (fatal_error_in_progress == 2)
549 stderr_out ("WARNING: Unable to auto-save your files properly.\n"
550 "Some or all may in fact have been auto-saved.\n"
551 "\n");
552
553 /* If fatal error occurs in code below, avoid infinite recursion. */
554 if (fatal_error_in_progress <= 2)
555 {
556 shut_down_emacs (-1, Qnil, 1);
557 stderr_out ("\nLisp backtrace follows:\n\n");
558 Fbacktrace (Qexternal_debugging_output, Qt);
559 }
560 }
561 /* VC++ documentation says that
562 GetExceptionCode() cannot be called inside the filter itself. */
563
564 /* __except (mswindows_handle_hardware_exceptions (GetExceptionCode ())) {}
565
566 The line above is original. Unfortunately, when an error is tripped
567 inside of the handler (e.g. during Fbacktrace()), and the handler for
568 the handler is invoked, it correctly notices that something is amiss
569 and it should just return -- but it returns EXCEPTION_CONTINUE_SEARCH,
570 which causes the debugger to be invoked debugging the handler code in
571 this function -- and WITH THE STACK UNWOUND so that you see main()
572 calling mswindows_handle_hardware_exceptions(), calling Fbacktrace(),
573 and a crash a couple of frames in -- AND NO SIGN OF THE ORIGINAL CRASH!
574
575 There's some real weirdness going on in the stack handling -- unlike
576 in Unix, where further crashes just keep adding to the stack, it seems
577 that under the structured-exception-handling, the stack can actually
578 bounce back and forth between the full stack at the location of the
579 exception and the unwound stack at the place where the __try clause was
580 established. I don't completely understand it. What I do know is that
581 returning EXCEPTION_EXECUTE_HANDLER on nested crash has the effect of
582 aborting execution of the handler and going back to the outer filter
583 function, which returns EXCEPTION_CONTINUE_SEARCH and everything is
584 hunky-dorey -- your debugger sees a crash at the right location with
585 the right stack.
586
587 I'm leaving in the trickier Unix-like code in the handler; someone who
588 understands better than me how the stack works in these handlers could
589 fix it up more. As it is, it works pretty well, so I'm not likely to
590 touch it more. --ben
591 */
592
593 __except (EXCEPTION_EXECUTE_HANDLER) {}
594
595
596 /* pretend we didn't handle this, so that the debugger is invoked and/or
597 the normal GPF box appears. */
598 return EXCEPTION_CONTINUE_SEARCH;
599 }
600
601 #endif /* _MSC_VER */
602
603 274
275
276 DOESNT_RETURN
277 fatal (CONST char *fmt, ...)
278 {
279 va_list args;
280 va_start (args, fmt);
281
282 fprintf (stderr, "\nXEmacs: ");
283 vfprintf (stderr, GETTEXT (fmt), args);
284 fprintf (stderr, "\n");
285
286 va_end (args);
287 fflush (stderr);
288 exit (1);
289 }
290
291 /* #### The following two functions should be replaced with
292 calls to emacs_doprnt_*() functions, with STREAM set to send out
293 to stdout or stderr. This is the only way to ensure that
294 I18N3 works properly (many implementations of the *printf()
295 functions, including the ones included in glibc, do not implement
296 the %###$ argument-positioning syntax). */
297
298 /* exactly equivalent to fprintf (stderr, fmt, ...) except that it calls
299 GETTEXT on the format string. */
300
301 int
302 stderr_out (CONST char *fmt, ...)
303 {
304 int retval;
305 va_list args;
306 va_start (args, fmt);
307
308 retval = vfprintf (stderr, GETTEXT (fmt), args);
309
310 va_end (args);
311 /* fflush (stderr); */
312 return retval;
313 }
314
315 /* exactly equivalent to fprintf (stdout, fmt, ...) except that it calls
316 GETTEXT on the format string. */
317
318 int
319 stdout_out (CONST char *fmt, ...)
320 {
321 int retval;
322 va_list args;
323 va_start (args, fmt);
324
325 retval = vfprintf (stdout, GETTEXT (fmt), args);
326
327 va_end (args);
328 return retval;
329 }
604 330
605 #ifdef SIGDANGER 331 #ifdef SIGDANGER
606 332
607 /* Handler for SIGDANGER. */ 333 /* Handler for SIGDANGER. */
608 SIGTYPE 334 SIGTYPE
630 356
631 for (i = argc - 1; i >= 0; i--) 357 for (i = argc - 1; i >= 0; i--)
632 { 358 {
633 if (i == 0 || i > skip_args) 359 if (i == 0 || i > skip_args)
634 { 360 {
635 #ifdef WIN32_NATIVE 361 #ifdef WINDOWSNT
636 if (i == 0) 362 if (i == 0)
637 { 363 {
638 /* Do not trust to what crt0 has stuffed into argv[0] */ 364 /* Do not trust to what crt0 has stuffed into argv[0] */
639 char full_exe_path [MAX_PATH]; 365 char full_exe_path [MAX_PATH];
640 GetModuleFileName (NULL, full_exe_path, MAX_PATH); 366 GetModuleFileName (NULL, full_exe_path, MAX_PATH);
641 result = Fcons (build_ext_string (full_exe_path, Qfile_name), 367 result = Fcons (build_ext_string (full_exe_path, FORMAT_FILENAME),
642 result); 368 result);
643 #if defined(HAVE_SHLIB) 369 #if defined(HAVE_SHLIB)
644 (void)dll_init(full_exe_path); 370 (void)dll_init(full_exe_path);
645 #endif 371 #endif
646 } 372 }
647 else 373 else
648 #endif 374 #endif
649 result = Fcons (build_ext_string (argv [i], Qfile_name), 375 result = Fcons (build_ext_string (argv [i], FORMAT_FILENAME), result);
650 result);
651 } 376 }
652 } 377 }
653 return result; 378 return result;
654 } 379 }
655 380
669 REGISTER int i; 394 REGISTER int i;
670 *argv = (char**) xmalloc ((n+1) * sizeof (char*)); 395 *argv = (char**) xmalloc ((n+1) * sizeof (char*));
671 396
672 for (i = 0, next = argv_list; i < n; i++, next = XCDR (next)) 397 for (i = 0, next = argv_list; i < n; i++, next = XCDR (next))
673 { 398 {
674 const char *temp; 399 CONST char *temp;
675 CHECK_STRING (XCAR (next)); 400 CHECK_STRING (XCAR (next));
676 401
677 TO_EXTERNAL_FORMAT (LISP_STRING, XCAR (next), 402 GET_C_STRING_EXT_DATA_ALLOCA (XCAR (next), FORMAT_OS, temp);
678 C_STRING_ALLOCA, temp,
679 Qnative);
680 (*argv) [i] = xstrdup (temp); 403 (*argv) [i] = xstrdup (temp);
681 } 404 }
682 (*argv) [n] = 0; 405 (*argv) [n] = 0;
683 *argc = i; 406 *argc = i;
684 } 407 }
726 #ifdef I18N4 449 #ifdef I18N4
727 /* #### - don't know why I18N4 on SunOS/JLE 450 /* #### - don't know why I18N4 on SunOS/JLE
728 can't deal with this. It's a potential 451 can't deal with this. It's a potential
729 bug that needs to be looked at. */ 452 bug that needs to be looked at. */
730 # undef RUN_TIME_REMAP 453 # undef RUN_TIME_REMAP
454 #endif
455
456 #if defined (MULE) && defined (MSDOS) && defined (EMX)
457 /* Setup all of files be input/output'ed with binary translation mode. */
458 asm (" .text");
459 asm ("L_setbinmode:");
460 asm (" movl $1, __fmode_bin");
461 asm (" ret");
462 asm (" .stabs \"___CTOR_LIST__\", 23, 0, 0, L_setbinmode");
731 #endif 463 #endif
732 464
733 /* Test whether the next argument in ARGV matches SSTR or a prefix of 465 /* Test whether the next argument in ARGV matches SSTR or a prefix of
734 LSTR (at least MINLEN characters). If so, then if VALPTR is non-null 466 LSTR (at least MINLEN characters). If so, then if VALPTR is non-null
735 (the argument is supposed to have a value) store in *VALPTR either 467 (the argument is supposed to have a value) store in *VALPTR either
808 int inhibit_window_system; 540 int inhibit_window_system;
809 #ifdef NeXT 541 #ifdef NeXT
810 extern int malloc_cookie; 542 extern int malloc_cookie;
811 #endif 543 #endif
812 544
813 #if (!defined (SYSTEM_MALLOC) && !defined (HAVE_LIBMCHECK) \ 545 #if !defined(SYSTEM_MALLOC) && !defined(HAVE_LIBMCHECK)
814 && !defined (DOUG_LEA_MALLOC))
815 /* Make sure that any libraries we link against haven't installed a 546 /* Make sure that any libraries we link against haven't installed a
816 hook for a gmalloc of a potentially incompatible version. */ 547 hook for a gmalloc of a potentially incompatible version. */
817 /* If we're using libmcheck, the hooks have already been initialized, */ 548 /* If we're using libmcheck, the hooks have already been initialized, */
818 /* don't touch them. -slb */ 549 /* don't touch them. -slb */
819 __malloc_hook = NULL; 550 __malloc_hook = NULL;
820 __realloc_hook = NULL; 551 __realloc_hook = NULL;
821 __free_hook = NULL; 552 __free_hook = NULL;
822 #endif /* not SYSTEM_MALLOC or HAVE_LIBMCHECK or DOUG_LEA_MALLOC */ 553 #endif /* not SYSTEM_MALLOC */
823 554
824 noninteractive = 0; 555 noninteractive = 0;
825 556
826 #ifdef NeXT 557 #ifdef NeXT
827 /* 19-Jun-1995 -baw 558 /* 19-Jun-1995 -baw
831 * work with dumping. But malloc_jumpstart() and malloc_freezedry() in 562 * work with dumping. But malloc_jumpstart() and malloc_freezedry() in
832 * unexnext.c are both completely undocumented, even in NS header files! 563 * unexnext.c are both completely undocumented, even in NS header files!
833 * But hey, it solves all NS related memory problems, so who's 564 * But hey, it solves all NS related memory problems, so who's
834 * complaining? */ 565 * complaining? */
835 if (initialized && malloc_jumpstart (malloc_cookie) != 0) 566 if (initialized && malloc_jumpstart (malloc_cookie) != 0)
836 stderr_out ("malloc jumpstart failed!\n"); 567 fprintf (stderr, "malloc jumpstart failed!\n");
837 #endif /* NeXT */ 568 #endif /* NeXT */
838 569
839 /* 570 /*
840 #if defined (GNU_MALLOC) && \ 571 #if defined (GNU_MALLOC) && \
841 defined (ERROR_CHECK_MALLOC) && \ 572 defined (ERROR_CHECK_MALLOC) && \
849 init_free_hook (); 580 init_free_hook ();
850 #endif 581 #endif
851 582
852 sort_args (argc, argv); 583 sort_args (argc, argv);
853 584
854 #if defined (WIN32_NATIVE) || defined (_SCO_DS) 585 /* Map in shared memory, if we are using that. */
586 #ifdef HAVE_SHM
587 if (argmatch (argv, argc, "-nl", "--no-shared-memory", 6, NULL, &skip_args))
588 {
589 map_in_data (0);
590 /* The shared memory was just restored, which clobbered this. */
591 skip_args = 1;
592 }
593 else
594 {
595 map_in_data (1);
596 /* The shared memory was just restored, which clobbered this. */
597 skip_args = 0;
598 }
599 #endif /* HAVE_SHM */
600
601 #if (defined (MSDOS) && defined (EMX)) || defined (WIN32) || defined (_SCO_DS)
855 environ = envp; 602 environ = envp;
856 #endif 603 #endif
857 604
858 /* Record (approximately) where the stack begins. */ 605 /* Record (approximately) where the stack begins. */
859 stack_bottom = &stack_bottom_variable; 606 stack_bottom = &stack_bottom_variable;
862 if (bss_end) 609 if (bss_end)
863 brk ((void *) bss_end); 610 brk ((void *) bss_end);
864 #endif 611 #endif
865 612
866 clearerr (stdin); 613 clearerr (stdin);
614
615 #ifdef APOLLO
616 #ifndef APOLLO_SR10
617 /* If USE_DOMAIN_ACLS environment variable exists,
618 use ACLs rather than UNIX modes. */
619 if (egetenv ("USE_DOMAIN_ACLS"))
620 default_acl (USE_DEFACL);
621 #endif
622 #endif /* APOLLO */
867 623
868 #if defined (HAVE_MMAP) && defined (REL_ALLOC) 624 #if defined (HAVE_MMAP) && defined (REL_ALLOC)
869 /* ralloc can only be used if using the GNU memory allocator. */ 625 /* ralloc can only be used if using the GNU memory allocator. */
870 init_ralloc (); 626 init_ralloc ();
871 #elif defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC) 627 #elif defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC)
882 if (!initialized) 638 if (!initialized)
883 /* Arrange to get warning messages as memory fills up. */ 639 /* Arrange to get warning messages as memory fills up. */
884 memory_warnings (0, malloc_warning); 640 memory_warnings (0, malloc_warning);
885 #endif /* not SYSTEM_MALLOC */ 641 #endif /* not SYSTEM_MALLOC */
886 642
643 #ifdef MSDOS
644 /* We do all file input/output as binary files. When we need to translate
645 newlines, we do that manually. */
646 _fmode = O_BINARY;
647 (stdin) ->_flag &= ~_IOTEXT;
648 (stdout)->_flag &= ~_IOTEXT;
649 (stderr)->_flag &= ~_IOTEXT;
650 #endif /* MSDOS */
651
887 #ifdef SET_EMACS_PRIORITY 652 #ifdef SET_EMACS_PRIORITY
888 if (emacs_priority != 0) 653 if (emacs_priority != 0)
889 nice (-emacs_priority); 654 nice (-emacs_priority);
890 setuid (getuid ()); 655 setuid (getuid ());
891 #endif /* SET_EMACS_PRIORITY */ 656 #endif /* SET_EMACS_PRIORITY */
897 #ifdef HAVE_WINDOW_SYSTEM 662 #ifdef HAVE_WINDOW_SYSTEM
898 inhibit_window_system = 0; 663 inhibit_window_system = 0;
899 #else 664 #else
900 inhibit_window_system = 1; 665 inhibit_window_system = 1;
901 #endif 666 #endif
902
903 /* Handle the -sd/--show-dump-id switch, which means show the hex dump_id and quit */
904 if (argmatch (argv, argc, "-sd", "--show-dump-id", 9, NULL, &skip_args))
905 {
906 #ifdef PDUMP
907 printf ("%08x\n", dump_id);
908 #else
909 printf ("*ERROR**\n");
910 #endif
911 exit (0);
912 }
913 667
914 /* Handle the -t switch, which specifies filename to use as terminal */ 668 /* Handle the -t switch, which specifies filename to use as terminal */
915 { 669 {
916 char *term; 670 char *term;
917 if (argmatch (argv, argc, "-t", "--terminal", 4, &term, &skip_args)) 671 if (argmatch (argv, argc, "-t", "--terminal", 4, &term, &skip_args))
929 #endif 683 #endif
930 stderr_out ("Using %s", term); 684 stderr_out ("Using %s", term);
931 inhibit_window_system = 1; /* -t => -nw */ 685 inhibit_window_system = 1; /* -t => -nw */
932 } 686 }
933 } 687 }
934
935 /* Handle the --no-dump-file/-nd switch, which means don't load the dump file (ignored when not using pdump) */
936 if (argmatch (argv, argc, "-nd", "--no-dump-file", 7, NULL, &skip_args))
937 {
938 nodumpfile = 1;
939 }
940 688
941 /* Handle -nw switch */ 689 /* Handle -nw switch */
942 if (argmatch (argv, argc, "-nw", "--no-windows", 6, NULL, &skip_args)) 690 if (argmatch (argv, argc, "-nw", "--no-windows", 6, NULL, &skip_args))
943 inhibit_window_system = 1; 691 inhibit_window_system = 1;
944 692
1100 environment when the dumped XEmacs is run. 848 environment when the dumped XEmacs is run.
1101 849
1102 We try to do things in an order that minimizes the non-obvious 850 We try to do things in an order that minimizes the non-obvious
1103 dependencies between functions. */ 851 dependencies between functions. */
1104 852
1105 /* purify_flag 1 is correct even if CANNOT_DUMP.
1106 * loadup.el will set to nil at end. */
1107
1108 purify_flag = 0;
1109 #ifdef PDUMP
1110 if (restart)
1111 initialized = 1;
1112 else if (nodumpfile) {
1113 initialized = 0;
1114 purify_flag = 1;
1115 } else {
1116 initialized = pdump_load (argv[0]);
1117 if (initialized)
1118 run_temacs_argc = -1;
1119 else
1120 purify_flag = 1;
1121 }
1122 #else
1123 if (!initialized)
1124 purify_flag = 1;
1125 #endif
1126
1127 if (!initialized) 853 if (!initialized)
1128 { 854 {
1129 /* Initialize things so that new Lisp objects 855 /* Initialize things so that new Lisp objects
1130 can be created and objects can be staticpro'd. 856 can be created and objects can be staticpro'd.
1131 Must be basically the very first thing done 857 Must be basically the very first thing done
1133 routines below create new objects. */ 859 routines below create new objects. */
1134 init_alloc_once_early (); 860 init_alloc_once_early ();
1135 861
1136 /* Initialize Qnil, Qt, Qunbound, and the 862 /* Initialize Qnil, Qt, Qunbound, and the
1137 obarray. After this, symbols can be 863 obarray. After this, symbols can be
1138 interned. This depends on init_alloc_once_early(). */ 864 interned. This depends on init_alloc_once(). */
1139 init_symbols_once_early (); 865 init_symbols_once_early ();
1140 866
1141 /* Declare the basic symbols pertaining to errors, 867 /* Declare the basic symbols pertaining to errors,
1142 So that deferror() can be called. */ 868 So that deferror() can be called. */
1143 init_errors_once_early (); 869 init_errors_once_early ();
1148 /* Now declare all the symbols and define all the Lisp primitives. 874 /* Now declare all the symbols and define all the Lisp primitives.
1149 875
1150 The *only* thing that the syms_of_*() functions are allowed to do 876 The *only* thing that the syms_of_*() functions are allowed to do
1151 is call one of the following three functions: 877 is call one of the following three functions:
1152 878
1153 INIT_LRECORD_IMPLEMENTATION()
1154 defsymbol() 879 defsymbol()
1155 defsubr() (i.e. DEFSUBR) 880 defsubr() (i.e. DEFSUBR)
1156 deferror() 881 deferror()
1157 defkeyword() 882 defkeyword()
1158 883
1159 Order does not matter in these functions. 884 Order does not matter in these functions.
1160 */ 885 */
1161 886
1162 syms_of_abbrev (); 887 syms_of_abbrev ();
1163 syms_of_alloc (); 888 syms_of_alloc ();
889 #ifdef HAVE_X_WINDOWS
890 syms_of_balloon_x ();
891 #endif
1164 syms_of_buffer (); 892 syms_of_buffer ();
1165 syms_of_bytecode (); 893 syms_of_bytecode ();
1166 syms_of_callint (); 894 syms_of_callint ();
1167 syms_of_callproc (); 895 syms_of_callproc ();
1168 syms_of_casefiddle (); 896 syms_of_casefiddle ();
1172 syms_of_cmds (); 900 syms_of_cmds ();
1173 syms_of_console (); 901 syms_of_console ();
1174 syms_of_data (); 902 syms_of_data ();
1175 #ifdef DEBUG_XEMACS 903 #ifdef DEBUG_XEMACS
1176 syms_of_debug (); 904 syms_of_debug ();
1177 syms_of_tests ();
1178 #endif /* DEBUG_XEMACS */ 905 #endif /* DEBUG_XEMACS */
1179 syms_of_device (); 906 syms_of_device ();
1180 #ifdef HAVE_DIALOGS 907 #ifdef HAVE_DIALOGS
1181 syms_of_dialog (); 908 syms_of_dialog ();
1182 #endif 909 #endif
1206 syms_of_frame (); 933 syms_of_frame ();
1207 syms_of_general (); 934 syms_of_general ();
1208 syms_of_glyphs (); 935 syms_of_glyphs ();
1209 syms_of_glyphs_eimage (); 936 syms_of_glyphs_eimage ();
1210 syms_of_glyphs_widget (); 937 syms_of_glyphs_widget ();
938 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
1211 syms_of_gui (); 939 syms_of_gui ();
1212 syms_of_gutter (); 940 #endif
1213 syms_of_indent (); 941 syms_of_indent ();
1214 syms_of_intl (); 942 syms_of_intl ();
1215 syms_of_keymap (); 943 syms_of_keymap ();
1216 syms_of_lread (); 944 syms_of_lread ();
1217 syms_of_macros (); 945 syms_of_macros ();
1240 syms_of_ralloc (); 968 syms_of_ralloc ();
1241 #endif /* HAVE_MMAP && REL_ALLOC */ 969 #endif /* HAVE_MMAP && REL_ALLOC */
1242 syms_of_rangetab (); 970 syms_of_rangetab ();
1243 syms_of_redisplay (); 971 syms_of_redisplay ();
1244 syms_of_search (); 972 syms_of_search ();
1245 syms_of_select ();
1246 syms_of_signal (); 973 syms_of_signal ();
1247 syms_of_sound (); 974 syms_of_sound ();
1248 syms_of_specifier (); 975 syms_of_specifier ();
1249 syms_of_symbols (); 976 syms_of_symbols ();
1250 syms_of_syntax (); 977 syms_of_syntax ();
1263 syms_of_device_tty (); 990 syms_of_device_tty ();
1264 syms_of_objects_tty (); 991 syms_of_objects_tty ();
1265 #endif 992 #endif
1266 993
1267 #ifdef HAVE_X_WINDOWS 994 #ifdef HAVE_X_WINDOWS
1268 syms_of_balloon_x ();
1269 syms_of_device_x (); 995 syms_of_device_x ();
1270 #ifdef HAVE_DIALOGS 996 #ifdef HAVE_DIALOGS
1271 syms_of_dialog_x (); 997 syms_of_dialog_x ();
1272 #endif 998 #endif
1273 syms_of_frame_x (); 999 syms_of_frame_x ();
1274 syms_of_glyphs_x (); 1000 syms_of_glyphs_x ();
1275 syms_of_objects_x (); 1001 syms_of_objects_x ();
1276 #ifdef HAVE_MENUBARS 1002 #ifdef HAVE_MENUBARS
1277 syms_of_menubar_x (); 1003 syms_of_menubar_x ();
1278 #endif 1004 #endif
1279 syms_of_select_x (); 1005 syms_of_xselect ();
1280 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS) 1006 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
1281 syms_of_gui_x (); 1007 syms_of_gui_x ();
1282 #endif 1008 #endif
1283 #ifdef HAVE_XIM
1284 #ifdef XIM_XLIB
1285 syms_of_input_method_xlib ();
1286 #endif
1287 #endif /* HAVE_XIM */
1288 #endif /* HAVE_X_WINDOWS */ 1009 #endif /* HAVE_X_WINDOWS */
1289 1010
1290 #ifdef HAVE_MS_WINDOWS 1011 #ifdef HAVE_MS_WINDOWS
1291 syms_of_console_mswindows (); 1012 syms_of_console_mswindows ();
1292 syms_of_device_mswindows (); 1013 syms_of_device_mswindows ();
1293 syms_of_frame_mswindows (); 1014 syms_of_frame_mswindows ();
1294 syms_of_objects_mswindows (); 1015 syms_of_objects_mswindows ();
1295 syms_of_select_mswindows (); 1016 syms_of_select_mswindows ();
1296 syms_of_glyphs_mswindows (); 1017 syms_of_glyphs_mswindows ();
1297 syms_of_gui_mswindows ();
1298 #ifdef HAVE_MENUBARS 1018 #ifdef HAVE_MENUBARS
1299 syms_of_menubar_mswindows (); 1019 syms_of_menubar_mswindows ();
1300 #endif 1020 #endif
1301 #ifdef HAVE_SCROLLBARS 1021 #ifdef HAVE_SCROLLBARS
1302 syms_of_scrollbar_mswindows (); 1022 syms_of_scrollbar_mswindows ();
1303 #endif 1023 #endif
1304 #ifdef HAVE_MSW_C_DIRED 1024 #ifdef HAVE_MSW_C_DIRED
1305 syms_of_dired_mswindows (); 1025 syms_of_dired_mswindows ();
1306 #endif 1026 #endif
1307 #ifdef WIN32_NATIVE 1027 #ifdef WINDOWSNT
1308 syms_of_ntproc (); 1028 syms_of_ntproc ();
1309 #endif 1029 #endif
1310 #endif /* HAVE_MS_WINDOWS */ 1030 #endif /* HAVE_MS_WINDOWS */
1311 1031
1312 #ifdef MULE 1032 #ifdef MULE
1313 syms_of_mule (); 1033 syms_of_mule ();
1314 syms_of_mule_ccl (); 1034 syms_of_mule_ccl ();
1315 syms_of_mule_charset (); 1035 syms_of_mule_charset ();
1316 #endif 1036 #endif
1317 #ifdef FILE_CODING 1037 #ifdef FILE_CODING
1318 syms_of_file_coding (); 1038 syms_of_mule_coding ();
1319 #endif 1039 #endif
1320 #ifdef MULE 1040 #ifdef MULE
1321 #ifdef HAVE_WNN 1041 #ifdef HAVE_WNN
1322 syms_of_mule_wnn (); 1042 syms_of_mule_wnn ();
1323 #endif 1043 #endif
1354 1074
1355 #ifdef HAVE_LDAP 1075 #ifdef HAVE_LDAP
1356 syms_of_eldap (); 1076 syms_of_eldap ();
1357 #endif 1077 #endif
1358 1078
1359 #ifdef HAVE_GPM
1360 syms_of_gpmevent ();
1361 #endif
1362
1363 #ifdef HAVE_POSTGRESQL
1364 syms_of_postgresql ();
1365 #endif
1366
1367 /* Now create the subtypes for the types that have them. 1079 /* Now create the subtypes for the types that have them.
1368 We do this before the vars_*() because more symbols 1080 We do this before the vars_*() because more symbols
1369 may get initialized here. */ 1081 may get initialized here. */
1370 1082
1371 /* Now initialize the console types and associated symbols. 1083 /* Now initialize the console types and associated symbols.
1393 #ifdef HAVE_X_WINDOWS 1105 #ifdef HAVE_X_WINDOWS
1394 console_type_create_x (); 1106 console_type_create_x ();
1395 console_type_create_device_x (); 1107 console_type_create_device_x ();
1396 console_type_create_frame_x (); 1108 console_type_create_frame_x ();
1397 console_type_create_glyphs_x (); 1109 console_type_create_glyphs_x ();
1398 console_type_create_select_x ();
1399 #ifdef HAVE_MENUBARS 1110 #ifdef HAVE_MENUBARS
1400 console_type_create_menubar_x (); 1111 console_type_create_menubar_x ();
1401 #endif 1112 #endif
1402 console_type_create_objects_x (); 1113 console_type_create_objects_x ();
1403 console_type_create_redisplay_x (); 1114 console_type_create_redisplay_x ();
1417 console_type_create_device_mswindows (); 1128 console_type_create_device_mswindows ();
1418 console_type_create_frame_mswindows (); 1129 console_type_create_frame_mswindows ();
1419 console_type_create_objects_mswindows (); 1130 console_type_create_objects_mswindows ();
1420 console_type_create_redisplay_mswindows (); 1131 console_type_create_redisplay_mswindows ();
1421 console_type_create_glyphs_mswindows (); 1132 console_type_create_glyphs_mswindows ();
1422 console_type_create_select_mswindows ();
1423 # ifdef HAVE_SCROLLBARS 1133 # ifdef HAVE_SCROLLBARS
1424 console_type_create_scrollbar_mswindows (); 1134 console_type_create_scrollbar_mswindows ();
1425 # endif 1135 # endif
1426 #ifdef HAVE_MENUBARS 1136 #ifdef HAVE_MENUBARS
1427 console_type_create_menubar_mswindows (); 1137 console_type_create_menubar_mswindows ();
1445 before the any calls to the latter macro. */ 1155 before the any calls to the latter macro. */
1446 1156
1447 specifier_type_create (); 1157 specifier_type_create ();
1448 1158
1449 specifier_type_create_image (); 1159 specifier_type_create_image ();
1450 specifier_type_create_gutter ();
1451 specifier_type_create_objects (); 1160 specifier_type_create_objects ();
1452 #ifdef HAVE_TOOLBARS 1161 #ifdef HAVE_TOOLBARS
1453 specifier_type_create_toolbar (); 1162 specifier_type_create_toolbar ();
1454 #endif 1163 #endif
1455 1164
1481 called before the any calls to the other macros. */ 1190 called before the any calls to the other macros. */
1482 1191
1483 image_instantiator_format_create (); 1192 image_instantiator_format_create ();
1484 image_instantiator_format_create_glyphs_eimage (); 1193 image_instantiator_format_create_glyphs_eimage ();
1485 image_instantiator_format_create_glyphs_widget (); 1194 image_instantiator_format_create_glyphs_widget ();
1486 #ifdef HAVE_TTY
1487 image_instantiator_format_create_glyphs_tty ();
1488 #endif
1489 #ifdef HAVE_X_WINDOWS 1195 #ifdef HAVE_X_WINDOWS
1490 image_instantiator_format_create_glyphs_x (); 1196 image_instantiator_format_create_glyphs_x ();
1491 #endif /* HAVE_X_WINDOWS */ 1197 #endif /* HAVE_X_WINDOWS */
1492 #ifdef HAVE_MS_WINDOWS 1198 #ifdef HAVE_MS_WINDOWS
1493 image_instantiator_format_create_glyphs_mswindows (); 1199 image_instantiator_format_create_glyphs_mswindows ();
1501 1207
1502 */ 1208 */
1503 1209
1504 lstream_type_create (); 1210 lstream_type_create ();
1505 #ifdef FILE_CODING 1211 #ifdef FILE_CODING
1506 lstream_type_create_file_coding (); 1212 lstream_type_create_mule_coding ();
1507 #endif 1213 #endif
1508 #if defined (HAVE_MS_WINDOWS) && !defined(HAVE_MSG_SELECT) 1214 #if defined (HAVE_MS_WINDOWS) && !defined(HAVE_MSG_SELECT)
1509 lstream_type_create_mswindows_selectable (); 1215 lstream_type_create_mswindows_selectable ();
1510 #endif 1216 #endif
1511 1217
1532 Dynarr_*() 1238 Dynarr_*()
1533 Blocktype_*() 1239 Blocktype_*()
1534 staticpro() 1240 staticpro()
1535 Fprovide(symbol) 1241 Fprovide(symbol)
1536 intern() 1242 intern()
1537 Fput() 1243 pure_put()
1538 xmalloc() 1244 xmalloc()
1539 defsymbol(), if it's absolutely necessary and you're sure that 1245 defsymbol(), if it's absolutely necessary and you're sure that
1540 the symbol isn't referenced anywhere else in the initialization 1246 the symbol isn't referenced anywhere else in the initialization
1541 code 1247 code
1542 Fset() on a symbol that is unbound 1248 Fset() on a symbol that is unbound
1543 assigning a symbol or constant value to a variable 1249 assigning a symbol or constant value to a variable
1544 using a global variable that has been initialized 1250 using a global variable that has been initialized
1545 earlier on in the same function 1251 earlier on in the same function
1546 1252
1547 Any of the object-creating functions in alloc.c: e.g. 1253 Any of the object-creating functions on alloc.c: e.g.
1548 1254
1549 make_pure_*() 1255 make_pure_*()
1256 Fpurecopy()
1550 make_string() 1257 make_string()
1551 build_string() 1258 build_string()
1552 make_vector() 1259 make_vector()
1553 make_int() 1260 make_int()
1554 make_extent() 1261 make_extent()
1555 alloc_lcrecord() 1262 alloc_lcrecord()
1556 Fcons() 1263 Fcons()
1557 listN() 1264 listN()
1558 make_opaque_ptr() 1265 make_opaque_ptr()
1266 make_opaque_long()
1559 1267
1560 perhaps a few others. 1268 perhaps a few others.
1561 */ 1269 */
1562 1270
1563 /* Now allow Fprovide() statements to be made. */ 1271 /* Now allow Fprovide() statements to be made. */
1564 init_provide_once (); 1272 init_provide_once ();
1565 1273
1566 /* Do that before any specifier creation (esp. vars_of_glyphs()) */
1567 vars_of_specifier ();
1568
1569 vars_of_abbrev (); 1274 vars_of_abbrev ();
1570 vars_of_alloc (); 1275 vars_of_alloc ();
1276 #ifdef HAVE_X_WINDOWS
1277 vars_of_balloon_x ();
1278 #endif
1571 vars_of_buffer (); 1279 vars_of_buffer ();
1572 vars_of_bytecode (); 1280 vars_of_bytecode ();
1573 vars_of_callint (); 1281 vars_of_callint ();
1574 vars_of_callproc (); 1282 vars_of_callproc ();
1575 vars_of_chartab ();
1576 vars_of_cmdloop (); 1283 vars_of_cmdloop ();
1577 vars_of_cmds (); 1284 vars_of_cmds ();
1578 vars_of_console (); 1285 vars_of_console ();
1579 vars_of_data (); 1286 vars_of_data ();
1580 #ifdef DEBUG_XEMACS 1287 #ifdef DEBUG_XEMACS
1581 vars_of_debug (); 1288 vars_of_debug ();
1582 vars_of_tests ();
1583 #endif 1289 #endif
1584 vars_of_console_stream (); 1290 vars_of_console_stream ();
1585 vars_of_device (); 1291 vars_of_device ();
1586 #ifdef HAVE_DIALOGS 1292 #ifdef HAVE_DIALOGS
1587 vars_of_dialog (); 1293 vars_of_dialog ();
1615 vars_of_font_lock (); 1321 vars_of_font_lock ();
1616 vars_of_frame (); 1322 vars_of_frame ();
1617 vars_of_glyphs (); 1323 vars_of_glyphs ();
1618 vars_of_glyphs_eimage (); 1324 vars_of_glyphs_eimage ();
1619 vars_of_glyphs_widget (); 1325 vars_of_glyphs_widget ();
1326 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
1620 vars_of_gui (); 1327 vars_of_gui ();
1621 vars_of_gutter (); 1328 #endif
1622 vars_of_indent (); 1329 vars_of_indent ();
1623 vars_of_insdel (); 1330 vars_of_insdel ();
1624 vars_of_intl (); 1331 vars_of_intl ();
1625 #ifdef HAVE_XIM 1332 #ifdef HAVE_XIM
1626 #ifdef XIM_MOTIF 1333 #ifdef XIM_MOTIF
1642 #endif 1349 #endif
1643 vars_of_minibuf (); 1350 vars_of_minibuf ();
1644 #ifdef HAVE_SHLIB 1351 #ifdef HAVE_SHLIB
1645 vars_of_module (); 1352 vars_of_module ();
1646 #endif 1353 #endif
1647 #ifdef WIN32_NATIVE
1648 vars_of_nt ();
1649 vars_of_ntproc ();
1650 #endif
1651 vars_of_objects (); 1354 vars_of_objects ();
1652 vars_of_print (); 1355 vars_of_print ();
1653 1356
1654 #ifndef NO_SUBPROCESSES 1357 #ifndef NO_SUBPROCESSES
1655 vars_of_process (); 1358 vars_of_process ();
1668 vars_of_redisplay (); 1371 vars_of_redisplay ();
1669 #ifdef HAVE_SCROLLBARS 1372 #ifdef HAVE_SCROLLBARS
1670 vars_of_scrollbar (); 1373 vars_of_scrollbar ();
1671 #endif 1374 #endif
1672 vars_of_search (); 1375 vars_of_search ();
1673 vars_of_select ();
1674 vars_of_sound (); 1376 vars_of_sound ();
1377 vars_of_specifier ();
1675 vars_of_symbols (); 1378 vars_of_symbols ();
1676 vars_of_syntax (); 1379 vars_of_syntax ();
1677 #ifdef HAVE_TOOLBARS 1380 #ifdef HAVE_TOOLBARS
1678 vars_of_toolbar (); 1381 vars_of_toolbar ();
1679 #endif 1382 #endif
1685 vars_of_frame_tty (); 1388 vars_of_frame_tty ();
1686 vars_of_objects_tty (); 1389 vars_of_objects_tty ();
1687 #endif 1390 #endif
1688 1391
1689 #ifdef HAVE_X_WINDOWS 1392 #ifdef HAVE_X_WINDOWS
1690 vars_of_balloon_x ();
1691 vars_of_device_x (); 1393 vars_of_device_x ();
1692 #ifdef HAVE_DIALOGS 1394 #ifdef HAVE_DIALOGS
1693 vars_of_dialog_x (); 1395 vars_of_dialog_x ();
1694 #endif 1396 #endif
1695 vars_of_frame_x (); 1397 vars_of_frame_x ();
1696 vars_of_glyphs_x (); 1398 vars_of_glyphs_x ();
1697 #ifdef HAVE_MENUBARS 1399 #ifdef HAVE_MENUBARS
1698 vars_of_menubar_x (); 1400 vars_of_menubar_x ();
1699 #endif 1401 #endif
1700 vars_of_objects_x (); 1402 vars_of_objects_x ();
1701 vars_of_select_x (); 1403 vars_of_xselect ();
1702 #ifdef HAVE_SCROLLBARS 1404 #ifdef HAVE_SCROLLBARS
1703 vars_of_scrollbar_x (); 1405 vars_of_scrollbar_x ();
1704 #endif 1406 #endif
1705 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS) 1407 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
1706 vars_of_gui_x (); 1408 vars_of_gui_x ();
1707 #endif 1409 #endif
1708 #endif /* HAVE_X_WINDOWS */ 1410 #endif
1709 1411
1710 #ifdef HAVE_MS_WINDOWS 1412 #ifdef HAVE_MS_WINDOWS
1711 vars_of_device_mswindows (); 1413 vars_of_device_mswindows ();
1712 vars_of_console_mswindows (); 1414 vars_of_console_mswindows ();
1713 vars_of_frame_mswindows (); 1415 vars_of_frame_mswindows ();
1728 #endif 1430 #endif
1729 #endif /* HAVE_MS_WINDOWS */ 1431 #endif /* HAVE_MS_WINDOWS */
1730 1432
1731 #ifdef MULE 1433 #ifdef MULE
1732 vars_of_mule (); 1434 vars_of_mule ();
1733 vars_of_mule_ccl ();
1734 vars_of_mule_charset (); 1435 vars_of_mule_charset ();
1735 #endif 1436 #endif
1736 #ifdef FILE_CODING 1437 #ifdef FILE_CODING
1737 vars_of_file_coding (); 1438 vars_of_mule_coding ();
1738 #endif 1439 #endif
1739 #ifdef MULE 1440 #ifdef MULE
1740 #ifdef HAVE_WNN 1441 #ifdef HAVE_WNN
1741 vars_of_mule_wnn (); 1442 vars_of_mule_wnn ();
1742 #endif 1443 #endif
1753 vars_of_sunpro (); 1454 vars_of_sunpro ();
1754 #endif 1455 #endif
1755 1456
1756 #ifdef HAVE_LDAP 1457 #ifdef HAVE_LDAP
1757 vars_of_eldap (); 1458 vars_of_eldap ();
1758 #endif
1759
1760 #ifdef HAVE_POSTGRESQL
1761 vars_of_postgresql();
1762 #endif
1763
1764 #ifdef HAVE_GPM
1765 vars_of_gpmevent ();
1766 #endif 1459 #endif
1767 1460
1768 /* Now initialize any specifier variables. We do this later 1461 /* Now initialize any specifier variables. We do this later
1769 because it has some dependence on the vars initialized 1462 because it has some dependence on the vars initialized
1770 above. 1463 above.
1778 set_specifier_fallback() 1471 set_specifier_fallback()
1779 set_specifier_caching() 1472 set_specifier_caching()
1780 */ 1473 */
1781 1474
1782 specifier_vars_of_glyphs (); 1475 specifier_vars_of_glyphs ();
1783 specifier_vars_of_gutter ();
1784 #ifdef HAVE_MENUBARS 1476 #ifdef HAVE_MENUBARS
1785 specifier_vars_of_menubar (); 1477 specifier_vars_of_menubar ();
1786 #endif 1478 #endif
1787 specifier_vars_of_redisplay (); 1479 specifier_vars_of_redisplay ();
1788 #ifdef HAVE_SCROLLBARS 1480 #ifdef HAVE_SCROLLBARS
1812 #ifdef MULE 1504 #ifdef MULE
1813 /* These two depend on hash tables and various variables declared 1505 /* These two depend on hash tables and various variables declared
1814 earlier. The second may also depend on the first. */ 1506 earlier. The second may also depend on the first. */
1815 complex_vars_of_mule_charset (); 1507 complex_vars_of_mule_charset ();
1816 #endif 1508 #endif
1817 #ifdef FILE_CODING 1509 #if defined(FILE_CODING)
1818 complex_vars_of_file_coding (); 1510 complex_vars_of_mule_coding ();
1819 #endif 1511 #endif
1820 1512
1821 /* This calls allocate_glyph(), which creates specifiers 1513 /* This calls allocate_glyph(), which creates specifiers
1822 and also relies on a variable (Vthe_nothing_vector) initialized 1514 and also relies on a variable (Vthe_nothing_vector) initialized
1823 above. It also calls make_ext_string(), which under Mule 1515 above. It also calls make_ext_string(), which under Mule
1894 extern int always_gc; 1586 extern int always_gc;
1895 if (always_gc) /* purification debugging hack */ 1587 if (always_gc) /* purification debugging hack */
1896 garbage_collect_1 (); 1588 garbage_collect_1 ();
1897 } 1589 }
1898 #endif 1590 #endif
1899 #ifdef PDUMP
1900 } else if (!restart) {
1901 reinit_alloc_once_early ();
1902 reinit_symbols_once_early ();
1903 reinit_opaque_once_early ();
1904
1905 reinit_console_type_create_stream ();
1906 #ifdef HAVE_TTY
1907 reinit_console_type_create_tty ();
1908 #endif
1909 #ifdef HAVE_X_WINDOWS
1910 reinit_console_type_create_x ();
1911 reinit_console_type_create_device_x ();
1912 #endif
1913 #ifdef HAVE_MS_WINDOWS
1914 reinit_console_type_create_mswindows ();
1915 #endif
1916
1917 reinit_specifier_type_create ();
1918 reinit_specifier_type_create_image ();
1919 reinit_specifier_type_create_gutter ();
1920 reinit_specifier_type_create_objects ();
1921 #ifdef HAVE_TOOLBARS
1922 reinit_specifier_type_create_toolbar ();
1923 #endif
1924
1925 structure_type_create ();
1926
1927 structure_type_create_chartab ();
1928 structure_type_create_faces ();
1929 structure_type_create_rangetab ();
1930 structure_type_create_hash_table ();
1931
1932 lstream_type_create ();
1933 #ifdef FILE_CODING
1934 lstream_type_create_file_coding ();
1935 #endif
1936 #if defined (HAVE_MS_WINDOWS) && !defined(HAVE_MSG_SELECT)
1937 lstream_type_create_mswindows_selectable ();
1938 #endif
1939 #ifdef HAVE_UNIX_PROCESSES
1940 process_type_create_unix ();
1941 #endif
1942 #ifdef HAVE_WIN32_PROCESSES
1943 process_type_create_nt ();
1944 #endif
1945
1946 reinit_vars_of_buffer ();
1947 reinit_vars_of_console ();
1948 #ifdef DEBUG_XEMACS
1949 reinit_vars_of_debug ();
1950 #endif
1951 reinit_vars_of_device ();
1952 reinit_vars_of_eval ();
1953 #ifdef HAVE_X_WINDOWS
1954 reinit_vars_of_event_Xt ();
1955 #endif
1956 #if defined(HAVE_TTY) && (defined (DEBUG_TTY_EVENT_STREAM) || !defined (HAVE_X_WINDOWS))
1957 reinit_vars_of_event_tty ();
1958 #endif
1959 #ifdef HAVE_MS_WINDOWS
1960 reinit_vars_of_event_mswindows ();
1961 #endif
1962 reinit_vars_of_event_stream ();
1963 reinit_vars_of_events ();
1964 reinit_vars_of_extents ();
1965 reinit_vars_of_fileio ();
1966 reinit_vars_of_font_lock ();
1967 reinit_vars_of_glyphs ();
1968 reinit_vars_of_glyphs_widget ();
1969 reinit_vars_of_insdel ();
1970 reinit_vars_of_lread ();
1971 reinit_vars_of_lstream ();
1972 reinit_vars_of_minibuf ();
1973 #ifdef HAVE_SHLIB
1974 reinit_vars_of_module ();
1975 #endif
1976 reinit_vars_of_objects ();
1977 reinit_vars_of_print ();
1978 reinit_vars_of_search ();
1979 reinit_vars_of_undo ();
1980 reinit_vars_of_window ();
1981
1982 #ifdef HAVE_MS_WINDOWS
1983 reinit_vars_of_frame_mswindows ();
1984 #endif
1985
1986 #ifdef HAVE_X_WINDOWS
1987 reinit_vars_of_device_x ();
1988 #ifdef HAVE_SCROLLBARS
1989 reinit_vars_of_scrollbar_x ();
1990 #endif
1991 #ifdef HAVE_MENUBARS
1992 reinit_vars_of_menubar_x ();
1993 #endif
1994 reinit_vars_of_select_x ();
1995 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
1996 reinit_vars_of_gui_x ();
1997 #endif
1998 #endif /* HAVE_X_WINDOWS */
1999
2000 #if defined(MULE) && defined(HAVE_WNN)
2001 reinit_vars_of_mule_wnn ();
2002 #endif
2003
2004 reinit_complex_vars_of_buffer ();
2005 reinit_complex_vars_of_console ();
2006 reinit_complex_vars_of_minibuf ();
2007 #endif /* PDUMP */
2008 } 1591 }
2009
2010 1592
2011 /* CONGRATULATIONS!!! We have successfully initialized the Lisp 1593 /* CONGRATULATIONS!!! We have successfully initialized the Lisp
2012 engine. */ 1594 engine. */
2013 1595
2014 if (initialized) 1596 if (initialized)
2030 to be done both at dump time and at run time. */ 1612 to be done both at dump time and at run time. */
2031 1613
2032 init_initial_directory(); /* get the directory to use for the 1614 init_initial_directory(); /* get the directory to use for the
2033 "*scratch*" buffer, etc. */ 1615 "*scratch*" buffer, etc. */
2034 1616
2035 #ifdef WIN32_NATIVE 1617 #ifdef WINDOWSNT
2036 /* 1618 /*
2037 * For Win32, call init_environment() now, so that environment/registry 1619 * For Win32, call init_environment() now, so that environment/registry
2038 * variables will be properly entered into Vprocess_environment. 1620 * variables will be properly entered into Vprocess_environment.
2039 */ 1621 */
2040 init_environment(); 1622 init_environment();
2045 (exec-directory and so on), and stuff 1627 (exec-directory and so on), and stuff
2046 related to subprocesses. This should be 1628 related to subprocesses. This should be
2047 first because many of the functions below 1629 first because many of the functions below
2048 call egetenv() to get environment variables. */ 1630 call egetenv() to get environment variables. */
2049 init_lread (); /* Set up the Lisp reader. */ 1631 init_lread (); /* Set up the Lisp reader. */
1632 #ifdef MSDOS
1633 /* Call early 'cause init_environment needs it. */
1634 init_dosfns ();
1635 /* Set defaults for several environment variables. */
1636 init_environment (argc, argv, skip_args);
1637 #endif
2050 init_cmdargs (argc, argv, skip_args); /* Create list Vcommand_line_args */ 1638 init_cmdargs (argc, argv, skip_args); /* Create list Vcommand_line_args */
2051 init_buffer (); /* Set default directory of *scratch* buffer */ 1639 init_buffer (); /* Set default directory of *scratch* buffer */
2052 1640
2053 #ifdef WIN32_NATIVE 1641 #ifdef WINDOWSNT
2054 init_ntproc(); 1642 init_ntproc();
2055 #endif 1643 #endif
2056 1644
2057 init_redisplay (); /* Determine terminal type. 1645 init_redisplay (); /* Determine terminal type.
2058 init_sys_modes uses results */ 1646 init_sys_modes uses results */
2059 init_frame ();
2060 init_event_stream (); /* Set up so we can get user input. */ 1647 init_event_stream (); /* Set up so we can get user input. */
2061 init_macros (); /* set up so we can run macros. */ 1648 init_macros (); /* set up so we can run macros. */
2062 init_editfns (); /* Determine the name of the user we're running as */ 1649 init_editfns (); /* Determine the name of the user we're running as */
2063 init_xemacs_process (); /* set up for calling subprocesses */ 1650 init_xemacs_process (); /* set up for calling subprocesses */
2064 #ifdef SUNPRO 1651 #ifdef SUNPRO
2068 init_hpplay (); 1655 init_hpplay ();
2069 #endif 1656 #endif
2070 #ifdef HAVE_TTY 1657 #ifdef HAVE_TTY
2071 init_device_tty (); 1658 init_device_tty ();
2072 #endif 1659 #endif
2073 init_console_stream (restart); /* Create the first console */ 1660 init_console_stream (); /* Create the first console */
2074 1661
2075 /* try to get the actual pathname of the exec file we are running */ 1662 /* try to get the actual pathname of the exec file we are running */
2076 if (!restart) 1663 if (!restart)
2077 { 1664 {
2078 Vinvocation_name = Fcar (Vcommand_line_args); 1665 Vinvocation_name = Fcar (Vcommand_line_args);
2104 1691
2105 Vinvocation_name = Ffile_name_nondirectory (Vinvocation_directory); 1692 Vinvocation_name = Ffile_name_nondirectory (Vinvocation_directory);
2106 Vinvocation_directory = Ffile_name_directory (Vinvocation_directory); 1693 Vinvocation_directory = Ffile_name_directory (Vinvocation_directory);
2107 } 1694 }
2108 1695
2109 #if defined(HAVE_SHLIB) && !defined(WIN32_NATIVE) 1696 #if defined(HAVE_SHLIB) && !defined(WINDOWSNT)
2110 /* This is Unix only. MS Windows NT has a library call that does 1697 /* This is Unix only. MS Windows NT has a library call that does
2111 The Right Thing on that system. Rumor has it, this must be 1698 The Right Thing on that system. Rumor has it, this must be
2112 called for GNU dld in temacs and xemacs. */ 1699 called for GNU dld in temacs and xemacs. */
2113 { 1700 {
2114 char *buf = (char *)alloca (XSTRING_LENGTH (Vinvocation_directory) 1701 char *buf = (char *)alloca (XSTRING_LENGTH (Vinvocation_directory)
2162 1749
2163 /* First, here's a table of all the standard options. */ 1750 /* First, here's a table of all the standard options. */
2164 1751
2165 struct standard_args 1752 struct standard_args
2166 { 1753 {
2167 const char *name; 1754 CONST char * CONST name;
2168 const char *longname; 1755 CONST char * CONST longname;
2169 int priority; 1756 int priority;
2170 int nargs; 1757 int nargs;
2171 }; 1758 };
2172 1759
2173 static const struct standard_args standard_args[] = 1760 static struct standard_args standard_args[] =
2174 { 1761 {
2175 /* Handled by main_1 above: */ 1762 /* Handled by main_1 above: */
2176 { "-sd", "--show-dump-id", 105, 0 }, 1763 { "-nl", "--no-shared-memory", 100, 0 },
2177 { "-t", "--terminal", 100, 1 }, 1764 { "-t", "--terminal", 95, 1 },
2178 { "-nd", "--no-dump-file", 95, 0 },
2179 { "-nw", "--no-windows", 90, 0 }, 1765 { "-nw", "--no-windows", 90, 0 },
2180 { "-batch", "--batch", 85, 0 }, 1766 { "-batch", "--batch", 85, 0 },
2181 { "-debug-paths", "--debug-paths", 82, 0 }, 1767 { "-debug-paths", "--debug-paths", 82, 0 },
2182 { "-help", "--help", 80, 0 }, 1768 { "-help", "--help", 80, 0 },
2183 { "-version", "--version", 75, 0 }, 1769 { "-version", "--version", 75, 0 },
2368 xfree (new_argv); 1954 xfree (new_argv);
2369 xfree (options); 1955 xfree (options);
2370 xfree (priority); 1956 xfree (priority);
2371 } 1957 }
2372 1958
1959 static JMP_BUF run_temacs_catch;
1960
1961 static int run_temacs_argc;
1962 static char **run_temacs_argv;
1963 static char *run_temacs_args;
1964 static size_t run_temacs_argv_size;
1965 static size_t run_temacs_args_size;
1966
2373 DEFUN ("running-temacs-p", Frunning_temacs_p, 0, 0, 0, /* 1967 DEFUN ("running-temacs-p", Frunning_temacs_p, 0, 0, 0, /*
2374 True if running temacs. This means we are in the dumping stage. 1968 True if running temacs. This means we are in the dumping stage.
2375 This is false during normal execution of the `xemacs' program, and 1969 This is false during normal execution of the `xemacs' program, and
2376 becomes false once `run-emacs-from-temacs' is run. 1970 becomes false once `run-emacs-from-temacs' is run.
2377 */ 1971 */
2395 Martin thinks this function is most useful when using debugging 1989 Martin thinks this function is most useful when using debugging
2396 tools like Purify or tcov that get confused by XEmacs' dumping. */ 1990 tools like Purify or tcov that get confused by XEmacs' dumping. */
2397 (int nargs, Lisp_Object *args)) 1991 (int nargs, Lisp_Object *args))
2398 { 1992 {
2399 int ac; 1993 int ac;
2400 const Extbyte *wampum; 1994 CONST Extbyte *wampum;
2401 int namesize; 1995 int namesize;
2402 int total_len; 1996 int total_len;
2403 Lisp_Object orig_invoc_name = Fcar (Vcommand_line_args); 1997 Lisp_Object orig_invoc_name = Fcar (Vcommand_line_args);
2404 const Extbyte **wampum_all = alloca_array (const Extbyte *, nargs); 1998 CONST Extbyte **wampum_all = alloca_array (CONST Extbyte *, nargs);
2405 int *wampum_all_len = alloca_array (int, nargs); 1999 int *wampum_all_len = alloca_array (int, nargs);
2406 2000
2407 assert (!gc_in_progress); 2001 assert (!gc_in_progress);
2408 2002
2409 if (run_temacs_argc < 0) 2003 if (run_temacs_argc < 0)
2410 error ("I've lost my temacs-hood."); 2004 error ("I've lost my temacs-hood.");
2411 2005
2412 /* Need to convert the orig_invoc_name and all of the arguments 2006 /* Need to convert the orig_invoc_name and all of the arguments
2413 to external format. */ 2007 to external format. */
2414 2008
2415 TO_EXTERNAL_FORMAT (LISP_STRING, orig_invoc_name, 2009 GET_STRING_EXT_DATA_ALLOCA (orig_invoc_name, FORMAT_OS, wampum,
2416 ALLOCA, (wampum, namesize), 2010 namesize);
2417 Qnative);
2418 namesize++; 2011 namesize++;
2419 2012
2420 for (ac = 0, total_len = namesize; ac < nargs; ac++) 2013 for (ac = 0, total_len = namesize; ac < nargs; ac++)
2421 { 2014 {
2422 CHECK_STRING (args[ac]); 2015 CHECK_STRING (args[ac]);
2423 TO_EXTERNAL_FORMAT (LISP_STRING, args[ac], 2016 GET_STRING_EXT_DATA_ALLOCA (args[ac], FORMAT_OS,
2424 ALLOCA, (wampum_all[ac], wampum_all_len[ac]), 2017 wampum_all[ac],
2425 Qnative); 2018 wampum_all_len[ac]);
2426 wampum_all_len[ac]++; 2019 wampum_all_len[ac]++;
2427 total_len += wampum_all_len[ac]; 2020 total_len += wampum_all_len[ac];
2428 } 2021 }
2429 DO_REALLOC (run_temacs_args, run_temacs_args_size, total_len, char); 2022 DO_REALLOC (run_temacs_args, run_temacs_args_size, total_len, char);
2430 DO_REALLOC (run_temacs_argv, run_temacs_argv_size, nargs+2, char *); 2023 DO_REALLOC (run_temacs_argv, run_temacs_argv_size, nargs+2, char *);
2442 catchlist = NULL; /* Important! Otherwise free_cons() calls in 2035 catchlist = NULL; /* Important! Otherwise free_cons() calls in
2443 condition_case_unwind() may lead to GC death. */ 2036 condition_case_unwind() may lead to GC death. */
2444 unbind_to (0, Qnil); /* this closes loadup.el */ 2037 unbind_to (0, Qnil); /* this closes loadup.el */
2445 purify_flag = 0; 2038 purify_flag = 0;
2446 run_temacs_argc = nargs + 1; 2039 run_temacs_argc = nargs + 1;
2447 #if defined (HEAP_IN_DATA) && !defined(PDUMP)
2448 report_sheap_usage (0);
2449 #endif
2450 LONGJMP (run_temacs_catch, 1); 2040 LONGJMP (run_temacs_catch, 1);
2451 return Qnil; /* not reached; warning suppression */ 2041 return Qnil; /* not reached; warning suppression */
2452 } 2042 }
2453 2043
2454 /* ARGSUSED */ 2044 /* ARGSUSED */
2455 int 2045 int
2456 main (int argc, char **argv, char **envp) 2046 main (int argc, char **argv, char **envp)
2457 { 2047 {
2458
2459 #ifdef _MSC_VER
2460 /* Under VC++, access violations and the like are not sent through
2461 the standard signal() mechanism. Rather, they need to be handled
2462 using the Microsoft "structured exception handling" mechanism,
2463 which vaguely resembles the C++ mechanisms. */
2464 __try
2465 {
2466 #endif
2467
2468 int volatile vol_argc = argc; 2048 int volatile vol_argc = argc;
2469 char ** volatile vol_argv = argv; 2049 char ** volatile vol_argv = argv;
2470 char ** volatile vol_envp = envp; 2050 char ** volatile vol_envp = envp;
2471 /* This is hairy. We need to compute where the XEmacs binary was invoked 2051 /* This is hairy. We need to compute where the XEmacs binary was invoked
2472 from because temacs initialization requires it to find the lisp 2052 from because temacs initialization requires it to find the lisp
2538 is bracketed with both a system specific preprocessor test 2118 is bracketed with both a system specific preprocessor test
2539 and a runtime "do you have this problem" test 2119 and a runtime "do you have this problem" test
2540 2120
2541 06/20/96 robertl@dgii.com */ 2121 06/20/96 robertl@dgii.com */
2542 { 2122 {
2543 extern char **_environ; 2123 extern char *_environ;
2544 if ((unsigned) environ == 0) 2124 if ((unsigned) environ == 0)
2545 environ=_environ; 2125 environ=_environ;
2546 } 2126 }
2547 #endif /* _SCO_DS */ 2127 #endif /* _SCO_DS */
2548 vol_envp = environ; 2128 vol_envp = environ;
2558 if (initialized && (malloc_state_ptr != NULL)) 2138 if (initialized && (malloc_state_ptr != NULL))
2559 { 2139 {
2560 int rc = malloc_set_state (malloc_state_ptr); 2140 int rc = malloc_set_state (malloc_state_ptr);
2561 if (rc != 0) 2141 if (rc != 0)
2562 { 2142 {
2563 stderr_out ("malloc_set_state failed, rc = %d\n", rc); 2143 fprintf (stderr, "malloc_set_state failed, rc = %d\n", rc);
2564 abort (); 2144 abort ();
2565 } 2145 }
2566 #if 0 2146 #if 0
2567 free (malloc_state_ptr); 2147 free (malloc_state_ptr);
2568 #endif 2148 #endif
2580 #endif /* DOUG_LEA_MALLOC */ 2160 #endif /* DOUG_LEA_MALLOC */
2581 2161
2582 run_temacs_argc = -1; 2162 run_temacs_argc = -1;
2583 2163
2584 main_1 (vol_argc, vol_argv, vol_envp, restarted); 2164 main_1 (vol_argc, vol_argv, vol_envp, restarted);
2585
2586 #ifdef _MSC_VER
2587 }
2588 /* VC++ documentation says that
2589 GetExceptionCode() cannot be called inside the filter itself. */
2590 __except (mswindows_handle_hardware_exceptions (GetExceptionCode ())) {}
2591 #endif
2592
2593 return 0; /* unreached */ 2165 return 0; /* unreached */
2594 } 2166 }
2595 2167
2596 2168
2597 /* Dumping apparently isn't supported by versions of GCC >= 2.8. */ 2169 /* Dumping apparently isn't supported by versions of GCC >= 2.8. */
2602 static void 2174 static void
2603 voodoo_free_hook (void *mem) 2175 voodoo_free_hook (void *mem)
2604 { 2176 {
2605 /* Disable all calls to free() when XEmacs is exiting and it doesn't */ 2177 /* Disable all calls to free() when XEmacs is exiting and it doesn't */
2606 /* matter. */ 2178 /* matter. */
2607 __free_hook = 2179 __free_hook = voodoo_free_hook;
2608 #ifdef __GNUC__ /* prototype of __free_hook varies with glibc version */ 2180 }
2609 (__typeof__ (__free_hook)) 2181 #endif
2610 #endif
2611 voodoo_free_hook;
2612 }
2613 #endif /* GNU_MALLOC */
2614 2182
2615 DEFUN ("kill-emacs", Fkill_emacs, 0, 1, "P", /* 2183 DEFUN ("kill-emacs", Fkill_emacs, 0, 1, "P", /*
2616 Exit the XEmacs job and kill it. Ask for confirmation, without argument. 2184 Exit the XEmacs job and kill it. Ask for confirmation, without argument.
2617 If ARG is an integer, return ARG as the exit program code. 2185 If ARG is an integer, return ARG as the exit program code.
2618 If ARG is a string, stuff it as keyboard input. 2186 If ARG is a string, stuff it as keyboard input.
2632 arg = Qt; 2200 arg = Qt;
2633 2201
2634 if (!preparing_for_armageddon && !noninteractive) 2202 if (!preparing_for_armageddon && !noninteractive)
2635 run_hook (Qkill_emacs_hook); 2203 run_hook (Qkill_emacs_hook);
2636 2204
2637 ensure_no_quitting_from_now_on (); 2205 /* make sure no quitting from now on!! */
2206 dont_check_for_quit = 1;
2207 Vinhibit_quit = Qt;
2638 2208
2639 if (!preparing_for_armageddon) 2209 if (!preparing_for_armageddon)
2640 { 2210 {
2641 Lisp_Object concons, nextcons; 2211 Lisp_Object concons, nextcons;
2642 2212
2646 and even for those that do, it might be cleaner this way. 2216 and even for those that do, it might be cleaner this way.
2647 If we're going down, however, we don't do this (might 2217 If we're going down, however, we don't do this (might
2648 be too dangerous), and if we get a crash somewhere within 2218 be too dangerous), and if we get a crash somewhere within
2649 this loop, we'll still autosave and won't try this again. */ 2219 this loop, we'll still autosave and won't try this again. */
2650 2220
2651 LIST_LOOP_DELETING (concons, nextcons, Vconsole_list) 2221 LIST_LOOP_DELETING(concons, nextcons, Vconsole_list)
2652 { 2222 {
2653 /* There is very little point in deleting the stream console. 2223 /* There is very little point in deleting the stream console.
2654 It uses stdio, which should flush any buffered output and 2224 It uses stdio, which should flush any buffered output and
2655 something can only go wrong. -slb */ 2225 something can only go wrong. -slb */
2656 /* I changed my mind. There's a stupid hack in close to add 2226 /* I changed my mind. There's a stupid hack in close to add
2660 } 2230 }
2661 } 2231 }
2662 2232
2663 UNGCPRO; 2233 UNGCPRO;
2664 2234
2665 #ifdef HAVE_MS_WINDOWS 2235 shut_down_emacs (0, ((STRINGP (arg)) ? arg : Qnil));
2666 /* If we displayed a message on the console and we're exiting due to
2667 init error, then we must allow the user to see this message. */
2668 if (mswindows_message_outputted && INTP (arg) && XINT (arg) != 0)
2669 Fmswindows_message_box (build_string ("Initialization error"),
2670 Qnil, Qnil);
2671 #endif
2672
2673 shut_down_emacs (0, STRINGP (arg) ? arg : Qnil, 0);
2674 2236
2675 #if defined(GNU_MALLOC) 2237 #if defined(GNU_MALLOC)
2676 __free_hook = 2238 __free_hook = voodoo_free_hook;
2677 #ifdef __GNUC__ /* prototype of __free_hook varies with glibc version */ 2239 #endif
2678 (__typeof__ (__free_hook)) 2240
2679 #endif 2241 exit ((INTP (arg)) ? XINT (arg) : 0);
2680 voodoo_free_hook;
2681 #endif
2682
2683 exit (INTP (arg) ? XINT (arg) : 0);
2684 /* NOTREACHED */ 2242 /* NOTREACHED */
2685 return Qnil; /* I'm sick of the compiler warning */ 2243 return Qnil; /* I'm sick of the compiler warning */
2686 } 2244 }
2687 2245
2688 /* Perform an orderly shutdown of XEmacs. Autosave any modified 2246 /* Perform an orderly shutdown of XEmacs. Autosave any modified
2691 any redisplay; this may be called when XEmacs is shutting down in 2249 any redisplay; this may be called when XEmacs is shutting down in
2692 the background, or after its X connection has died. 2250 the background, or after its X connection has died.
2693 2251
2694 If SIG is a signal number, print a message for it. 2252 If SIG is a signal number, print a message for it.
2695 2253
2696 This is called by fatal signal handlers and Fkill_emacs. It used to 2254 This is called by fatal signal handlers, X protocol error handlers,
2697 be called by X protocol error handlers, but instead they now call 2255 and Fkill_emacs. */
2698 Fkill_emacs. */
2699 static void 2256 static void
2700 shut_down_emacs (int sig, Lisp_Object stuff, int no_auto_save) 2257 shut_down_emacs (int sig, Lisp_Object stuff)
2701 { 2258 {
2702 /* This function can GC */ 2259 /* This function can GC */
2703 /* Prevent running of hooks and other non-essential stuff 2260 /* Prevent running of hooks and other non-essential stuff
2704 from now on. */ 2261 from now on. */
2705 preparing_for_armageddon = 1; 2262 preparing_for_armageddon = 1;
2706 2263
2707 ensure_no_quitting_from_now_on (); 2264 /* In case frames or windows are screwed up, avoid assertion
2265 failures here */
2266 Vinhibit_quit = Qt;
2708 2267
2709 #ifdef QUANTIFY 2268 #ifdef QUANTIFY
2710 quantify_stop_recording_data (); 2269 quantify_stop_recording_data ();
2711 #endif /* QUANTIFY */ 2270 #endif /* QUANTIFY */
2712 2271
2272 #if 0
2713 /* This is absolutely the most important thing to do, so make sure 2273 /* This is absolutely the most important thing to do, so make sure
2714 we do it now, before anything else. We might have crashed and 2274 we do it now, before anything else. We might have crashed and
2715 be in a weird inconsistent state, and potentially anything could 2275 be in a weird inconsistent state, and potentially anything could
2716 set off another protection fault and cause us to bail out 2276 set off another protection fault and cause us to bail out
2717 immediately. */ 2277 immediately. */
2718 /* Steve writes the following: 2278 /* I'm not removing the code entirely, yet. We have run up against
2719
2720 [[I'm not removing the code entirely, yet. We have run up against
2721 a spate of problems in diagnosing crashes due to crashes within 2279 a spate of problems in diagnosing crashes due to crashes within
2722 crashes. It has very definitely been determined that code called 2280 crashes. It has very definitely been determined that code called
2723 during auto-saving cannot work if XEmacs crashed inside of GC. 2281 during auto-saving cannot work if XEmacs crashed inside of GC.
2724 We already auto-save on an itimer so there cannot be too much 2282 We already auto-save on an itimer so there cannot be too much
2725 unsaved stuff around, and if we get better crash reports we might 2283 unsaved stuff around, and if we get better crash reports we might
2726 be able to get more problems fixed so I'm disabling this. -slb]] 2284 be able to get more problems fixed so I'm disabling this. -slb */
2727 2285 Fdo_auto_save (Qt, Qnil); /* do this before anything hazardous */
2728 and DISABLES AUTO-SAVING ENTIRELY during crashes! Way way bad idea. 2286 #endif
2729
2730 Instead let's just be more intelligent about avoiding crashing
2731 when possible, esp. nested crashes.
2732 */
2733 if (!no_auto_save)
2734 Fdo_auto_save (Qt, Qnil); /* do this before anything hazardous */
2735 2287
2736 fflush (stdout); 2288 fflush (stdout);
2737 reset_all_consoles (); 2289 reset_all_consoles ();
2738 if (sig && sig != SIGTERM) 2290 if (sig && sig != SIGTERM)
2739 { 2291 {
2740 if (sig == -1) 2292 stderr_out ("\nFatal error (%d).\n", sig);
2741 stderr_out ("\nFatal error.\n\n");
2742 else
2743 stderr_out ("\nFatal error (%d).\n\n", sig);
2744 stderr_out 2293 stderr_out
2745 ("Your files have been auto-saved.\n" 2294 ("Your files have been auto-saved.\n"
2746 "Use `M-x recover-session' to recover them.\n" 2295 "Use `M-x recover-session' to recover them.\n"
2747 "\n" 2296 "\n"
2748 "If you have access to the PROBLEMS file that came with your\n"
2749 "version of XEmacs, please check to see if your crash is described\n"
2750 "there, as there may be a workaround available.\n"
2751 #ifdef INFODOCK 2297 #ifdef INFODOCK
2752 "Otherwise, please report this bug by selecting `Report-Bug'\n" 2298 "Please report this bug by selecting `Report-Bug' in the InfoDock\n"
2753 "in the InfoDock menu.\n" 2299 "menu.\n"
2754 #else 2300 #else
2755 "Otherwise, please report this bug by running the send-pr\n" 2301 "Please report this bug by running the send-pr script included\n"
2756 "script included with XEmacs, or selecting `Send Bug Report'\n" 2302 "with XEmacs, or selecting `Send Bug Report' from the help menu.\n"
2757 "from the help menu.\n"
2758 "As a last resort send ordinary email to `crashes@xemacs.org'.\n" 2303 "As a last resort send ordinary email to `crashes@xemacs.org'.\n"
2759 #endif 2304 #endif
2760 "*MAKE SURE* to include the information in the command\n" 2305 "*MAKE SURE* to include the information in the command\n"
2761 "M-x describe-installation.\n" 2306 "M-x describe-installation.\n"
2762 #ifndef _MSC_VER
2763 "\n" 2307 "\n"
2764 "If at all possible, *please* try to obtain a C stack backtrace;\n" 2308 "If at all possible, *please* try to obtain a C stack backtrace;\n"
2765 "it will help us immensely in determining what went wrong.\n" 2309 "it will help us immensely in determining what went wrong.\n"
2766 "To do this, locate the core file that was produced as a result\n" 2310 "To do this, locate the core file that was produced as a result\n"
2767 "of this crash (it's usually called `core' and is located in the\n" 2311 "of this crash (it's usually called `core' and is located in the\n"
2768 "directory in which you started the editor, or maybe in your home\n" 2312 "directory in which you started the editor, or maybe in your home\n"
2769 "directory), and type\n" 2313 "directory), and type\n"
2770 "\n" 2314 "\n"
2771 " gdb " 2315 " gdb ");
2772 #endif
2773 );
2774 #ifndef _MSC_VER
2775 { 2316 {
2776 const char *name; 2317 CONST char *name;
2777 char *dir = 0; 2318 char *dir = 0;
2778 2319
2779 /* Now try to determine the actual path to the executable, 2320 /* Now try to determine the actual path to the executable,
2780 to try to make the backtrace-determination process as foolproof 2321 to try to make the backtrace-determination process as foolproof
2781 as possible. */ 2322 as possible. */
2782 if (STRINGP (Vinvocation_name)) 2323 if (GC_STRINGP (Vinvocation_name))
2783 name = (char *) XSTRING_DATA (Vinvocation_name); 2324 name = (char *) XSTRING_DATA (Vinvocation_name);
2784 else 2325 else
2785 name = "xemacs"; 2326 name = "xemacs";
2786 if (STRINGP (Vinvocation_directory)) 2327 if (GC_STRINGP (Vinvocation_directory))
2787 dir = (char *) XSTRING_DATA (Vinvocation_directory); 2328 dir = (char *) XSTRING_DATA (Vinvocation_directory);
2788 if (!dir || dir[0] != '/') 2329 if (!dir || dir[0] != '/')
2789 stderr_out ("`which %s`", name); 2330 stderr_out ("`which %s`", name);
2790 else if (dir[strlen (dir) - 1] != '/') 2331 else if (dir[strlen (dir) - 1] != '/')
2791 stderr_out ("%s/%s", dir, name); 2332 stderr_out ("%s/%s", dir, name);
2796 (" core\n\n" 2337 (" core\n\n"
2797 "then type `where' when the debugger prompt comes up.\n" 2338 "then type `where' when the debugger prompt comes up.\n"
2798 "(If you don't have GDB on your system, you might have DBX,\n" 2339 "(If you don't have GDB on your system, you might have DBX,\n"
2799 "or XDB, or SDB. A similar procedure should work for all of\n" 2340 "or XDB, or SDB. A similar procedure should work for all of\n"
2800 "these. Ask your system administrator if you need more help.)\n"); 2341 "these. Ask your system administrator if you need more help.)\n");
2801 #endif /* _MSC_VER */
2802 } 2342 }
2803 2343
2804 stuff_buffered_input (stuff); 2344 stuff_buffered_input (stuff);
2805 2345
2806 kill_buffer_processes (Qnil); 2346 kill_buffer_processes (Qnil);
2819 2359
2820 } 2360 }
2821 2361
2822 2362
2823 #ifndef CANNOT_DUMP 2363 #ifndef CANNOT_DUMP
2824 2364 /* Nothing like this can be implemented on an Apollo.
2825 #if !defined(PDUMP) || !defined(SYSTEM_MALLOC) 2365 What a loss! */
2366
2826 extern char my_edata[]; 2367 extern char my_edata[];
2827 #endif 2368
2828 2369 #ifdef HAVE_SHM
2370
2371 DEFUN ("dump-emacs-data", Fdump_emacs_data, 1, 1, 0, /*
2372 Dump current state of XEmacs into data file FILENAME.
2373 This function exists on systems that use HAVE_SHM.
2374 */
2375 (intoname))
2376 {
2377 /* This function can GC */
2378 int opurify;
2379 struct gcpro gcpro1;
2380 GCPRO1 (intoname);
2381
2382 CHECK_STRING (intoname);
2383 intoname = Fexpand_file_name (intoname, Qnil);
2384
2385 opurify = purify_flag;
2386 purify_flag = 0;
2387
2388 fflush (stderr);
2389 fflush (stdout);
2390
2391 disksave_object_finalization ();
2392 release_breathing_space ();
2393
2394 /* Tell malloc where start of impure now is */
2395 /* Also arrange for warnings when nearly out of space. */
2396 #ifndef SYSTEM_MALLOC
2397 memory_warnings (my_edata, malloc_warning);
2398 #endif
2399 UNGCPRO;
2400 map_out_data (XSTRING_DATA (intoname));
2401
2402 purify_flag = opurify;
2403
2404 return Qnil;
2405 }
2406
2407 #else /* not HAVE_SHM */
2829 extern void disable_free_hook (void); 2408 extern void disable_free_hook (void);
2830 2409
2831 DEFUN ("dump-emacs", Fdump_emacs, 2, 2, 0, /* 2410 DEFUN ("dump-emacs", Fdump_emacs, 2, 2, 0, /*
2832 Dump current state of XEmacs into executable file FILENAME. 2411 Dump current state of XEmacs into executable file FILENAME.
2833 Take symbols from SYMFILE (presumably the file you executed to run XEmacs). 2412 Take symbols from SYMFILE (presumably the file you executed to run XEmacs).
2864 } 2443 }
2865 2444
2866 opurify = purify_flag; 2445 opurify = purify_flag;
2867 purify_flag = 0; 2446 purify_flag = 0;
2868 2447
2869 #if defined (HEAP_IN_DATA) && !defined(PDUMP)
2870 report_sheap_usage (1);
2871 #endif
2872
2873 clear_message ();
2874
2875 fflush (stderr); 2448 fflush (stderr);
2876 fflush (stdout); 2449 fflush (stdout);
2877 2450
2878 disksave_object_finalization (); 2451 disksave_object_finalization ();
2879 release_breathing_space (); 2452 release_breathing_space ();
2884 memory_warnings (my_edata, malloc_warning); 2457 memory_warnings (my_edata, malloc_warning);
2885 #endif 2458 #endif
2886 2459
2887 UNGCPRO; 2460 UNGCPRO;
2888 2461
2462 #if defined (MSDOS) && defined (EMX)
2463 {
2464 int fd = open ((char *) XSTRING_DATA (intoname),
2465 O_WRONLY|O_CREAT|O_TRUNC, S_IREAD|S_IWRITE);
2466 if (!fd) {
2467 error ("Failure operating on %s", XSTRING_DATA (intoname));
2468 } else {
2469 _core (fd);
2470 close (fd);
2471 }
2472 }
2473 #else /* not MSDOS and EMX */
2889 { 2474 {
2890 char *intoname_ext; 2475 char *intoname_ext;
2891 char *symname_ext; 2476 char *symname_ext;
2892 2477
2893 TO_EXTERNAL_FORMAT (LISP_STRING, intoname, 2478 GET_C_STRING_FILENAME_DATA_ALLOCA (intoname, intoname_ext);
2894 C_STRING_ALLOCA, intoname_ext,
2895 Qfile_name);
2896
2897 if (STRINGP (symname)) 2479 if (STRINGP (symname))
2898 TO_EXTERNAL_FORMAT (LISP_STRING, symname, 2480 GET_C_STRING_FILENAME_DATA_ALLOCA (symname, symname_ext);
2899 C_STRING_ALLOCA, symname_ext,
2900 Qfile_name);
2901 else 2481 else
2902 symname_ext = 0; 2482 symname_ext = 0;
2903 2483
2904 garbage_collect_1 (); 2484 garbage_collect_1 ();
2905
2906 #ifdef PDUMP
2907 pdump ();
2908 #else
2909
2910 #ifdef DOUG_LEA_MALLOC 2485 #ifdef DOUG_LEA_MALLOC
2911 malloc_state_ptr = malloc_get_state (); 2486 malloc_state_ptr = malloc_get_state ();
2912 #endif 2487 #endif
2913 /* here we break our rule that the filename conversion should 2488 /* here we break our rule that the filename conversion should
2914 be performed at the actual time that the system call is made. 2489 be performed at the actual time that the system call is made.
2918 leakage because this call only happens once. */ 2493 leakage because this call only happens once. */
2919 unexec (intoname_ext, symname_ext, (uintptr_t) my_edata, 0, 0); 2494 unexec (intoname_ext, symname_ext, (uintptr_t) my_edata, 0, 0);
2920 #ifdef DOUG_LEA_MALLOC 2495 #ifdef DOUG_LEA_MALLOC
2921 free (malloc_state_ptr); 2496 free (malloc_state_ptr);
2922 #endif 2497 #endif
2923 #endif /* not PDUMP */
2924 } 2498 }
2499 #endif /* not MSDOS and EMX */
2925 2500
2926 purify_flag = opurify; 2501 purify_flag = opurify;
2927 2502
2928 return Qnil; 2503 return Qnil;
2929 } 2504 }
2505
2506 #endif /* not HAVE_SHM */
2930 2507
2931 #endif /* not CANNOT_DUMP */ 2508 #endif /* not CANNOT_DUMP */
2932 2509
2510 #ifndef SEPCHAR
2511 #define SEPCHAR ':'
2512 #endif
2933 2513
2934 /* Split STRING into a list of substrings. The substrings are the 2514 /* Split STRING into a list of substrings. The substrings are the
2935 parts of original STRING separated by SEPCHAR. */ 2515 parts of original STRING separated by SEPCHAR. */
2936 static Lisp_Object 2516 static Lisp_Object
2937 split_string_by_emchar_1 (const Bufbyte *string, Bytecount size, 2517 split_string_by_emchar_1 (CONST Bufbyte *string, Bytecount size,
2938 Emchar sepchar) 2518 Emchar sepchar)
2939 { 2519 {
2940 Lisp_Object result = Qnil; 2520 Lisp_Object result = Qnil;
2941 const Bufbyte *end = string + size; 2521 CONST Bufbyte *end = string + size;
2942 2522
2943 while (1) 2523 while (1)
2944 { 2524 {
2945 const Bufbyte *p = string; 2525 CONST Bufbyte *p = string;
2946 while (p < end) 2526 while (p < end)
2947 { 2527 {
2948 if (charptr_emchar (p) == sepchar) 2528 if (charptr_emchar (p) == sepchar)
2949 break; 2529 break;
2950 INC_CHARPTR (p); 2530 INC_CHARPTR (p);
2960 } 2540 }
2961 return Fnreverse (result); 2541 return Fnreverse (result);
2962 } 2542 }
2963 2543
2964 /* The same as the above, except PATH is an external C string (it is 2544 /* The same as the above, except PATH is an external C string (it is
2965 converted using Qfile_name), and sepchar is hardcoded to SEPCHAR 2545 converted as FORMAT_FILENAME), and sepchar is hardcoded to SEPCHAR
2966 (':' or whatever). */ 2546 (':' or whatever). */
2967 Lisp_Object 2547 Lisp_Object
2968 decode_path (const char *path) 2548 decode_path (CONST char *path)
2969 { 2549 {
2970 Bytecount newlen; 2550 int len;
2971 Bufbyte *newpath; 2551 Bufbyte *newpath;
2972 if (!path) 2552 if (!path)
2973 return Qnil; 2553 return Qnil;
2974 2554
2975 TO_INTERNAL_FORMAT (C_STRING, path, ALLOCA, (newpath, newlen), Qfile_name); 2555 GET_C_CHARPTR_INT_FILENAME_DATA_ALLOCA (path, newpath);
2976 2556
2557 len = strlen ((const char *) newpath);
2977 /* #### Does this make sense? It certainly does for 2558 /* #### Does this make sense? It certainly does for
2978 decode_env_path(), but it looks dubious here. Does any code 2559 decode_env_path(), but it looks dubious here. Does any code
2979 depend on decode_path("") returning nil instead of an empty 2560 depend on decode_path("") returning nil instead of an empty
2980 string? */ 2561 string? */
2981 if (!newlen) 2562 if (!len)
2982 return Qnil; 2563 return Qnil;
2983 2564
2984 return split_string_by_emchar_1 (newpath, newlen, SEPCHAR); 2565 return split_string_by_emchar_1 (newpath, (Bytecount)len, SEPCHAR);
2985 } 2566 }
2986 2567
2987 Lisp_Object 2568 Lisp_Object
2988 decode_env_path (const char *evarname, const char *default_) 2569 decode_env_path (CONST char *evarname, CONST char *default_)
2989 { 2570 {
2990 const char *path = 0; 2571 CONST char *path = 0;
2991 if (evarname) 2572 if (evarname)
2992 path = egetenv (evarname); 2573 path = egetenv (evarname);
2993 if (!path) 2574 if (!path)
2994 path = default_; 2575 path = default_;
2995 return decode_path (path); 2576 return decode_path (path);
3047 /* #define ASSERTIONS_DONT_ABORT */ 2628 /* #define ASSERTIONS_DONT_ABORT */
3048 2629
3049 #ifdef USE_ASSERTIONS 2630 #ifdef USE_ASSERTIONS
3050 /* This highly dubious kludge ... shut up Jamie, I'm tired of your slagging. */ 2631 /* This highly dubious kludge ... shut up Jamie, I'm tired of your slagging. */
3051 2632
3052 static int in_assert_failed; 2633 DOESNT_RETURN
3053 static const char *assert_failed_file; 2634 assert_failed (CONST char *file, int line, CONST char *expr)
3054 static int assert_failed_line; 2635 {
3055 static const char *assert_failed_expr; 2636 stderr_out ("Fatal error: assertion failed, file %s, line %d, %s\n",
3056 2637 file, line, expr);
3057 #ifdef fprintf
3058 #undef fprintf
3059 #endif
3060
3061 #undef abort /* avoid infinite #define loop... */ 2638 #undef abort /* avoid infinite #define loop... */
3062 2639 #if defined (WINDOWSNT) && defined (DEBUG_XEMACS)
3063 #if defined (WIN32_NATIVE) && defined (DEBUG_XEMACS) 2640 DebugBreak ();
3064 #define enter_debugger() DebugBreak () 2641 #elif !defined (ASSERTIONS_DONT_ABORT)
3065 #else
3066 #define enter_debugger()
3067 #endif
3068
3069 void
3070 assert_failed (const char *file, int line, const char *expr)
3071 {
3072 /* If we're already crashing, let's not crash again. This might be
3073 critical to getting auto-saving working properly. */
3074 if (fatal_error_in_progress)
3075 return;
3076
3077 /* We are extremely paranoid so we sensibly deal with recursive
3078 assertion failures. */
3079 in_assert_failed++;
3080
3081 if (in_assert_failed >= 4)
3082 _exit (-1);
3083 else if (in_assert_failed == 3)
3084 {
3085 enter_debugger ();
3086 _exit (-1);
3087 }
3088 else if (in_assert_failed == 2)
3089 {
3090 /* Not stderr_out(), which does additional things and may trigger
3091 a recursive assertion failure. fprintf was undeffed above, in
3092 case it was encapsulated. */
3093 fprintf (stderr,
3094 "Fatal error: recursive assertion failure, "
3095 "file %s, line %d, %s\n",
3096 file, line, expr);
3097 fprintf (stderr,
3098 "Original assertion failure: file %s, line %d, %s\n",
3099 assert_failed_file, assert_failed_line, assert_failed_expr);
3100 }
3101 else
3102 {
3103 assert_failed_file = file;
3104 assert_failed_line = line;
3105 assert_failed_expr = expr;
3106
3107 if (!initialized)
3108 fprintf (stderr,
3109 "Fatal error: assertion failed, file %s, line %d, %s\n",
3110 file, line, expr);
3111 else
3112 stderr_out ("Fatal error: assertion failed, file %s, line %d, %s\n",
3113 file, line, expr);
3114 }
3115
3116 enter_debugger ();
3117 #if !defined (ASSERTIONS_DONT_ABORT)
3118 abort (); 2642 abort ();
3119 #endif 2643 #endif
3120 in_assert_failed = 0;
3121 } 2644 }
3122 #endif /* USE_ASSERTIONS */ 2645 #endif /* USE_ASSERTIONS */
3123 2646
3124 #ifdef QUANTIFY 2647 #ifdef QUANTIFY
3125 DEFUN ("quantify-start-recording-data", Fquantify_start_recording_data, 2648 DEFUN ("quantify-start-recording-data", Fquantify_start_recording_data,
3154 2677
3155 void 2678 void
3156 syms_of_emacs (void) 2679 syms_of_emacs (void)
3157 { 2680 {
3158 #ifndef CANNOT_DUMP 2681 #ifndef CANNOT_DUMP
2682 #ifdef HAVE_SHM
2683 DEFSUBR (Fdump_emacs_data);
2684 #else
3159 DEFSUBR (Fdump_emacs); 2685 DEFSUBR (Fdump_emacs);
2686 #endif
3160 #endif /* !CANNOT_DUMP */ 2687 #endif /* !CANNOT_DUMP */
3161 2688
3162 DEFSUBR (Frun_emacs_from_temacs); 2689 DEFSUBR (Frun_emacs_from_temacs);
3163 DEFSUBR (Frunning_temacs_p); 2690 DEFSUBR (Frunning_temacs_p);
3164 DEFSUBR (Finvocation_name); 2691 DEFSUBR (Finvocation_name);
3225 # define EMACS_CONFIGURATION "UNKNOWN" 2752 # define EMACS_CONFIGURATION "UNKNOWN"
3226 #endif 2753 #endif
3227 DEFVAR_LISP ("system-configuration", &Vsystem_configuration /* 2754 DEFVAR_LISP ("system-configuration", &Vsystem_configuration /*
3228 String naming the configuration XEmacs was built for. 2755 String naming the configuration XEmacs was built for.
3229 */ ); 2756 */ );
3230 Vsystem_configuration = build_string (EMACS_CONFIGURATION); 2757 Vsystem_configuration = Fpurecopy (build_string (EMACS_CONFIGURATION));
3231 2758
3232 #ifndef EMACS_CONFIG_OPTIONS 2759 #ifndef EMACS_CONFIG_OPTIONS
3233 # define EMACS_CONFIG_OPTIONS "UNKNOWN" 2760 # define EMACS_CONFIG_OPTIONS "UNKNOWN"
3234 #endif 2761 #endif
3235 DEFVAR_LISP ("system-configuration-options", &Vsystem_configuration_options /* 2762 DEFVAR_LISP ("system-configuration-options", &Vsystem_configuration_options /*
3236 String containing the configuration options XEmacs was built with. 2763 String containing the configuration options XEmacs was built with.
3237 */ ); 2764 */ );
3238 Vsystem_configuration_options = build_string (EMACS_CONFIG_OPTIONS); 2765 Vsystem_configuration_options = Fpurecopy (build_string
2766 (EMACS_CONFIG_OPTIONS));
3239 2767
3240 DEFVAR_LISP ("emacs-major-version", &Vemacs_major_version /* 2768 DEFVAR_LISP ("emacs-major-version", &Vemacs_major_version /*
3241 Major version number of this version of Emacs, as an integer. 2769 Major version number of this version of Emacs, as an integer.
3242 Warning: this variable did not exist in Emacs versions earlier than: 2770 Warning: this variable did not exist in Emacs versions earlier than:
3243 FSF Emacs: 19.23 2771 FSF Emacs: 19.23
3251 FSF Emacs: 19.23 2779 FSF Emacs: 19.23
3252 XEmacs: 19.10 2780 XEmacs: 19.10
3253 */ ); 2781 */ );
3254 Vemacs_minor_version = make_int (EMACS_MINOR_VERSION); 2782 Vemacs_minor_version = make_int (EMACS_MINOR_VERSION);
3255 2783
3256 DEFVAR_LISP ("emacs-patch-level", &Vemacs_patch_level /* 2784 DEFVAR_LISP ("emacs-beta-version", &Vemacs_beta_version /*
3257 The patch level of this version of Emacs, as an integer.
3258 The value is non-nil if this version of XEmacs is part of a series of
3259 stable XEmacsen, but has bug fixes applied.
3260 Warning: this variable does not exist in FSF Emacs or in XEmacs versions
3261 earlier than 21.1.1
3262 */ );
3263 #ifdef EMACS_PATCH_LEVEL
3264 Vemacs_patch_level = make_int (EMACS_PATCH_LEVEL);
3265 #else
3266 Vemacs_patch_level = Qnil;
3267 #endif
3268
3269 DEFVAR_LISP ("emacs-beta-version", &Vemacs_beta_version /*
3270 Beta number of this version of Emacs, as an integer. 2785 Beta number of this version of Emacs, as an integer.
3271 The value is nil if this is an officially released version of XEmacs. 2786 The value is nil if this is an officially released version of XEmacs.
3272 Warning: this variable does not exist in FSF Emacs or in XEmacs versions 2787 Warning: this variable does not exist in FSF Emacs or in XEmacs versions
3273 earlier than 20.3. 2788 earlier than 20.3.
3274 */ ); 2789 */ );
3299 Codename of this version of Emacs (a string). 2814 Codename of this version of Emacs (a string).
3300 */ ); 2815 */ );
3301 #ifndef XEMACS_CODENAME 2816 #ifndef XEMACS_CODENAME
3302 #define XEMACS_CODENAME "Noname" 2817 #define XEMACS_CODENAME "Noname"
3303 #endif 2818 #endif
3304 Vxemacs_codename = build_string (XEMACS_CODENAME); 2819 Vxemacs_codename = Fpurecopy (build_string (XEMACS_CODENAME));
3305 2820
3306 DEFVAR_BOOL ("noninteractive", &noninteractive1 /* 2821 DEFVAR_BOOL ("noninteractive", &noninteractive1 /*
3307 Non-nil means XEmacs is running without interactive terminal. 2822 Non-nil means XEmacs is running without interactive terminal.
3308 */ ); 2823 */ );
3309 2824
3351 extents - check extents prior to each extent change; 2866 extents - check extents prior to each extent change;
3352 typecheck - check types strictly, aborting in case of error; 2867 typecheck - check types strictly, aborting in case of error;
3353 malloc - check operation of malloc; 2868 malloc - check operation of malloc;
3354 gc - check garbage collection; 2869 gc - check garbage collection;
3355 bufpos - check buffer positions. 2870 bufpos - check buffer positions.
3356
3357 quick-build - user has requested the "quick-build" configure option.
3358 */ ); 2871 */ );
3359 Vinternal_error_checking = Qnil; 2872 Vinternal_error_checking = Qnil;
3360 #ifdef ERROR_CHECK_EXTENTS 2873 #ifdef ERROR_CHECK_EXTENTS
3361 Vinternal_error_checking = Fcons (intern ("extents"), 2874 Vinternal_error_checking = Fcons (intern ("extents"),
3362 Vinternal_error_checking); 2875 Vinternal_error_checking);
3375 #endif 2888 #endif
3376 #ifdef ERROR_CHECK_BUFPOS 2889 #ifdef ERROR_CHECK_BUFPOS
3377 Vinternal_error_checking = Fcons (intern ("bufpos"), 2890 Vinternal_error_checking = Fcons (intern ("bufpos"),
3378 Vinternal_error_checking); 2891 Vinternal_error_checking);
3379 #endif 2892 #endif
3380 #ifdef QUICK_BUILD 2893 Vinternal_error_checking = Fpurecopy (Vinternal_error_checking);
3381 Vinternal_error_checking = Fcons (intern ("quick-build"),
3382 Vinternal_error_checking);
3383 #endif
3384
3385 DEFVAR_CONST_LISP ("mail-lock-methods", &Vmail_lock_methods /*
3386 Mail spool locking methods supported by this instance of XEmacs.
3387 This is a list of symbols. Each of the symbols is one of the
3388 following: dot, lockf, flock, locking, mmdf.
3389 */ );
3390 {
3391 Vmail_lock_methods = Qnil;
3392 Vmail_lock_methods = Fcons (intern ("dot"), Vmail_lock_methods);
3393 #ifdef HAVE_LOCKF
3394 Vmail_lock_methods = Fcons (intern ("lockf"), Vmail_lock_methods);
3395 #endif
3396 #ifdef HAVE_FLOCK
3397 Vmail_lock_methods = Fcons (intern ("flock"), Vmail_lock_methods);
3398 #endif
3399 #ifdef HAVE_MMDF
3400 Vmail_lock_methods = Fcons (intern ("mmdf"), Vmail_lock_methods);
3401 #endif
3402 #ifdef HAVE_LOCKING
3403 Vmail_lock_methods = Fcons (intern ("locking"), Vmail_lock_methods);
3404 #endif
3405 }
3406
3407 DEFVAR_CONST_LISP ("configure-mail-lock-method", &Vconfigure_mail_lock_method /*
3408 Mail spool locking method suggested by configure. This is one
3409 of the symbols in MAIL-LOCK-METHODS.
3410 */ );
3411 {
3412 #if defined(MAIL_LOCK_FLOCK) && defined(HAVE_FLOCK)
3413 Vconfigure_mail_lock_method = intern("flock");
3414 #elif defined(MAIL_LOCK_LOCKF) && defined(HAVE_LOCKF)
3415 Vconfigure_mail_lock_method = intern("lockf");
3416 #elif defined(MAIL_LOCK_MMDF) && defined(HAVE_MMDF)
3417 Vconfigure_mail_lock_method = intern("mmdf");
3418 #elif defined(MAIL_LOCK_LOCKING) && defined(HAVE_LOCKING)
3419 Vconfigure_mail_lock_method = intern("locking");
3420 #else
3421 Vconfigure_mail_lock_method = intern("dot");
3422 #endif
3423 }
3424 2894
3425 DEFVAR_LISP ("path-separator", &Vpath_separator /* 2895 DEFVAR_LISP ("path-separator", &Vpath_separator /*
3426 The directory separator in search paths, as a string. 2896 The directory separator in search paths, as a string.
3427 */ ); 2897 */ );
3428 { 2898 {
3517 2987
3518 DEFVAR_LISP ("data-directory", &Vdata_directory /* 2988 DEFVAR_LISP ("data-directory", &Vdata_directory /*
3519 *Directory of architecture-independent files that come with XEmacs, 2989 *Directory of architecture-independent files that come with XEmacs,
3520 intended for XEmacs to use. 2990 intended for XEmacs to use.
3521 Use of this variable in new code is almost never correct. See the 2991 Use of this variable in new code is almost never correct. See the
3522 functions `locate-data-file' and `locate-data-directory' and the variable 2992 function `locate-data-directory' and the variable `data-directory-list'.
3523 `data-directory-list'.
3524 */ ); 2993 */ );
3525 Vdata_directory = Qnil; 2994 Vdata_directory = Qnil;
3526 2995
3527 DEFVAR_LISP ("configure-data-directory", &Vconfigure_data_directory /* 2996 DEFVAR_LISP ("configure-data-directory", &Vconfigure_data_directory /*
3528 For internal use by the build procedure only. 2997 For internal use by the build procedure only.
3539 *List of directories of architecture-independent files that come with XEmacs 3008 *List of directories of architecture-independent files that come with XEmacs
3540 or were installed as packages, and are intended for XEmacs to use. 3009 or were installed as packages, and are intended for XEmacs to use.
3541 */ ); 3010 */ );
3542 Vdata_directory_list = Qnil; 3011 Vdata_directory_list = Qnil;
3543 3012
3013 #ifdef CLASH_DETECTION
3014 DEFVAR_LISP ("configure-lock-directory", &Vconfigure_lock_directory /*
3015 For internal use by the build procedure only.
3016 configure's idea of what LOCK-DIRECTORY will be.
3017 */ );
3018 #ifdef PATH_LOCK
3019 Vconfigure_lock_directory = Ffile_name_as_directory
3020 (build_string ((char *) PATH_LOCK));
3021 #else
3022 Vconfigure_lock_directory = Qnil;
3023 #endif
3024 #endif /* CLASH_DETECTION */
3025
3544 DEFVAR_LISP ("site-directory", &Vsite_directory /* 3026 DEFVAR_LISP ("site-directory", &Vsite_directory /*
3545 *Directory of site-specific Lisp files that come with XEmacs. 3027 *Directory of site-specific Lisp files that come with XEmacs.
3546 */ ); 3028 */ );
3547 Vsite_directory = Qnil; 3029 Vsite_directory = Qnil;
3548 3030
3633 #else 3115 #else
3634 Vconfigure_info_path = Qnil; 3116 Vconfigure_info_path = Qnil;
3635 #endif 3117 #endif
3636 } 3118 }
3637 3119
3638 #if defined(__sgi) && !defined(PDUMP) 3120 #ifdef __sgi
3639 /* This is so tremendously ugly I'd puke. But then, it works. 3121 /* This is so tremendously ugly I'd puke. But then, it works.
3640 * The target is to override the static constructor from the 3122 * The target is to override the static constructor from the
3641 * libiflPNG.so library which is maskerading as libz, and 3123 * libiflPNG.so library which is maskerading as libz, and
3642 * cores on us when re-started from the dumped executable. 3124 * cores on us when re-started from the dumped executable.
3643 * This will have to go for 21.1 -- OG. 3125 * This will have to go for 21.1 -- OG.