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