Mercurial > hg > xemacs-beta
comparison src/emacs.c @ 0:376386a54a3c r19-14
Import from CVS: tag r19-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:45:50 +0200 |
parents | |
children | ac2d302a0011 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:376386a54a3c |
---|---|
1 /* XEmacs -- Fully extensible Emacs, running on Unix and other platforms. | |
2 Copyright (C) 1985, 1986, 1987, 1992, 1993, 1994 | |
3 Free Software Foundation, Inc. | |
4 Copyright (C) 1995 Sun Microsystems, Inc. | |
5 | |
6 This file is part of XEmacs. | |
7 | |
8 XEmacs is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
10 Free Software Foundation; either version 2, or (at your option) any | |
11 later version. | |
12 | |
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with XEmacs; see the file COPYING. If not, write to | |
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
21 Boston, MA 02111-1307, USA. */ | |
22 | |
23 /* Synched up with: Mule 2.0, FSF 19.28. */ | |
24 | |
25 /* Note: It is necessary to specify <config.h> and not "config.h" in | |
26 order for the --srcdir type of compilation to work properly. | |
27 Otherwise the config.h from the srcdir, rather than the one from | |
28 the build dir, will be used. */ | |
29 | |
30 #include <config.h> | |
31 #include "lisp.h" | |
32 | |
33 #include "backtrace.h" /* run-emacs-from-temacs needs this */ | |
34 #include "buffer.h" | |
35 #include "commands.h" | |
36 #include "console.h" | |
37 #include "process.h" | |
38 #include "sysdep.h" | |
39 | |
40 #include <setjmp.h> | |
41 #include "syssignal.h" /* Always include before systty.h */ | |
42 #include "systty.h" | |
43 #include "sysfile.h" | |
44 #include "systime.h" | |
45 | |
46 #if defined (I18N2) || defined (I18N3) || defined (I18N4) | |
47 #include <locale.h> | |
48 #endif | |
49 | |
50 #ifdef TOOLTALK | |
51 #include <tt_c.h> | |
52 #endif | |
53 | |
54 #ifdef VMS | |
55 #include <ssdef.h> | |
56 #endif | |
57 | |
58 #ifdef APOLLO | |
59 #ifndef APOLLO_SR10 | |
60 #include <default_acl.h> | |
61 #endif | |
62 #endif | |
63 | |
64 extern void memory_warnings (void *, void (*warnfun) (CONST char *)); | |
65 | |
66 /* Command line args from shell, as list of strings */ | |
67 Lisp_Object Vcommand_line_args; | |
68 | |
69 /* Set nonzero after XEmacs has started up the first time. | |
70 Prevents reinitialization of the Lisp world and keymaps | |
71 on subsequent starts. */ | |
72 int initialized; | |
73 | |
74 /* Variable whose value is symbol giving operating system type. */ | |
75 Lisp_Object Vsystem_type; | |
76 | |
77 /* Variable whose value is string giving configuration built for. */ | |
78 Lisp_Object Vsystem_configuration; | |
79 | |
80 /* The name under which XEmacs was invoked, with any leading directory | |
81 names discarded. */ | |
82 Lisp_Object Vinvocation_name; | |
83 | |
84 /* The directory name from which XEmacs was invoked. */ | |
85 Lisp_Object Vinvocation_directory; | |
86 | |
87 #if 0 /* FSFmacs */ | |
88 /* The directory name in which to find subdirs such as lisp and etc. | |
89 nil means get them only from PATH_LOADSEARCH. */ | |
90 Lisp_Object Vinstallation_directory; | |
91 #endif | |
92 | |
93 /* If nonzero, set XEmacs to run at this priority. This is also used | |
94 in child_setup and sys_suspend to make sure subshells run at normal | |
95 priority. */ | |
96 int emacs_priority; | |
97 | |
98 /* If non-zero a filter or a sentinel is running. Tested to save the match | |
99 data on the first attempt to change it inside asynchronous code. */ | |
100 int running_asynch_code; | |
101 | |
102 /* If non-zero, a window-system was specified on the command line. */ | |
103 int display_arg; | |
104 | |
105 /* Type of display specified. We cannot use a Lisp symbol here because | |
106 Lisp symbols may not initialized at the time that we set this | |
107 variable. */ | |
108 CONST char *display_use; | |
109 | |
110 /* If non-zero, then the early error handler will only print the error | |
111 message and exit. */ | |
112 int suppress_early_backtrace; | |
113 | |
114 /* An address near the bottom of the stack. | |
115 Tells GC how to save a copy of the stack. */ | |
116 char *stack_bottom; | |
117 | |
118 #ifdef USG_SHARED_LIBRARIES | |
119 /* If nonzero, this is the place to put the end of the writable segment | |
120 at startup. */ | |
121 | |
122 unsigned int bss_end = 0; | |
123 #endif | |
124 | |
125 /* Number of bytes of writable memory we can expect to be able to get */ | |
126 unsigned int lim_data; | |
127 | |
128 /* Nonzero means running XEmacs without interactive terminal. */ | |
129 | |
130 int noninteractive; | |
131 | |
132 /* Value of Lisp variable `noninteractive'. | |
133 Normally same as C variable `noninteractive' | |
134 but nothing terrible happens if user sets this one. */ | |
135 | |
136 int noninteractive1; | |
137 | |
138 /* Save argv and argc. */ | |
139 char **initial_argv; | |
140 int initial_argc; | |
141 | |
142 extern int always_gc; /* hack */ | |
143 | |
144 Lisp_Object Qkill_emacs_hook; | |
145 Lisp_Object Qsave_buffers_kill_emacs; | |
146 | |
147 | |
148 /* Signal code for the fatal signal that was received */ | |
149 static int fatal_error_code; | |
150 | |
151 /* Nonzero if handling a fatal error already */ | |
152 static int fatal_error_in_progress; | |
153 | |
154 static void shut_down_emacs (int sig, Lisp_Object stuff); | |
155 | |
156 /* Handle bus errors, illegal instruction, etc. */ | |
157 SIGTYPE | |
158 fatal_error_signal (int sig) | |
159 { | |
160 fatal_error_code = sig; | |
161 signal (sig, SIG_DFL); | |
162 /* Unblock the signal so that if the same signal gets sent in the | |
163 code below, we avoid a deadlock. */ | |
164 EMACS_UNBLOCK_SIGNAL (fatal_error_code); | |
165 | |
166 /* If fatal error occurs in code below, avoid infinite recursion. */ | |
167 if (! fatal_error_in_progress) | |
168 { | |
169 fatal_error_in_progress = 1; | |
170 shut_down_emacs (sig, Qnil); | |
171 #ifdef DEBUG_XEMACS | |
172 stderr_out("\nLisp backtrace follows:\n\n"); | |
173 Fbacktrace(Qexternal_debugging_output, Qt); | |
174 | |
175 /* Check for Sun-style stack printing via /proc */ | |
176 { | |
177 char *pstack = "/usr/proc/bin/pstack"; | |
178 if (access(pstack, X_OK) == 0) | |
179 { | |
180 char buf[100]; | |
181 stderr_out("\nC backtrace follows:\n" | |
182 "(A real debugger may provide better information)\n\n"); | |
183 sprintf(buf, "%s %d >&2", pstack, (int)getpid()); | |
184 system(buf); | |
185 } | |
186 } | |
187 #endif | |
188 } | |
189 #ifdef VMS | |
190 LIB$STOP (SS$_ABORT); | |
191 #else | |
192 /* Signal the same code; this time it will really be fatal. */ | |
193 kill (getpid (), fatal_error_code); | |
194 #endif /* not VMS */ | |
195 SIGRETURN; | |
196 } | |
197 | |
198 | |
199 DOESNT_RETURN | |
200 fatal (CONST char *fmt, ...) | |
201 { | |
202 va_list args; | |
203 va_start (args, fmt); | |
204 | |
205 fprintf (stderr, "\nXEmacs: "); | |
206 vfprintf (stderr, GETTEXT (fmt), args); | |
207 fprintf (stderr, "\n"); | |
208 | |
209 va_end (args); | |
210 fflush (stderr); | |
211 exit (1); | |
212 } | |
213 | |
214 /* #### The following two functions should be replaced with | |
215 calls to emacs_doprnt_*() functions, with STREAM set to send out | |
216 to stdout or stderr. This is the only way to ensure that | |
217 I18N3 works properly (many implementations of the *printf() | |
218 functions, including the ones included in glibc, do not implement | |
219 the %###$ argument-positioning syntax). */ | |
220 | |
221 /* exactly equivalent to fprintf (stderr, fmt, ...) except that it calls | |
222 GETTEXT on the format string. */ | |
223 | |
224 int | |
225 stderr_out (CONST char *fmt, ...) | |
226 { | |
227 int retval; | |
228 va_list args; | |
229 va_start (args, fmt); | |
230 | |
231 retval = vfprintf (stderr, GETTEXT (fmt), args); | |
232 | |
233 va_end (args); | |
234 /* fflush (stderr); */ | |
235 return retval; | |
236 } | |
237 | |
238 /* exactly equivalent to fprintf (stdout, fmt, ...) except that it calls | |
239 GETTEXT on the format string. */ | |
240 | |
241 int | |
242 stdout_out (CONST char *fmt, ...) | |
243 { | |
244 int retval; | |
245 va_list args; | |
246 va_start (args, fmt); | |
247 | |
248 retval = vfprintf (stdout, GETTEXT (fmt), args); | |
249 | |
250 va_end (args); | |
251 return retval; | |
252 } | |
253 | |
254 #ifdef SIGDANGER | |
255 | |
256 /* Handler for SIGDANGER. */ | |
257 SIGTYPE | |
258 memory_warning_signal (int sig) | |
259 { | |
260 /* #### bad bad bad; this function shouldn't do anything except | |
261 set a flag, or weird corruption could happen. */ | |
262 signal (sig, memory_warning_signal); | |
263 | |
264 malloc_warning | |
265 (GETTEXT ("Operating system warns that virtual memory is running low.\n")); | |
266 | |
267 /* It might be unsafe to call do_auto_save now. */ | |
268 force_auto_save_soon (); | |
269 } | |
270 #endif | |
271 | |
272 /* Code for dealing with Lisp access to the Unix command line */ | |
273 | |
274 static Lisp_Object | |
275 make_arg_list_1 (int argc, char **argv, int skip_args) | |
276 { | |
277 Lisp_Object result = Qnil; | |
278 REGISTER int i; | |
279 | |
280 for (i = argc - 1; i >= 0; i--) | |
281 { | |
282 if (i == 0 || i > skip_args) | |
283 result = Fcons (build_ext_string (argv [i], FORMAT_OS), result); | |
284 } | |
285 return result; | |
286 } | |
287 | |
288 Lisp_Object | |
289 make_arg_list (int argc, char **argv) | |
290 { | |
291 return make_arg_list_1 (argc, argv, 0); | |
292 } | |
293 | |
294 /* Calling functions are also responsible for calling free_argc_argv | |
295 when they are done with the generated list. */ | |
296 void | |
297 make_argc_argv (Lisp_Object argv_list, int *argc, char ***argv) | |
298 { | |
299 Lisp_Object next; | |
300 int n = XINT (Flength (argv_list)); | |
301 REGISTER int i; | |
302 *argv = (char**) xmalloc ((n+1) * sizeof (char*)); | |
303 | |
304 for (i = 0, next = argv_list; i < n; i++, next = XCDR (next)) | |
305 { | |
306 CONST char *temp; | |
307 CHECK_STRING (XCAR (next)); | |
308 | |
309 GET_C_STRING_EXT_DATA_ALLOCA (XCAR (next), FORMAT_OS, temp); | |
310 (*argv) [i] = xstrdup (temp); | |
311 } | |
312 (*argv) [n] = 0; | |
313 *argc = i; | |
314 } | |
315 | |
316 void | |
317 free_argc_argv (char **argv) | |
318 { | |
319 int elt = 0; | |
320 | |
321 while (argv[elt]) | |
322 { | |
323 xfree (argv[elt]); | |
324 elt++; | |
325 } | |
326 xfree (argv); | |
327 } | |
328 | |
329 static void | |
330 init_cmdargs (int argc, char **argv, int skip_args) | |
331 { | |
332 initial_argv = argv; | |
333 initial_argc = argc; | |
334 | |
335 Vcommand_line_args = make_arg_list_1 (argc, argv, skip_args); | |
336 } | |
337 | |
338 DEFUN ("invocation-name", Finvocation_name, Sinvocation_name, 0, 0, 0 /* | |
339 Return the program name that was used to run XEmacs. | |
340 Any directory names are omitted. | |
341 */ ) | |
342 () | |
343 { | |
344 return Fcopy_sequence (Vinvocation_name); | |
345 } | |
346 | |
347 | |
348 #ifdef I18N4 | |
349 /* #### - don't know why I18N4 on SunOS/JLE | |
350 can't deal with this. It's a potential | |
351 bug that needs to be looked at. */ | |
352 # undef RUN_TIME_REMAP | |
353 #endif | |
354 | |
355 static DOESNT_RETURN | |
356 main_1 (int argc, char **argv, char **envp) | |
357 { | |
358 char stack_bottom_variable; | |
359 int skip_args = 0; | |
360 Lisp_Object load_me; | |
361 int inhibit_window_system; | |
362 | |
363 #ifdef NeXT | |
364 extern int malloc_cookie; | |
365 | |
366 /* 19-Jun-1995 -baw | |
367 * NeXT secret magic, ripped from Emacs-for-NS by Carl Edman | |
368 * <cedman@princton.edu>. Note that even Carl doesn't know what this | |
369 * does; it was provided by NeXT, and it presumable makes NS's mallocator | |
370 * work with dumping. But malloc_jumpstart() and malloc_freezedry() in | |
371 * unexnext.c are both completely undocumented, even in NS header files! | |
372 * But hey, it solves all NS related memory problems, so who's | |
373 * complaining? | |
374 */ | |
375 if (initialized) | |
376 if (malloc_jumpstart (malloc_cookie) != 0) | |
377 printf ("malloc jumpstart failed!\n"); | |
378 #endif /* NeXT */ | |
379 | |
380 #if defined (GNU_MALLOC) && defined (ERROR_CHECK_MALLOC) | |
381 #if 0 | |
382 if (!initialized) | |
383 init_free_hook (); | |
384 #endif | |
385 #endif | |
386 | |
387 /* Map in shared memory, if we are using that. */ | |
388 #ifdef HAVE_SHM | |
389 if (argc > 1 && !strcmp (argv[1], "-nl")) | |
390 { | |
391 map_in_data (0); | |
392 /* The shared memory was just restored, which clobbered this. */ | |
393 skip_args = 1; | |
394 } | |
395 else | |
396 { | |
397 map_in_data (1); | |
398 /* The shared memory was just restored, which clobbered this. */ | |
399 skip_args = 0; | |
400 } | |
401 #endif | |
402 | |
403 #ifdef VMS | |
404 /* If -map specified, map the data file in */ | |
405 if (argc > 2 && ! strcmp (argv[1], "-map")) | |
406 { | |
407 skip_args = 2; | |
408 mapin_data (argv[2]); | |
409 } | |
410 | |
411 #ifdef LINK_CRTL_SHARE | |
412 #ifdef SHAREABLE_LIB_BUG | |
413 /* Bletcherous shared libraries! */ | |
414 if (!stdin) | |
415 stdin = fdopen (0, "r"); | |
416 if (!stdout) | |
417 stdout = fdopen (1, "w"); | |
418 if (!stderr) | |
419 stderr = fdopen (2, "w"); | |
420 if (!environ) | |
421 environ = envp; | |
422 #endif /* SHAREABLE_LIB_BUG */ | |
423 #endif /* LINK_CRTL_SHARE */ | |
424 #endif /* VMS */ | |
425 #if (defined (MSDOS) && defined (EMX)) || defined (WIN32) || defined (_SCO_DS) | |
426 environ = envp; | |
427 #endif | |
428 | |
429 /* Record (approximately) where the stack begins. */ | |
430 stack_bottom = &stack_bottom_variable; | |
431 | |
432 #ifdef RUN_TIME_REMAP | |
433 if (initialized) | |
434 run_time_remap (argv[0]); | |
435 #endif | |
436 | |
437 #ifdef USG_SHARED_LIBRARIES | |
438 if (bss_end) | |
439 brk ((void *) bss_end); | |
440 #endif | |
441 | |
442 clearerr (stdin); | |
443 | |
444 #ifdef APOLLO | |
445 #ifndef APOLLO_SR10 | |
446 /* If USE_DOMAIN_ACLS environment variable exists, | |
447 use ACLs rather than UNIX modes. */ | |
448 if (egetenv ("USE_DOMAIN_ACLS")) | |
449 default_acl (USE_DEFACL); | |
450 #endif | |
451 #endif /* APOLLO */ | |
452 | |
453 #if defined (HAVE_MMAP) && defined (REL_ALLOC) | |
454 /* ralloc can only be used if using the GNU memory allocator. */ | |
455 init_ralloc (); | |
456 #endif | |
457 | |
458 #ifdef HAVE_SOCKS | |
459 if (initialized) | |
460 SOCKSinit (argv[0]); | |
461 #endif /* HAVE_SOCKS */ | |
462 | |
463 #ifndef SYSTEM_MALLOC | |
464 | |
465 if (!initialized) | |
466 { | |
467 /* Arrange to get warning messages as memory fills up. */ | |
468 memory_warnings (0, malloc_warning); | |
469 } | |
470 #endif /* not SYSTEM_MALLOC */ | |
471 | |
472 #ifdef MSDOS | |
473 /* We do all file input/output as binary files. When we need to translate | |
474 newlines, we do that manually. */ | |
475 _fmode = O_BINARY; | |
476 (stdin)->_flag &= ~_IOTEXT; | |
477 (stdout)->_flag &= ~_IOTEXT; | |
478 (stderr)->_flag &= ~_IOTEXT; | |
479 #endif /* MSDOS */ | |
480 | |
481 #ifdef SET_EMACS_PRIORITY | |
482 if (emacs_priority != 0) | |
483 nice (-emacs_priority); | |
484 setuid (getuid ()); | |
485 #endif /* SET_EMACS_PRIORITY */ | |
486 | |
487 #ifdef EXTRA_INITIALIZE | |
488 EXTRA_INITIALIZE; | |
489 #endif | |
490 | |
491 #ifdef HAVE_WINDOW_SYSTEM | |
492 inhibit_window_system = 0; | |
493 #else | |
494 inhibit_window_system = 1; | |
495 #endif | |
496 | |
497 /* Handle the -t switch, which specifies filename to use as terminal */ | |
498 if (skip_args + 2 < argc && !strcmp (argv[skip_args + 1], "-t")) | |
499 { | |
500 int result; | |
501 | |
502 skip_args += 2; | |
503 close (0); | |
504 close (1); | |
505 result = open (argv[skip_args], O_RDWR, 2 ); | |
506 if (result < 0) | |
507 { | |
508 fatal ("%s: %s", argv[skip_args], strerror (errno)); | |
509 } | |
510 dup (0); | |
511 if (! isatty (0)) | |
512 fatal ("%s: not a tty", argv[skip_args]); | |
513 | |
514 stderr_out ("Using %s", ttyname (0)); | |
515 #if 0 | |
516 stderr_out ("Using %s", argv[skip_args]); | |
517 #endif | |
518 inhibit_window_system = 1; /* -t => -nw */ | |
519 } | |
520 | |
521 if (skip_args + 1 < argc | |
522 && (!strcmp (argv[skip_args + 1], "-nw"))) | |
523 { | |
524 skip_args += 1; | |
525 inhibit_window_system = 1; | |
526 } | |
527 | |
528 /* Handle the -batch switch, which means don't do interactive display. */ | |
529 noninteractive = 0; | |
530 if (skip_args + 1 < argc && | |
531 (!strcmp (argv[skip_args + 1], "-batch") || | |
532 !strcmp (argv[skip_args + 1], "--batch"))) | |
533 { | |
534 skip_args += 1; | |
535 noninteractive = 1; | |
536 } | |
537 | |
538 /* Partially handle the -version and -help switches: they imply -batch, | |
539 but are not removed from the list. | |
540 */ | |
541 if (skip_args + 1 < argc && | |
542 (!strcmp (argv[skip_args + 1], "-version") || | |
543 !strcmp (argv[skip_args + 1], "--version") || | |
544 !strcmp (argv[skip_args + 1], "-help") || | |
545 !strcmp (argv[skip_args + 1], "--help"))) | |
546 noninteractive = 1; | |
547 | |
548 /* Now, figure out which type of console is our first console. */ | |
549 | |
550 display_arg = 0; | |
551 | |
552 if (noninteractive) | |
553 display_use = "stream"; | |
554 else | |
555 display_use = "tty"; | |
556 | |
557 #ifndef HAVE_TTY | |
558 if (inhibit_window_system) | |
559 fatal ("Sorry, this XEmacs was not compiled with TTY support"); | |
560 #endif | |
561 | |
562 #ifdef HAVE_WINDOW_SYSTEM | |
563 /* Stupid kludge to catch command-line display spec. We can't | |
564 handle this argument entirely in window system dependent code | |
565 because we don't even know which window system dependent code | |
566 to run until we've recognized this argument. */ | |
567 if (!inhibit_window_system && !noninteractive) | |
568 { | |
569 int i; | |
570 char *disp; | |
571 | |
572 for (i = 1; (i < argc && !display_arg); i++) | |
573 { | |
574 #ifdef HAVE_X_WINDOWS | |
575 if (!strcmp (argv[i], "-d") || !strcmp (argv[i], "-display")) | |
576 { | |
577 display_arg = 1; | |
578 display_use = "x"; | |
579 } | |
580 #endif /* HAVE_X_WINDOWS */ | |
581 #ifdef HAVE_NEXTSTEP | |
582 if (!strcmp (argv[i], "-NXHost") || !strcmp (argv[i], "-MachLaunch")) | |
583 { | |
584 display_arg = 1; | |
585 display_use = "ns"; | |
586 } | |
587 #endif /* HAVE_NEXTSTEP */ | |
588 } | |
589 | |
590 #ifdef HAVE_X_WINDOWS | |
591 disp = getenv ("DISPLAY"); | |
592 | |
593 /* null string doesn't count as a display */ | |
594 if (disp && disp[0]) | |
595 display_use = "x"; | |
596 | |
597 /* Do not set display_arg here. It is only to be set if the display | |
598 was specified on the command line. */ | |
599 #endif | |
600 } | |
601 #endif /* HAVE_WINDOW_SYSTEM */ | |
602 | |
603 noninteractive1 = noninteractive; | |
604 | |
605 /****** Now initialize everything *******/ | |
606 | |
607 /* First, do really basic environment initialization -- catching signals | |
608 and the like. These functions have no dependence on any part of | |
609 the Lisp engine and need to be done both at dump time and at run time. */ | |
610 | |
611 init_signals_very_early (); | |
612 init_data_very_early (); /* Catch math errors. */ | |
613 #ifdef LISP_FLOAT_TYPE | |
614 init_floatfns_very_early (); /* Catch floating-point math errors. */ | |
615 #endif | |
616 init_process_times_very_early (); /* Initialize our process timers. | |
617 As early as possible, of course, | |
618 so we can be fairly accurate. */ | |
619 init_intl_very_early (); /* set up the locale and domain for gettext and | |
620 such. */ | |
621 | |
622 /* Now initialize the Lisp engine and the like. Done only during | |
623 dumping. No dependence on anything that may be in the user's | |
624 environment when the dumped XEmacs is run. | |
625 | |
626 We try to do things in an order that minimizes the non-obvious | |
627 dependencies between functions. */ | |
628 | |
629 if (!initialized) | |
630 { | |
631 /* Initialize things so that new Lisp objects | |
632 can be created and objects can be staticpro'd. | |
633 Must be basically the very first thing done | |
634 because pretty much all of the initialization | |
635 routines below create new objects. */ | |
636 init_alloc_once_early (); | |
637 | |
638 /* Initialize Qnil, Qt, Qunbound, and the | |
639 obarray. After this, symbols can be | |
640 interned. This depends on init_alloc_once(). */ | |
641 init_symbols_once_early (); | |
642 | |
643 /* Declare the basic symbols pertaining to errors, | |
644 So that deferror() can be called. */ | |
645 init_errors_once_early (); | |
646 | |
647 /* Make sure that opaque pointers can be created. */ | |
648 init_opaque_once_early (); | |
649 | |
650 /* Now declare all the symbols and define all the Lisp primitives. | |
651 | |
652 The *only* thing that the syms_of_*() functions are allowed to do | |
653 is call one of the following three functions: | |
654 | |
655 defsymbol() | |
656 defsubr() | |
657 deferror() | |
658 defkeyword() | |
659 | |
660 Order does not matter in these functions. | |
661 */ | |
662 | |
663 syms_of_abbrev (); | |
664 syms_of_alloc (); | |
665 syms_of_buffer (); | |
666 syms_of_bytecode (); | |
667 syms_of_callint (); | |
668 syms_of_callproc (); | |
669 syms_of_casefiddle (); | |
670 syms_of_casetab (); | |
671 syms_of_cmdloop (); | |
672 syms_of_cmds (); | |
673 syms_of_console (); | |
674 syms_of_data (); | |
675 #ifdef DEBUG_XEMACS | |
676 syms_of_debug (); | |
677 #endif /* DEBUG_XEMACS */ | |
678 syms_of_device (); | |
679 #ifdef HAVE_DIALOGS | |
680 syms_of_dialog (); | |
681 #endif | |
682 syms_of_dired (); | |
683 syms_of_doc (); | |
684 syms_of_editfns (); | |
685 syms_of_elhash (); | |
686 syms_of_emacs (); | |
687 syms_of_eval (); | |
688 syms_of_event_stream (); | |
689 syms_of_events (); | |
690 syms_of_extents (); | |
691 syms_of_faces (); | |
692 syms_of_fileio (); | |
693 #ifdef CLASH_DETECTION | |
694 syms_of_filelock (); | |
695 #endif /* CLASH_DETECTION */ | |
696 syms_of_floatfns (); | |
697 syms_of_fns (); | |
698 syms_of_font_lock (); | |
699 syms_of_frame (); | |
700 syms_of_general (); | |
701 syms_of_glyphs (); | |
702 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS) | |
703 syms_of_gui (); | |
704 #endif | |
705 syms_of_indent (); | |
706 syms_of_intl (); | |
707 syms_of_keymap (); | |
708 syms_of_lread (); | |
709 syms_of_macros (); | |
710 syms_of_marker (); | |
711 syms_of_md5 (); | |
712 #ifdef HAVE_DATABASE | |
713 syms_of_dbm (); | |
714 #endif | |
715 #ifdef HAVE_MENUBARS | |
716 syms_of_menubar (); | |
717 #endif | |
718 syms_of_minibuf (); | |
719 #ifdef MOCKLISP_SUPPORT | |
720 syms_of_mocklisp (); | |
721 #endif | |
722 syms_of_objects (); | |
723 syms_of_print (); | |
724 #if !defined (NO_SUBPROCESSES) | |
725 syms_of_process (); | |
726 #endif | |
727 syms_of_profile (); | |
728 #if defined (HAVE_MMAP) && defined (REL_ALLOC) | |
729 syms_of_ralloc (); | |
730 #endif /* HAVE_MMAP && REL_ALLOC */ | |
731 syms_of_rangetab (); | |
732 syms_of_redisplay (); | |
733 syms_of_search (); | |
734 syms_of_signal (); | |
735 syms_of_sound (); | |
736 syms_of_specifier (); | |
737 syms_of_symbols (); | |
738 syms_of_syntax (); | |
739 #ifdef HAVE_SCROLLBARS | |
740 syms_of_scrollbar (); | |
741 #endif | |
742 #ifdef HAVE_TOOLBARS | |
743 syms_of_toolbar (); | |
744 #endif | |
745 syms_of_undo (); | |
746 syms_of_window (); | |
747 #ifdef HAVE_TTY | |
748 syms_of_console_tty (); | |
749 syms_of_device_tty (); | |
750 syms_of_objects_tty (); | |
751 #endif | |
752 #ifdef HAVE_X_WINDOWS | |
753 syms_of_device_x (); | |
754 #ifdef HAVE_DIALOGS | |
755 syms_of_dialog_x (); | |
756 #endif | |
757 syms_of_event_Xt (); | |
758 syms_of_frame_x (); | |
759 syms_of_glyphs_x (); | |
760 syms_of_objects_x (); | |
761 #ifdef HAVE_MENUBARS | |
762 syms_of_menubar_x (); | |
763 #endif | |
764 syms_of_xselect (); | |
765 #ifdef EPOCH | |
766 syms_of_epoch (); | |
767 #endif | |
768 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS) | |
769 syms_of_gui_x (); | |
770 #endif | |
771 #endif /* HAVE_X_WINDOWS */ | |
772 | |
773 #ifdef HAVE_NEXTSTEP | |
774 syms_of_device_ns (); | |
775 syms_of_frame_ns (); | |
776 syms_of_glyphs_ns (); | |
777 syms_of_objects_ns (); | |
778 #ifdef HAVE_MENUBARS | |
779 syms_of_menubar_ns (); | |
780 #endif | |
781 syms_of_nsselect (); | |
782 #ifdef HAVE_SCROLLBARS | |
783 syms_of_scrollbar_ns (); | |
784 #endif | |
785 #endif /* HAVE_NEXTSTEP */ | |
786 | |
787 #ifdef SYMS_SYSTEM | |
788 SYMS_SYSTEM; | |
789 #endif | |
790 | |
791 #ifdef SYMS_MACHINE | |
792 SYMS_MACHINE; | |
793 #endif | |
794 | |
795 #ifdef EMACS_BTL | |
796 syms_of_btl (); | |
797 #endif | |
798 | |
799 #ifdef ENERGIZE | |
800 syms_of_energize (); | |
801 #endif | |
802 | |
803 #if defined (GNU_MALLOC) && defined (ERROR_CHECK_MALLOC) | |
804 #if 0 | |
805 syms_of_free_hook (); | |
806 #endif | |
807 #endif | |
808 | |
809 #ifdef TOOLTALK | |
810 syms_of_tooltalk (); | |
811 #endif | |
812 | |
813 #ifdef SUNPRO | |
814 syms_of_sunpro (); | |
815 #endif | |
816 | |
817 /* Now create the subtypes for the types that have them. | |
818 We do this before the vars_*() because more symbols | |
819 may get initialized here. */ | |
820 | |
821 /* Now initialize the console types and associated symbols. | |
822 Other than the first function below, the functions may | |
823 make exactly the following function/macro calls: | |
824 | |
825 INITIALIZE_CONSOLE_TYPE() | |
826 CONSOLE_HAS_METHOD() | |
827 | |
828 For any given console type, the former macro must be called | |
829 before the any calls to the latter macro. */ | |
830 | |
831 console_type_create (); | |
832 | |
833 console_type_create_stream (); | |
834 | |
835 #ifdef HAVE_TTY | |
836 console_type_create_tty (); | |
837 console_type_create_device_tty (); | |
838 console_type_create_frame_tty (); | |
839 console_type_create_objects_tty (); | |
840 console_type_create_redisplay_tty (); | |
841 #endif | |
842 | |
843 #ifdef HAVE_X_WINDOWS | |
844 console_type_create_x (); | |
845 console_type_create_device_x (); | |
846 console_type_create_frame_x (); | |
847 console_type_create_glyphs_x (); | |
848 #ifdef HAVE_MENUBARS | |
849 console_type_create_menubar_x (); | |
850 #endif | |
851 console_type_create_objects_x (); | |
852 console_type_create_redisplay_x (); | |
853 #ifdef HAVE_SCROLLBARS | |
854 console_type_create_scrollbar_x (); | |
855 #endif | |
856 #ifdef HAVE_TOOLBARS | |
857 console_type_create_toolbar_x (); | |
858 #endif | |
859 #endif /* HAVE_X_WINDOWS */ | |
860 | |
861 /* Now initialize the specifier types and associated symbols. | |
862 Other than the first function below, the functions may | |
863 make exactly the following function/macro calls: | |
864 | |
865 INITIALIZE_SPECIFIER_TYPE() | |
866 SPECIFIER_HAS_METHOD() | |
867 | |
868 For any given specifier type, the former macro must be called | |
869 before the any calls to the latter macro. */ | |
870 | |
871 specifier_type_create (); | |
872 | |
873 specifier_type_create_image (); | |
874 specifier_type_create_objects (); | |
875 #ifdef HAVE_TOOLBARS | |
876 specifier_type_create_toolbar (); | |
877 #endif | |
878 | |
879 /* Now initialize the structure types and associated symbols. | |
880 Other than the first function below, the functions may | |
881 make exactly the following function/macro calls: | |
882 | |
883 define_structure_type() | |
884 define_structure_type_keyword() | |
885 | |
886 */ | |
887 | |
888 structure_type_create (); | |
889 | |
890 structure_type_create_faces (); | |
891 structure_type_create_rangetab (); | |
892 | |
893 /* Now initialize the image instantiator formats and associated symbols. | |
894 Other than the first function below, the functions may | |
895 make exactly the following function/macro calls: | |
896 | |
897 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT() | |
898 IIFORMAT_HAS_METHOD() | |
899 IIFORMAT_VALID_KEYWORD() | |
900 | |
901 For any given image instantiator format, the first macro must be | |
902 called before the any calls to the other macros. */ | |
903 | |
904 image_instantiator_format_create (); | |
905 #ifdef HAVE_X_WINDOWS | |
906 image_instantiator_format_create_glyphs_x (); | |
907 #endif /* HAVE_X_WINDOWS */ | |
908 | |
909 /* Now initialize the lstream types and associated symbols. | |
910 Other than the first function below, the functions may | |
911 make exactly the following function/macro calls: | |
912 | |
913 LSTREAM_HAS_METHOD() | |
914 | |
915 */ | |
916 | |
917 lstream_type_create (); | |
918 lstream_type_create_print (); | |
919 | |
920 /* Now initialize most variables. | |
921 | |
922 These functions may do exactly the following: | |
923 | |
924 DEFVAR_INT() | |
925 DEFVAR_LISP() | |
926 DEFVAR_BOOL() | |
927 DEFER_GETTEXT() | |
928 Dynarr_*() | |
929 Blocktype_*() | |
930 staticpro() | |
931 Fprovide(symbol) | |
932 intern() | |
933 pure_put() | |
934 xmalloc() | |
935 defsymbol(), if it's absolutely necessary and you're sure that | |
936 the symbol isn't referenced anywhere else in the initialization | |
937 code | |
938 Fset() on a symbol that is unbound | |
939 assigning a symbol or constant value to a variable | |
940 using a global variable that has been initialized | |
941 earlier on in the same function | |
942 | |
943 Any of the object-creating functions on alloc.c: e.g. | |
944 | |
945 make_pure_*() | |
946 Fpurecopy() | |
947 make_string() | |
948 build_string() | |
949 make_vector() | |
950 make_int() | |
951 make_extent() | |
952 alloc_lcrecord() | |
953 Fcons() | |
954 listN() | |
955 make_opaque_ptr() | |
956 make_opaque_long() | |
957 | |
958 perhaps a few others. | |
959 */ | |
960 | |
961 /* Now allow Fprovide() statements to be made. */ | |
962 init_provide_once (); | |
963 | |
964 vars_of_abbrev (); | |
965 vars_of_alloc (); | |
966 vars_of_buffer (); | |
967 vars_of_bytecode (); | |
968 vars_of_callint (); | |
969 vars_of_callproc (); | |
970 vars_of_cmdloop (); | |
971 vars_of_cmds (); | |
972 vars_of_console (); | |
973 vars_of_data (); | |
974 #ifdef DEBUG_XEMACS | |
975 vars_of_debug (); | |
976 #endif | |
977 vars_of_console_stream (); | |
978 vars_of_device (); | |
979 #ifdef HAVE_DIALOGS | |
980 vars_of_dialog (); | |
981 #endif | |
982 vars_of_dired (); | |
983 vars_of_doc (); | |
984 vars_of_editfns (); | |
985 vars_of_elhash (); | |
986 vars_of_emacs (); | |
987 vars_of_eval (); | |
988 vars_of_event_stream (); | |
989 vars_of_events (); | |
990 vars_of_extents (); | |
991 vars_of_faces (); | |
992 vars_of_fileio (); | |
993 #ifdef CLASH_DETECTION | |
994 vars_of_filelock (); | |
995 #endif | |
996 vars_of_floatfns (); | |
997 vars_of_font_lock (); | |
998 vars_of_frame (); | |
999 vars_of_glyphs (); | |
1000 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS) | |
1001 vars_of_gui (); | |
1002 #endif | |
1003 vars_of_indent (); | |
1004 vars_of_insdel (); | |
1005 vars_of_intl (); | |
1006 vars_of_keymap (); | |
1007 vars_of_lread (); | |
1008 vars_of_lstream (); | |
1009 vars_of_macros (); | |
1010 vars_of_md5 (); | |
1011 #ifdef HAVE_DATABASE | |
1012 vars_of_dbm (); | |
1013 #endif | |
1014 #ifdef HAVE_MENUBARS | |
1015 vars_of_menubar (); | |
1016 #endif | |
1017 vars_of_minibuf (); | |
1018 #ifdef MOCKLISP_SUPPORT | |
1019 vars_of_mocklisp (); | |
1020 #endif | |
1021 vars_of_objects (); | |
1022 vars_of_print (); | |
1023 #ifndef NO_SUBPROCESSES | |
1024 vars_of_process (); | |
1025 #endif | |
1026 vars_of_profile (); | |
1027 #if defined (HAVE_MMAP) && defined (REL_ALLOC) | |
1028 vars_of_ralloc (); | |
1029 #endif /* HAVE_MMAP && REL_ALLOC */ | |
1030 vars_of_redisplay (); | |
1031 #ifdef HAVE_SCROLLBARS | |
1032 vars_of_scrollbar (); | |
1033 #endif | |
1034 vars_of_search (); | |
1035 vars_of_sound (); | |
1036 vars_of_specifier (); | |
1037 vars_of_symbols (); | |
1038 vars_of_syntax (); | |
1039 #ifdef HAVE_TOOLBARS | |
1040 vars_of_toolbar (); | |
1041 #endif | |
1042 vars_of_undo (); | |
1043 vars_of_window (); | |
1044 | |
1045 #ifdef HAVE_TTY | |
1046 vars_of_console_tty (); | |
1047 vars_of_event_tty (); | |
1048 vars_of_frame_tty (); | |
1049 vars_of_objects_tty (); | |
1050 #endif | |
1051 | |
1052 #ifdef HAVE_X_WINDOWS | |
1053 vars_of_device_x (); | |
1054 #ifdef HAVE_DIALOGS | |
1055 vars_of_dialog_x (); | |
1056 #endif | |
1057 vars_of_event_Xt (); | |
1058 vars_of_frame_x (); | |
1059 vars_of_glyphs_x (); | |
1060 #ifdef HAVE_MENUBARS | |
1061 vars_of_menubar_x (); | |
1062 #endif | |
1063 vars_of_objects_x (); | |
1064 vars_of_xselect (); | |
1065 #ifdef EPOCH | |
1066 vars_of_epoch (); | |
1067 #endif | |
1068 #ifdef HAVE_SCROLLBARS | |
1069 vars_of_scrollbar_x (); | |
1070 #endif | |
1071 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS) | |
1072 vars_of_gui_x (); | |
1073 #endif | |
1074 #endif | |
1075 | |
1076 #ifdef ENERGIZE | |
1077 vars_of_energize (); | |
1078 #endif | |
1079 | |
1080 #ifdef TOOLTALK | |
1081 vars_of_tooltalk (); | |
1082 #endif | |
1083 | |
1084 #ifdef SUNPRO | |
1085 vars_of_sunpro (); | |
1086 #endif | |
1087 | |
1088 /* Now initialize any specifier variables. We do this later | |
1089 because it has some dependence on the vars initialized | |
1090 above. | |
1091 | |
1092 These functions should *only* initialize specifier variables, | |
1093 and may make use of the following functions/macros in addition | |
1094 to the ones listed above: | |
1095 | |
1096 DEFVAR_SPECIFIER() | |
1097 Fmake_specifier() | |
1098 set_specifier_fallback() | |
1099 set_specifier_caching() | |
1100 */ | |
1101 | |
1102 specifier_vars_of_glyphs (); | |
1103 #ifdef HAVE_MENUBARS | |
1104 specifier_vars_of_menubar (); | |
1105 #endif | |
1106 specifier_vars_of_redisplay (); | |
1107 #ifdef HAVE_SCROLLBARS | |
1108 specifier_vars_of_scrollbar (); | |
1109 #endif | |
1110 #ifdef HAVE_TOOLBARS | |
1111 specifier_vars_of_toolbar (); | |
1112 #endif | |
1113 specifier_vars_of_window (); | |
1114 | |
1115 /* Now comes all the rest of the variables that couldn't | |
1116 be handled above. There may be dependencies on variables | |
1117 initialized above, and dependencies between one complex_vars_() | |
1118 function and another. */ | |
1119 | |
1120 /* Calls Fmake_range_table(). */ | |
1121 complex_vars_of_regex (); | |
1122 /* Calls Fmake_range_table(). */ | |
1123 complex_vars_of_search (); | |
1124 | |
1125 /* Calls Fmake_hashtable(). */ | |
1126 complex_vars_of_event_stream (); | |
1127 /* Calls make_lisp_hashtable(). */ | |
1128 complex_vars_of_extents (); | |
1129 | |
1130 /* Depends on hashtables and specifiers. */ | |
1131 complex_vars_of_faces (); | |
1132 | |
1133 /* This calls allocate_glyph(), which creates specifiers | |
1134 and also relies on a variable (Vthe_nothing_vector) initialized | |
1135 above. */ | |
1136 complex_vars_of_glyphs (); | |
1137 | |
1138 /* This relies on the glyphs just created in the previous function, | |
1139 and calls Fadd_spec_to_specifier(), which relies on various | |
1140 variables initialized above. */ | |
1141 #ifdef HAVE_X_WINDOWS | |
1142 complex_vars_of_glyphs_x (); | |
1143 #endif | |
1144 | |
1145 /* This calls Fmake_glyph_internal(). */ | |
1146 complex_vars_of_alloc (); | |
1147 | |
1148 /* This calls Fmake_glyph_internal(). */ | |
1149 #ifdef HAVE_MENUBARS | |
1150 complex_vars_of_menubar (); | |
1151 #endif | |
1152 | |
1153 /* This calls Fmake_glyph_internal(). */ | |
1154 #ifdef HAVE_SCROLLBARS | |
1155 complex_vars_of_scrollbar (); | |
1156 #endif | |
1157 | |
1158 /* This calls allocate_glyph(). */ | |
1159 complex_vars_of_frame (); | |
1160 | |
1161 /* Depends on hashtables. */ | |
1162 #ifdef ENERGIZE | |
1163 complex_vars_of_energize (); | |
1164 #endif | |
1165 | |
1166 /* This calls set_string_char(), which (under Mule) depends on the | |
1167 charsets being initialized. */ | |
1168 complex_vars_of_casetab (); | |
1169 | |
1170 /* This calls Fcopy_syntax_table(), which relies on char tables. */ | |
1171 complex_vars_of_syntax (); | |
1172 | |
1173 /* This initializes buffer-local variables, sets things up so | |
1174 that buffers can be created, and creates a couple of basic | |
1175 buffers. This depends on Vstandard_syntax_table and | |
1176 Vstandard_category_table (initialized in the previous | |
1177 functions), as well as a whole horde of variables that may | |
1178 have been initialized above. */ | |
1179 complex_vars_of_buffer (); | |
1180 | |
1181 /* This initializes console-local variables. */ | |
1182 complex_vars_of_console (); | |
1183 | |
1184 /* This creates a couple more buffers, and depends on the | |
1185 previous function. */ | |
1186 complex_vars_of_minibuf (); | |
1187 | |
1188 /* These two might call Ffile_name_as_directory(), which | |
1189 might depend on all sorts of things; I'm not sure. */ | |
1190 complex_vars_of_callproc (); | |
1191 #ifdef CLASH_DETECTION | |
1192 complex_vars_of_filelock (); | |
1193 #endif /* CLASH_DETECTION */ | |
1194 | |
1195 /* This creates a couple of basic keymaps and depends on Lisp | |
1196 hashtables and Ffset() (both of which depend on some variables | |
1197 initialized in the vars_of_*() section) and possibly other | |
1198 stuff. */ | |
1199 complex_vars_of_keymap (); | |
1200 | |
1201 if (always_gc) /* purification debugging hack */ | |
1202 garbage_collect_1 (); | |
1203 } | |
1204 | |
1205 /* CONGRATULATIONS!!! We have successfully initialized the Lisp | |
1206 engine. */ | |
1207 | |
1208 if (initialized) | |
1209 { | |
1210 /* Stuff that needs to be reset at run time. Order below should | |
1211 not matter. */ | |
1212 reinit_alloc (); | |
1213 reinit_eval (); | |
1214 } | |
1215 | |
1216 /* Now do further initialization/setup of stuff that is not needed by the | |
1217 syms_of_() routines. This involves stuff that only is enabled in | |
1218 an interactive run (redisplay, user input, etc.) and stuff that is | |
1219 not needed until we start loading Lisp code (the reader). A lot | |
1220 of this stuff involves querying the current environment and needs | |
1221 to be done both at dump time and at run time. */ | |
1222 | |
1223 init_callproc (); /* Set up the process environment (so that egetenv | |
1224 works), the basic directory variables | |
1225 (exec-directory and so on), and stuff | |
1226 related to subprocesses. This should be | |
1227 first because many of the functions below | |
1228 call egetenv() to get environment variables. */ | |
1229 init_lread (); /* Set up the Lisp reader. */ | |
1230 #ifdef MSDOS | |
1231 /* Call early 'cause init_environment needs it. */ | |
1232 init_dosfns (); | |
1233 /* Set defaults for several environment variables. */ | |
1234 init_environment (argc, argv, skip_args); | |
1235 #endif | |
1236 init_cmdargs (argc, argv, skip_args); /* Create list Vcommand_line_args */ | |
1237 init_buffer (); /* Init default directory of *scratch* buffer */ | |
1238 #ifdef VMS | |
1239 init_vms_input (); /* init_redisplay calls get_tty_device_size, | |
1240 that needs this */ | |
1241 #endif /* VMS */ | |
1242 init_redisplay (); /* Determine terminal type. | |
1243 init_sys_modes uses results */ | |
1244 #ifdef VMS | |
1245 init_vmsproc (); | |
1246 init_vmsfns (); | |
1247 #endif /* VMS */ | |
1248 init_event_stream (); /* Set up so we can get user input. */ | |
1249 init_macros (); /* set up so we can run macros. */ | |
1250 init_editfns (); /* Determine the name of the user we're running as */ | |
1251 init_xemacs_process (); /* set up for calling subprocesses */ | |
1252 #ifdef SUNPRO | |
1253 init_sunpro (); /* Set up Sunpro usage tracking */ | |
1254 #endif | |
1255 #if defined (HAVE_NATIVE_SOUND) && defined (hp9000s800) | |
1256 init_hpplay (); | |
1257 #endif | |
1258 #ifdef HAVE_TTY | |
1259 init_device_tty (); | |
1260 #endif | |
1261 #ifdef HAVE_GIF | |
1262 init_gif_err (); | |
1263 #endif | |
1264 init_console_stream (); /* Create the first console */ | |
1265 | |
1266 /* try to get the actually pathname of the exec file we are running */ | |
1267 { | |
1268 Vinvocation_name = Fcar (Vcommand_line_args); | |
1269 Vinvocation_directory = Vinvocation_name; | |
1270 | |
1271 if (!NILP (Ffile_name_directory (Vinvocation_name))) | |
1272 /* invocation-name includes a directory component -- presumably it | |
1273 is relative to cwd, not $PATH */ | |
1274 Vinvocation_directory = Fexpand_file_name (Vinvocation_name, | |
1275 Qnil); | |
1276 else | |
1277 locate_file (Vexec_path, Vinvocation_name, EXEC_SUFFIXES, | |
1278 &Vinvocation_directory, X_OK); | |
1279 | |
1280 if (NILP (Vinvocation_directory)) | |
1281 Vinvocation_directory = Vinvocation_name; | |
1282 | |
1283 Vinvocation_name = Ffile_name_nondirectory (Vinvocation_directory); | |
1284 Vinvocation_directory = Ffile_name_directory (Vinvocation_directory); | |
1285 } | |
1286 | |
1287 #if defined (LOCALTIME_CACHE) && defined (HAVE_TZSET) | |
1288 /* sun's localtime() has a bug. it caches the value of the time | |
1289 zone rather than looking it up every time. Since localtime() is | |
1290 called to bolt the undumping time into the undumped emacs, this | |
1291 results in localtime() ignoring the TZ environment variable. | |
1292 This flushes the new TZ value into localtime(). */ | |
1293 tzset (); | |
1294 #endif /* LOCALTIME_CACHE and TZSET */ | |
1295 | |
1296 load_me = Qnil; | |
1297 if (!initialized) | |
1298 { | |
1299 /* Handle -l loadup-and-dump, args passed by Makefile. */ | |
1300 if (argc > 2 + skip_args && !strcmp (argv[1 + skip_args], "-l")) | |
1301 load_me = build_string (argv[2 + skip_args]); | |
1302 #ifdef CANNOT_DUMP | |
1303 /* Unless next switch is -nl, load "loadup.el" first thing. */ | |
1304 if (!(argc > 1 + skip_args && !strcmp (argv[1 + skip_args], "-nl"))) | |
1305 load_me = build_string ("loadup.el"); | |
1306 #endif /* CANNOT_DUMP */ | |
1307 } | |
1308 | |
1309 #ifdef QUANTIFY | |
1310 if (initialized) | |
1311 quantify_start_recording_data (); | |
1312 #endif /* QUANTIFY */ | |
1313 | |
1314 initialized = 1; | |
1315 | |
1316 /* This never returns. */ | |
1317 initial_command_loop (load_me); | |
1318 /* NOTREACHED */ | |
1319 } | |
1320 | |
1321 static JMP_BUF run_temacs_catch; | |
1322 | |
1323 static int run_temacs_argc; | |
1324 static char **run_temacs_argv; | |
1325 static char *run_temacs_args; | |
1326 static int run_temacs_argv_size; | |
1327 static int run_temacs_args_size; | |
1328 | |
1329 extern int gc_in_progress; | |
1330 | |
1331 DEFUN ("running-temacs-p", | |
1332 Frunning_temacs_p, Srunning_temacs_p, 0, 0, 0 /* | |
1333 True if running temacs. This means we are in the dumping stage. | |
1334 This is false during normal execution of the `xemacs' program, and | |
1335 becomes false once `run-emacs-from-temacs' is run. | |
1336 */ ) | |
1337 () | |
1338 { | |
1339 return run_temacs_argc >= 0 ? Qt : Qnil; | |
1340 } | |
1341 | |
1342 DEFUN ("run-emacs-from-temacs", | |
1343 Frun_emacs_from_temacs, Srun_emacs_from_temacs, 0, MANY, 0 /* | |
1344 Do not call this. It will reinitialize your XEmacs. You'll be sorry. | |
1345 */ ) | |
1346 /* If this function is called from startup.el, it will be possible to run | |
1347 temacs as an editor using 'temacs -batch -l loadup.el run-temacs', instead | |
1348 of having to dump an emacs and then run that (when debugging emacs itself, | |
1349 this can be much faster). [Actually, the speed difference isn't that | |
1350 much as long as your filesystem is local, and you don't end up with | |
1351 a dumped version in case you want to rerun it. This function is most | |
1352 useful when used as part of the `make all-elc' command. --ben] | |
1353 This will \"restart\" emacs with the specified command-line arguments. | |
1354 */ | |
1355 (nargs, args) | |
1356 int nargs; | |
1357 Lisp_Object *args; | |
1358 { | |
1359 int ac; | |
1360 Extbyte *wampum; | |
1361 int namesize; | |
1362 int total_len; | |
1363 Lisp_Object orig_invoc_name = Fcar (Vcommand_line_args); | |
1364 Extbyte **wampum_all = (Extbyte **) alloca (nargs * sizeof (Extbyte *)); | |
1365 int *wampum_all_len = (int *) alloca (nargs * sizeof (int)); | |
1366 | |
1367 assert (!gc_in_progress); | |
1368 | |
1369 if (run_temacs_argc < 0) | |
1370 error ("I've lost my temacs-hood."); | |
1371 | |
1372 /* Need to convert the orig_invoc_name and all of the arguments | |
1373 to external format. */ | |
1374 | |
1375 GET_STRING_EXT_DATA_ALLOCA (orig_invoc_name, FORMAT_OS, wampum, | |
1376 namesize); | |
1377 namesize++; | |
1378 | |
1379 for (ac = 0, total_len = namesize; ac < nargs; ac++) | |
1380 { | |
1381 CHECK_STRING (args[ac]); | |
1382 GET_STRING_EXT_DATA_ALLOCA (args[ac], FORMAT_OS, | |
1383 wampum_all[ac], | |
1384 wampum_all_len[ac]); | |
1385 wampum_all_len[ac]++; | |
1386 total_len += wampum_all_len[ac]; | |
1387 } | |
1388 DO_REALLOC (run_temacs_args, run_temacs_args_size, total_len, char); | |
1389 DO_REALLOC (run_temacs_argv, run_temacs_argv_size, nargs+1, char *); | |
1390 | |
1391 memcpy (run_temacs_args, wampum, namesize); | |
1392 run_temacs_argv [0] = run_temacs_args; | |
1393 for (ac = 0; ac < nargs; ac++) | |
1394 { | |
1395 memcpy (run_temacs_args + namesize, | |
1396 wampum_all[ac], wampum_all_len[ac]); | |
1397 run_temacs_argv [ac + 1] = run_temacs_args + namesize; | |
1398 namesize += wampum_all_len[ac]; | |
1399 } | |
1400 run_temacs_argv [nargs + 1] = 0; | |
1401 catchlist = NULL; /* Important! Otherwise free_cons() calls in | |
1402 condition_case_unwind() may lead to GC death. */ | |
1403 unbind_to (0, Qnil); /* this closes loadup.el */ | |
1404 purify_flag = 0; | |
1405 run_temacs_argc = nargs + 1; | |
1406 report_pure_usage (1, 0); | |
1407 LONGJMP (run_temacs_catch, 1); | |
1408 return Qnil; /* not reached; warning suppression */ | |
1409 } | |
1410 | |
1411 /* ARGSUSED */ | |
1412 DOESNT_RETURN | |
1413 main (int argc, char **argv, char **envp) | |
1414 { | |
1415 #ifdef QUANTIFY | |
1416 quantify_stop_recording_data (); | |
1417 quantify_clear_data (); | |
1418 #endif /* QUANTIFY */ | |
1419 | |
1420 suppress_early_backtrace = 0; | |
1421 lim_data = 0; /* force reinitialization of this variable */ | |
1422 | |
1423 if (sizeof (Lisp_Object) != sizeof (void *)) | |
1424 abort (); /* Lisp_Object must fit in a word; | |
1425 check VALBITS and GCTYPEBITS */ | |
1426 if (!initialized) | |
1427 { | |
1428 run_temacs_argc = 0; | |
1429 if (! SETJMP (run_temacs_catch)) | |
1430 main_1 (argc, argv, envp); | |
1431 /* run-emacs-from-temacs called */ | |
1432 argc = run_temacs_argc; | |
1433 run_temacs_argc = 0; | |
1434 argv = run_temacs_argv; | |
1435 #ifdef _SCO_DS | |
1436 /* | |
1437 This makes absolutely no sense to anyone involved. | |
1438 There are several people using this stuff. We've | |
1439 compared versions on everything we can think of. We | |
1440 can find no difference. However, on both my systems | |
1441 environ is a plain old global variable initialized to | |
1442 zero. _environ is the one that contains pointers to | |
1443 the actual environment. | |
1444 Since we can't figure out the difference (and we're | |
1445 hours away from a release), this takes a very cowardly | |
1446 approach and is bracketed with both a system specific | |
1447 preprocessor test and a runtime "do you have this | |
1448 problem" test | |
1449 06/20/96 robertl@dgii.com | |
1450 */ | |
1451 { | |
1452 extern char *_environ ; | |
1453 if ((unsigned) environ == 0) | |
1454 environ=_environ; | |
1455 } | |
1456 #endif | |
1457 envp = environ; | |
1458 } | |
1459 run_temacs_argc = -1; | |
1460 | |
1461 main_1 (argc, argv, envp); | |
1462 } | |
1463 | |
1464 | |
1465 DEFUN ("kill-emacs", Fkill_emacs, Skill_emacs, 0, 1, "P" /* | |
1466 Exit the XEmacs job and kill it. Ask for confirmation, without argument. | |
1467 If ARG is an integer, return ARG as the exit program code. | |
1468 If ARG is a string, stuff it as keyboard input. | |
1469 | |
1470 The value of `kill-emacs-hook', if not void, | |
1471 is a list of functions (of no args), | |
1472 all of which are called before XEmacs is actually killed. | |
1473 */ ) | |
1474 (arg) | |
1475 Lisp_Object arg; | |
1476 { | |
1477 /* This function can GC */ | |
1478 struct gcpro gcpro1; | |
1479 | |
1480 GCPRO1 (arg); | |
1481 | |
1482 if (feof (stdin)) | |
1483 arg = Qt; | |
1484 | |
1485 if (!preparing_for_armageddon && !noninteractive) | |
1486 run_hook (Qkill_emacs_hook); | |
1487 | |
1488 /* make sure no quitting from now on!! */ | |
1489 dont_check_for_quit = 1; | |
1490 Vinhibit_quit = Qt; | |
1491 | |
1492 if (!preparing_for_armageddon) | |
1493 { | |
1494 Lisp_Object concons; | |
1495 | |
1496 /* Normally, go ahead and delete all the consoles now. | |
1497 Some unmentionably lame window systems (MS Wwwww...... eek, | |
1498 I can't even say it) don't properly clean up after themselves, | |
1499 and even for those that do, it might be cleaner this way. | |
1500 If we're going down, however, we don't do this (might | |
1501 be too dangerous), and if we get a crash somewhere within | |
1502 this loop, we'll still autosave and won't try this again. */ | |
1503 CONSOLE_LOOP (concons) | |
1504 delete_console_internal (XCONSOLE (XCAR (concons)), 1, 1, 0); | |
1505 } | |
1506 | |
1507 UNGCPRO; | |
1508 | |
1509 shut_down_emacs (0, ((STRINGP (arg)) ? arg : Qnil)); | |
1510 | |
1511 exit ((INTP (arg)) ? XINT (arg) | |
1512 #ifdef VMS | |
1513 : 1 | |
1514 #else | |
1515 : 0 | |
1516 #endif | |
1517 ); | |
1518 /* NOTREACHED */ | |
1519 return Qnil; /* I'm sick of the compiler warning */ | |
1520 } | |
1521 | |
1522 /* Perform an orderly shutdown of XEmacs. Autosave any modified | |
1523 buffers, kill any child processes, clean up the terminal modes (if | |
1524 we're in the foreground), and other stuff like that. Don't perform | |
1525 any redisplay; this may be called when XEmacs is shutting down in | |
1526 the background, or after its X connection has died. | |
1527 | |
1528 If SIG is a signal number, print a message for it. | |
1529 | |
1530 This is called by fatal signal handlers, X protocol error handlers, | |
1531 and Fkill_emacs. */ | |
1532 static void | |
1533 shut_down_emacs (int sig, Lisp_Object stuff) | |
1534 { | |
1535 /* This function can GC */ | |
1536 /* Prevent running of hooks and other non-essential stuff | |
1537 from now on. */ | |
1538 preparing_for_armageddon = 1; | |
1539 | |
1540 /* In case frames or windows are screwed up, avoid assertion | |
1541 failures here */ | |
1542 Vinhibit_quit = Qt; | |
1543 | |
1544 #ifdef QUANTIFY | |
1545 quantify_stop_recording_data (); | |
1546 #endif /* QUANTIFY */ | |
1547 | |
1548 /* This is absolutely the most important thing to do, so make sure | |
1549 we do it now, before anything else. We might have crashed and | |
1550 be in a weird inconsistent state, and potentially anything could | |
1551 set off another protection fault and cause us to bail out | |
1552 immediately. */ | |
1553 Fdo_auto_save (Qt, Qnil); /* do this before anything hazardous */ | |
1554 | |
1555 fflush (stdout); | |
1556 reset_all_consoles (); | |
1557 if (sig && sig != SIGTERM) | |
1558 { | |
1559 stderr_out ("\nFatal error (%d).\n", sig); | |
1560 stderr_out | |
1561 ("Your files have been auto-saved.\n" | |
1562 "Use `M-x recover-session' to recover them.\n" | |
1563 "\n" | |
1564 "Please report this bug to the address `crashes@xemacs.org'.\n" | |
1565 "If at all possible, *please* try to obtain a C stack backtrace;\n" | |
1566 "it will help us immensely in determining what went wrong.\n" | |
1567 "To do this, locate the core file that was produced as a result\n" | |
1568 "of this crash (it's usually called `core' and is located in the\n" | |
1569 "directory in which you started XEmacs, or maybe in your home\n" | |
1570 "directory), and type\n" | |
1571 "\n" | |
1572 " gdb "); | |
1573 { | |
1574 char *name; | |
1575 char *dir = 0; | |
1576 | |
1577 /* Now try to determine the actual path to the executable, | |
1578 to try to make the backtrace-determination process as foolproof | |
1579 as possible. */ | |
1580 if (GC_STRINGP (Vinvocation_name)) | |
1581 name = (char *) string_data (XSTRING (Vinvocation_name)); | |
1582 else | |
1583 name = "xemacs"; | |
1584 if (GC_STRINGP (Vinvocation_directory)) | |
1585 dir = (char *) string_data (XSTRING (Vinvocation_directory)); | |
1586 if (!dir || dir[0] != '/') | |
1587 stderr_out ("`which %s`", name); | |
1588 else if (dir[strlen (dir) - 1] != '/') | |
1589 stderr_out ("%s/%s", dir, name); | |
1590 else | |
1591 stderr_out ("%s%s", dir, name); | |
1592 } | |
1593 stderr_out | |
1594 (" core\n\n" | |
1595 "then type `where' when the debugger prompt comes up.\n" | |
1596 "(If you don't have GDB on your system, you might have DBX,\n" | |
1597 "or XDB, or SDB. A similar procedure should work for all of\n" | |
1598 "these. Ask your system administrator if you need more help.)\n"); | |
1599 } | |
1600 | |
1601 stuff_buffered_input (stuff); | |
1602 | |
1603 kill_buffer_processes (Qnil); | |
1604 | |
1605 #ifdef CLASH_DETECTION | |
1606 unlock_all_files (); | |
1607 #endif | |
1608 | |
1609 #ifdef TOOLTALK | |
1610 tt_session_quit (tt_default_session ()); | |
1611 tt_close (); | |
1612 #endif | |
1613 | |
1614 #ifdef VMS | |
1615 kill_vms_processes (); | |
1616 #endif | |
1617 } | |
1618 | |
1619 | |
1620 #ifndef CANNOT_DUMP | |
1621 /* Nothing like this can be implemented on an Apollo. | |
1622 What a loss! */ | |
1623 | |
1624 extern int my_edata; | |
1625 | |
1626 #ifdef HAVE_SHM | |
1627 | |
1628 DEFUN ("dump-emacs-data", Fdump_emacs_data, Sdump_emacs_data, 1, 1, 0 /* | |
1629 Dump current state of XEmacs into data file FILENAME. | |
1630 This function exists on systems that use HAVE_SHM. | |
1631 */ ) | |
1632 (intoname) | |
1633 Lisp_Object intoname; | |
1634 { | |
1635 /* This function can GC */ | |
1636 int opurify; | |
1637 struct gcpro gcpro1; | |
1638 GCPRO1 (intoname); | |
1639 | |
1640 CHECK_STRING (intoname); | |
1641 intoname = Fexpand_file_name (intoname, Qnil); | |
1642 | |
1643 opurify = purify_flag; | |
1644 purify_flag = 0; | |
1645 | |
1646 fflush (stderr); | |
1647 fflush (stdout); | |
1648 | |
1649 disksave_object_finalization (); | |
1650 release_breathing_space (); | |
1651 | |
1652 /* Tell malloc where start of impure now is */ | |
1653 /* Also arrange for warnings when nearly out of space. */ | |
1654 #ifndef SYSTEM_MALLOC | |
1655 memory_warnings (&my_edata, malloc_warning); | |
1656 #endif | |
1657 UNGCPRO; | |
1658 map_out_data (string_data (XSTRING (intoname))); | |
1659 | |
1660 purify_flag = opurify; | |
1661 | |
1662 return Qnil; | |
1663 } | |
1664 | |
1665 #else /* not HAVE_SHM */ | |
1666 | |
1667 DEFUN ("dump-emacs", Fdump_emacs, Sdump_emacs, 2, 2, 0 /* | |
1668 Dump current state of XEmacs into executable file FILENAME. | |
1669 Take symbols from SYMFILE (presumably the file you executed to run XEmacs). | |
1670 This is used in the file `loadup.el' when building XEmacs. | |
1671 | |
1672 Remember to set `command-line-processed' to nil before dumping | |
1673 if you want the dumped XEmacs to process its command line | |
1674 and announce itself normally when it is run. | |
1675 */ ) | |
1676 (intoname, symname) | |
1677 Lisp_Object intoname, symname; | |
1678 { | |
1679 /* This function can GC */ | |
1680 struct gcpro gcpro1, gcpro2; | |
1681 int opurify; | |
1682 | |
1683 GCPRO2 (intoname, symname); | |
1684 | |
1685 #ifdef FREE_CHECKING | |
1686 Freally_free (Qnil); | |
1687 | |
1688 /* When we're dumping, we can't use the debugging free() */ | |
1689 | |
1690 disable_free_hook (); | |
1691 #endif | |
1692 | |
1693 CHECK_STRING (intoname); | |
1694 intoname = Fexpand_file_name (intoname, Qnil); | |
1695 if (!NILP (symname)) | |
1696 { | |
1697 CHECK_STRING (symname); | |
1698 if (string_length (XSTRING (symname)) > 0) | |
1699 symname = Fexpand_file_name (symname, Qnil); | |
1700 else | |
1701 symname = Qnil; | |
1702 } | |
1703 | |
1704 opurify = purify_flag; | |
1705 purify_flag = 0; | |
1706 | |
1707 report_pure_usage (1, 1); | |
1708 | |
1709 fflush (stderr); | |
1710 fflush (stdout); | |
1711 | |
1712 disksave_object_finalization (); | |
1713 release_breathing_space (); | |
1714 | |
1715 #ifdef VMS | |
1716 mapout_data (string_data (XSTRING (intoname))); | |
1717 #else | |
1718 /* Tell malloc where start of impure now is */ | |
1719 /* Also arrange for warnings when nearly out of space. */ | |
1720 #ifndef SYSTEM_MALLOC | |
1721 memory_warnings (&my_edata, malloc_warning); | |
1722 #endif | |
1723 | |
1724 UNGCPRO; | |
1725 | |
1726 #if defined (MSDOS) && defined (EMX) | |
1727 { | |
1728 int fd = open ((char *) string_data (XSTRING (intoname)), | |
1729 O_WRONLY|O_CREAT|O_TRUNC, S_IREAD|S_IWRITE); | |
1730 if (!fd) { | |
1731 error ("Failure operating on %s", string_data (XSTRING (intoname))); | |
1732 } else { | |
1733 _core (fd); | |
1734 close (fd); | |
1735 } | |
1736 } | |
1737 #else /* not MSDOS and EMX */ | |
1738 { | |
1739 CONST char *intoname_ext; | |
1740 CONST char *symname_ext; | |
1741 | |
1742 GET_C_STRING_FILENAME_DATA_ALLOCA (intoname, intoname_ext); | |
1743 if (STRINGP (symname)) | |
1744 GET_C_STRING_FILENAME_DATA_ALLOCA (symname, symname_ext); | |
1745 else | |
1746 symname_ext = 0; | |
1747 /* here we break our rule that the filename conversion should | |
1748 be performed at the actual time that the system call is made. | |
1749 It's a whole lot easier to do the conversion here than to | |
1750 modify all the unexec routines to ensure that filename | |
1751 conversion is applied everywhere. Don't worry about memory | |
1752 leakage because this call only happens once. */ | |
1753 unexec ((char *) intoname_ext, (char *) symname_ext, | |
1754 (unsigned int) &my_edata, | |
1755 0, 0); | |
1756 } | |
1757 #endif /* not MSDOS and EMX */ | |
1758 #endif /* not VMS */ | |
1759 | |
1760 purify_flag = opurify; | |
1761 | |
1762 return Qnil; | |
1763 } | |
1764 | |
1765 #endif /* not HAVE_SHM */ | |
1766 | |
1767 #endif /* not CANNOT_DUMP */ | |
1768 | |
1769 #ifndef SEPCHAR | |
1770 #define SEPCHAR ':' | |
1771 #endif | |
1772 | |
1773 Lisp_Object | |
1774 decode_env_path (CONST char *evarname, CONST char *defalt) | |
1775 { | |
1776 REGISTER CONST char *path = 0; | |
1777 REGISTER CONST char *p; | |
1778 Lisp_Object lpath = Qnil; | |
1779 | |
1780 if (evarname) | |
1781 path = (char *) egetenv (evarname); | |
1782 if (!path) | |
1783 path = defalt; | |
1784 if (!path) | |
1785 return (Qnil); | |
1786 | |
1787 #if defined (MSDOS) || defined (WIN32) | |
1788 dostounix_filename (path); | |
1789 #endif | |
1790 | |
1791 while (1) | |
1792 { | |
1793 p = strchr (path, SEPCHAR); | |
1794 if (!p) p = path + strlen (path); | |
1795 lpath = Fcons (((p != path) | |
1796 ? make_string ((CONST Bufbyte *) path, p - path) | |
1797 : Qnil), | |
1798 lpath); | |
1799 if (*p) | |
1800 path = p + 1; | |
1801 else | |
1802 break; | |
1803 } | |
1804 return Fnreverse (lpath); | |
1805 } | |
1806 | |
1807 DEFUN ("noninteractive", Fnoninteractive, Snoninteractive, 0, 0, 0 /* | |
1808 Non-nil return value means XEmacs is running without interactive terminal. | |
1809 */ ) | |
1810 () | |
1811 { | |
1812 return ((noninteractive) ? Qt : Qnil); | |
1813 } | |
1814 | |
1815 /* This flag is useful to define if you're under a debugger; this way, you | |
1816 can put a breakpoint of assert_failed() and debug multiple problems | |
1817 in one session without having to recompile. */ | |
1818 /* #define ASSERTIONS_DONT_ABORT */ | |
1819 | |
1820 #ifdef USE_ASSERTIONS | |
1821 /* This highly dubious kludge ... shut up Jamie, I'm tired of your slagging. */ | |
1822 | |
1823 DOESNT_RETURN | |
1824 assert_failed (CONST char *file, int line, CONST char *expr) | |
1825 { | |
1826 stderr_out ("Fatal error: assertion failed, file %s, line %d, %s\n", | |
1827 file, line, expr); | |
1828 #undef abort /* avoid infinite #define loop... */ | |
1829 #ifndef ASSERTIONS_DONT_ABORT | |
1830 abort (); | |
1831 #endif | |
1832 } | |
1833 #endif /* USE_ASSERTIONS */ | |
1834 | |
1835 #ifdef QUANTIFY | |
1836 DEFUN ("quantify-start-recording-data", Fquantify_start_recording_data, | |
1837 Squantify_start_recording_data, 0, 0, 0 /* | |
1838 Start recording Quantify data. | |
1839 */) | |
1840 () | |
1841 { | |
1842 quantify_start_recording_data (); | |
1843 return Qnil; | |
1844 } | |
1845 | |
1846 DEFUN ("quantify-stop-recording-data", Fquantify_stop_recording_data, | |
1847 Squantify_stop_recording_data, 0, 0, 0 /* | |
1848 Stop recording Quantify data. | |
1849 */) | |
1850 () | |
1851 { | |
1852 quantify_stop_recording_data (); | |
1853 return Qnil; | |
1854 } | |
1855 | |
1856 DEFUN ("quantify-clear-data", Fquantify_clear_data, | |
1857 Squantify_clear_data, 0, 0, 0 /* | |
1858 Clear all Quantify data. | |
1859 */) | |
1860 () | |
1861 { | |
1862 quantify_clear_data (); | |
1863 return Qnil; | |
1864 } | |
1865 #endif /* QUANTIFY */ | |
1866 | |
1867 void | |
1868 syms_of_emacs (void) | |
1869 { | |
1870 #ifndef CANNOT_DUMP | |
1871 #ifdef HAVE_SHM | |
1872 defsubr (&Sdump_emacs_data); | |
1873 #else | |
1874 defsubr (&Sdump_emacs); | |
1875 #endif | |
1876 #endif /* !CANNOT_DUMP */ | |
1877 | |
1878 defsubr (&Srun_emacs_from_temacs); | |
1879 defsubr (&Srunning_temacs_p); | |
1880 defsubr (&Sinvocation_name); | |
1881 defsubr (&Skill_emacs); | |
1882 defsubr (&Snoninteractive); | |
1883 | |
1884 #ifdef QUANTIFY | |
1885 defsubr (&Squantify_start_recording_data); | |
1886 defsubr (&Squantify_stop_recording_data); | |
1887 defsubr (&Squantify_clear_data); | |
1888 #endif /* QUANTIFY */ | |
1889 | |
1890 defsymbol (&Qkill_emacs_hook, "kill-emacs-hook"); | |
1891 defsymbol (&Qsave_buffers_kill_emacs, "save-buffers-kill-emacs"); | |
1892 } | |
1893 | |
1894 void | |
1895 vars_of_emacs (void) | |
1896 { | |
1897 DEFVAR_BOOL ("suppress-early-error-handler-backtrace", | |
1898 &suppress_early_backtrace /* | |
1899 Non-nil means early error handler shouldn't print a backtrace | |
1900 */ ); | |
1901 | |
1902 DEFVAR_LISP ("command-line-args", &Vcommand_line_args /* | |
1903 Args passed by shell to XEmacs, as a list of strings. | |
1904 */ ); | |
1905 | |
1906 DEFVAR_LISP ("invocation-name", &Vinvocation_name /* | |
1907 The program name that was used to run XEmacs. | |
1908 Any directory names are omitted. | |
1909 */ ); | |
1910 | |
1911 DEFVAR_LISP ("invocation-directory", &Vinvocation_directory /* | |
1912 The directory in which the XEmacs executable was found, to run it. | |
1913 The value is simply the program name if that directory's name is not known. | |
1914 */ ); | |
1915 | |
1916 #if 0 /* FSFmacs */ | |
1917 xxDEFVAR_LISP ("installation-directory", &Vinstallation_directory, | |
1918 "A directory within which to look for the `lib-src' and `etc' directories.\n" | |
1919 "This is non-nil when we can't find those directories in their standard\n" | |
1920 "installed locations, but we can find them\n" | |
1921 "near where the XEmacs executable was found."); | |
1922 #endif | |
1923 | |
1924 DEFVAR_LISP ("system-type", &Vsystem_type /* | |
1925 Value is symbol indicating type of operating system you are using. | |
1926 */ ); | |
1927 Vsystem_type = intern (SYSTEM_TYPE); | |
1928 | |
1929 #ifndef EMACS_CONFIGURATION | |
1930 # define EMACS_CONFIGURATION "UNKNOWN" | |
1931 #endif | |
1932 DEFVAR_LISP ("system-configuration", &Vsystem_configuration /* | |
1933 Value is string indicating configuration XEmacs was built for. | |
1934 */ ); | |
1935 Vsystem_configuration = Fpurecopy (build_string (EMACS_CONFIGURATION)); | |
1936 | |
1937 DEFVAR_BOOL ("noninteractive", &noninteractive1 /* | |
1938 Non-nil means XEmacs is running without interactive terminal. | |
1939 */ ); | |
1940 | |
1941 DEFVAR_INT ("emacs-priority", &emacs_priority /* | |
1942 Priority for XEmacs to run at. | |
1943 This value is effective only if set before XEmacs is dumped, | |
1944 and only if the XEmacs executable is installed with setuid to permit | |
1945 it to change priority. (XEmacs sets its uid back to the real uid.) | |
1946 Currently, you need to define SET_EMACS_PRIORITY in `config.h' | |
1947 before you compile XEmacs, to enable the code for this feature. | |
1948 */ ); | |
1949 emacs_priority = 0; | |
1950 } |