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