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