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
|
100
|
830 #ifndef WINDOWSNT
|
0
|
831 syms_of_profile ();
|
100
|
832 #endif
|
0
|
833 #if defined (HAVE_MMAP) && defined (REL_ALLOC)
|
|
834 syms_of_ralloc ();
|
|
835 #endif /* HAVE_MMAP && REL_ALLOC */
|
|
836 syms_of_rangetab ();
|
|
837 syms_of_redisplay ();
|
|
838 syms_of_search ();
|
|
839 syms_of_signal ();
|
|
840 syms_of_sound ();
|
|
841 syms_of_specifier ();
|
|
842 syms_of_symbols ();
|
|
843 syms_of_syntax ();
|
|
844 #ifdef HAVE_SCROLLBARS
|
|
845 syms_of_scrollbar ();
|
|
846 #endif
|
|
847 #ifdef HAVE_TOOLBARS
|
|
848 syms_of_toolbar ();
|
|
849 #endif
|
|
850 syms_of_undo ();
|
195
|
851 syms_of_widget ();
|
0
|
852 syms_of_window ();
|
195
|
853
|
0
|
854 #ifdef HAVE_TTY
|
|
855 syms_of_console_tty ();
|
|
856 syms_of_device_tty ();
|
|
857 syms_of_objects_tty ();
|
|
858 #endif
|
|
859 #ifdef HAVE_X_WINDOWS
|
|
860 syms_of_device_x ();
|
|
861 #ifdef HAVE_DIALOGS
|
|
862 syms_of_dialog_x ();
|
|
863 #endif
|
|
864 syms_of_event_Xt ();
|
|
865 syms_of_frame_x ();
|
|
866 syms_of_glyphs_x ();
|
|
867 syms_of_objects_x ();
|
|
868 #ifdef HAVE_MENUBARS
|
|
869 syms_of_menubar_x ();
|
|
870 #endif
|
|
871 syms_of_xselect ();
|
|
872 #ifdef EPOCH
|
|
873 syms_of_epoch ();
|
|
874 #endif
|
|
875 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
|
|
876 syms_of_gui_x ();
|
|
877 #endif
|
|
878 #endif /* HAVE_X_WINDOWS */
|
|
879
|
213
|
880 #ifdef HAVE_MS_WINDOWS
|
|
881 syms_of_console_mswindows ();
|
|
882 syms_of_device_mswindows ();
|
|
883 syms_of_event_mswindows ();
|
|
884 syms_of_frame_mswindows ();
|
|
885 syms_of_objects_mswindows ();
|
209
|
886 #endif
|
|
887
|
70
|
888 #ifdef MULE
|
|
889 syms_of_mule ();
|
|
890 syms_of_mule_ccl ();
|
|
891 syms_of_mule_charset ();
|
|
892 syms_of_mule_coding ();
|
|
893 #ifdef HAVE_WNN
|
|
894 syms_of_mule_wnn ();
|
|
895 #endif
|
|
896 #ifdef HAVE_CANNA
|
|
897 syms_of_mule_canna ();
|
|
898 #endif /* HAVE_CANNA */
|
|
899 #endif /* MULE */
|
|
900
|
0
|
901 #ifdef SYMS_SYSTEM
|
|
902 SYMS_SYSTEM;
|
|
903 #endif
|
|
904
|
|
905 #ifdef SYMS_MACHINE
|
|
906 SYMS_MACHINE;
|
|
907 #endif
|
|
908
|
|
909 #ifdef EMACS_BTL
|
163
|
910 syms_of_btl ();
|
0
|
911 #endif
|
|
912
|
|
913 #if defined (GNU_MALLOC) && defined (ERROR_CHECK_MALLOC)
|
|
914 #if 0
|
|
915 syms_of_free_hook ();
|
|
916 #endif
|
|
917 #endif
|
|
918
|
|
919 #ifdef TOOLTALK
|
|
920 syms_of_tooltalk ();
|
|
921 #endif
|
|
922
|
|
923 #ifdef SUNPRO
|
|
924 syms_of_sunpro ();
|
|
925 #endif
|
|
926
|
|
927 /* Now create the subtypes for the types that have them.
|
|
928 We do this before the vars_*() because more symbols
|
|
929 may get initialized here. */
|
|
930
|
|
931 /* Now initialize the console types and associated symbols.
|
|
932 Other than the first function below, the functions may
|
|
933 make exactly the following function/macro calls:
|
|
934
|
|
935 INITIALIZE_CONSOLE_TYPE()
|
|
936 CONSOLE_HAS_METHOD()
|
|
937
|
|
938 For any given console type, the former macro must be called
|
|
939 before the any calls to the latter macro. */
|
|
940
|
|
941 console_type_create ();
|
|
942
|
|
943 console_type_create_stream ();
|
|
944
|
|
945 #ifdef HAVE_TTY
|
|
946 console_type_create_tty ();
|
|
947 console_type_create_device_tty ();
|
|
948 console_type_create_frame_tty ();
|
|
949 console_type_create_objects_tty ();
|
|
950 console_type_create_redisplay_tty ();
|
|
951 #endif
|
|
952
|
|
953 #ifdef HAVE_X_WINDOWS
|
|
954 console_type_create_x ();
|
|
955 console_type_create_device_x ();
|
|
956 console_type_create_frame_x ();
|
|
957 console_type_create_glyphs_x ();
|
|
958 #ifdef HAVE_MENUBARS
|
|
959 console_type_create_menubar_x ();
|
|
960 #endif
|
|
961 console_type_create_objects_x ();
|
|
962 console_type_create_redisplay_x ();
|
|
963 #ifdef HAVE_SCROLLBARS
|
|
964 console_type_create_scrollbar_x ();
|
|
965 #endif
|
|
966 #ifdef HAVE_TOOLBARS
|
|
967 console_type_create_toolbar_x ();
|
|
968 #endif
|
|
969 #endif /* HAVE_X_WINDOWS */
|
|
970
|
213
|
971 #ifdef HAVE_MS_WINDOWS
|
|
972 console_type_create_mswindows ();
|
|
973 console_type_create_device_mswindows ();
|
|
974 console_type_create_frame_mswindows ();
|
|
975 console_type_create_objects_mswindows ();
|
|
976 console_type_create_redisplay_mswindows ();
|
209
|
977 #endif
|
|
978
|
0
|
979 /* Now initialize the specifier types and associated symbols.
|
|
980 Other than the first function below, the functions may
|
|
981 make exactly the following function/macro calls:
|
|
982
|
|
983 INITIALIZE_SPECIFIER_TYPE()
|
|
984 SPECIFIER_HAS_METHOD()
|
|
985
|
|
986 For any given specifier type, the former macro must be called
|
|
987 before the any calls to the latter macro. */
|
|
988
|
|
989 specifier_type_create ();
|
|
990
|
|
991 specifier_type_create_image ();
|
|
992 specifier_type_create_objects ();
|
|
993 #ifdef HAVE_TOOLBARS
|
|
994 specifier_type_create_toolbar ();
|
|
995 #endif
|
|
996
|
|
997 /* Now initialize the structure types and associated symbols.
|
|
998 Other than the first function below, the functions may
|
|
999 make exactly the following function/macro calls:
|
|
1000
|
|
1001 define_structure_type()
|
|
1002 define_structure_type_keyword()
|
|
1003
|
|
1004 */
|
|
1005
|
|
1006 structure_type_create ();
|
|
1007
|
70
|
1008 structure_type_create_chartab ();
|
0
|
1009 structure_type_create_faces ();
|
|
1010 structure_type_create_rangetab ();
|
|
1011
|
|
1012 /* Now initialize the image instantiator formats and associated symbols.
|
|
1013 Other than the first function below, the functions may
|
|
1014 make exactly the following function/macro calls:
|
|
1015
|
|
1016 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT()
|
|
1017 IIFORMAT_HAS_METHOD()
|
|
1018 IIFORMAT_VALID_KEYWORD()
|
|
1019
|
|
1020 For any given image instantiator format, the first macro must be
|
|
1021 called before the any calls to the other macros. */
|
|
1022
|
|
1023 image_instantiator_format_create ();
|
|
1024 #ifdef HAVE_X_WINDOWS
|
|
1025 image_instantiator_format_create_glyphs_x ();
|
|
1026 #endif /* HAVE_X_WINDOWS */
|
|
1027
|
|
1028 /* Now initialize the lstream types and associated symbols.
|
|
1029 Other than the first function below, the functions may
|
|
1030 make exactly the following function/macro calls:
|
|
1031
|
|
1032 LSTREAM_HAS_METHOD()
|
|
1033
|
|
1034 */
|
|
1035
|
|
1036 lstream_type_create ();
|
70
|
1037 #ifdef MULE
|
|
1038 lstream_type_create_mule_coding ();
|
|
1039 #endif
|
0
|
1040 lstream_type_create_print ();
|
|
1041
|
|
1042 /* Now initialize most variables.
|
|
1043
|
|
1044 These functions may do exactly the following:
|
|
1045
|
|
1046 DEFVAR_INT()
|
|
1047 DEFVAR_LISP()
|
|
1048 DEFVAR_BOOL()
|
|
1049 DEFER_GETTEXT()
|
|
1050 Dynarr_*()
|
|
1051 Blocktype_*()
|
|
1052 staticpro()
|
|
1053 Fprovide(symbol)
|
|
1054 intern()
|
|
1055 pure_put()
|
|
1056 xmalloc()
|
|
1057 defsymbol(), if it's absolutely necessary and you're sure that
|
|
1058 the symbol isn't referenced anywhere else in the initialization
|
|
1059 code
|
|
1060 Fset() on a symbol that is unbound
|
|
1061 assigning a symbol or constant value to a variable
|
|
1062 using a global variable that has been initialized
|
|
1063 earlier on in the same function
|
|
1064
|
|
1065 Any of the object-creating functions on alloc.c: e.g.
|
|
1066
|
|
1067 make_pure_*()
|
|
1068 Fpurecopy()
|
|
1069 make_string()
|
|
1070 build_string()
|
|
1071 make_vector()
|
|
1072 make_int()
|
|
1073 make_extent()
|
|
1074 alloc_lcrecord()
|
|
1075 Fcons()
|
|
1076 listN()
|
|
1077 make_opaque_ptr()
|
|
1078 make_opaque_long()
|
|
1079
|
|
1080 perhaps a few others.
|
|
1081 */
|
|
1082
|
|
1083 /* Now allow Fprovide() statements to be made. */
|
|
1084 init_provide_once ();
|
|
1085
|
|
1086 vars_of_abbrev ();
|
|
1087 vars_of_alloc ();
|
136
|
1088 #ifdef HAVE_X_WINDOWS
|
|
1089 vars_of_balloon_x ();
|
|
1090 #endif
|
0
|
1091 vars_of_buffer ();
|
|
1092 vars_of_bytecode ();
|
|
1093 vars_of_callint ();
|
|
1094 vars_of_callproc ();
|
|
1095 vars_of_cmdloop ();
|
|
1096 vars_of_cmds ();
|
|
1097 vars_of_console ();
|
|
1098 vars_of_data ();
|
|
1099 #ifdef DEBUG_XEMACS
|
|
1100 vars_of_debug ();
|
|
1101 #endif
|
|
1102 vars_of_console_stream ();
|
|
1103 vars_of_device ();
|
|
1104 #ifdef HAVE_DIALOGS
|
|
1105 vars_of_dialog ();
|
|
1106 #endif
|
|
1107 vars_of_dired ();
|
|
1108 vars_of_doc ();
|
|
1109 vars_of_editfns ();
|
|
1110 vars_of_elhash ();
|
|
1111 vars_of_emacs ();
|
|
1112 vars_of_eval ();
|
|
1113 vars_of_event_stream ();
|
|
1114 vars_of_events ();
|
|
1115 vars_of_extents ();
|
|
1116 vars_of_faces ();
|
|
1117 vars_of_fileio ();
|
|
1118 #ifdef CLASH_DETECTION
|
|
1119 vars_of_filelock ();
|
|
1120 #endif
|
|
1121 vars_of_floatfns ();
|
|
1122 vars_of_font_lock ();
|
|
1123 vars_of_frame ();
|
|
1124 vars_of_glyphs ();
|
|
1125 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
|
|
1126 vars_of_gui ();
|
|
1127 #endif
|
|
1128 vars_of_indent ();
|
|
1129 vars_of_insdel ();
|
|
1130 vars_of_intl ();
|
70
|
1131 #ifdef HAVE_XIM
|
|
1132 #ifdef XIM_MOTIF
|
|
1133 vars_of_input_method_motif ();
|
|
1134 #else /* XIM_XLIB */
|
|
1135 vars_of_input_method_xlib ();
|
|
1136 #endif
|
|
1137 #endif /* HAVE_XIM */
|
0
|
1138 vars_of_keymap ();
|
|
1139 vars_of_lread ();
|
|
1140 vars_of_lstream ();
|
|
1141 vars_of_macros ();
|
|
1142 vars_of_md5 ();
|
|
1143 #ifdef HAVE_DATABASE
|
|
1144 vars_of_dbm ();
|
|
1145 #endif
|
|
1146 #ifdef HAVE_MENUBARS
|
|
1147 vars_of_menubar ();
|
|
1148 #endif
|
|
1149 vars_of_minibuf ();
|
|
1150 vars_of_objects ();
|
|
1151 vars_of_print ();
|
|
1152 #ifndef NO_SUBPROCESSES
|
|
1153 vars_of_process ();
|
|
1154 #endif
|
100
|
1155 #ifndef WINDOWSNT
|
0
|
1156 vars_of_profile ();
|
100
|
1157 #endif
|
0
|
1158 #if defined (HAVE_MMAP) && defined (REL_ALLOC)
|
|
1159 vars_of_ralloc ();
|
|
1160 #endif /* HAVE_MMAP && REL_ALLOC */
|
|
1161 vars_of_redisplay ();
|
|
1162 #ifdef HAVE_SCROLLBARS
|
|
1163 vars_of_scrollbar ();
|
|
1164 #endif
|
|
1165 vars_of_search ();
|
|
1166 vars_of_sound ();
|
|
1167 vars_of_specifier ();
|
|
1168 vars_of_symbols ();
|
|
1169 vars_of_syntax ();
|
|
1170 #ifdef HAVE_TOOLBARS
|
|
1171 vars_of_toolbar ();
|
|
1172 #endif
|
|
1173 vars_of_undo ();
|
|
1174 vars_of_window ();
|
|
1175
|
|
1176 #ifdef HAVE_TTY
|
|
1177 vars_of_console_tty ();
|
|
1178 vars_of_event_tty ();
|
|
1179 vars_of_frame_tty ();
|
|
1180 vars_of_objects_tty ();
|
|
1181 #endif
|
|
1182
|
|
1183 #ifdef HAVE_X_WINDOWS
|
|
1184 vars_of_device_x ();
|
|
1185 #ifdef HAVE_DIALOGS
|
|
1186 vars_of_dialog_x ();
|
|
1187 #endif
|
|
1188 vars_of_event_Xt ();
|
|
1189 vars_of_frame_x ();
|
|
1190 vars_of_glyphs_x ();
|
|
1191 #ifdef HAVE_MENUBARS
|
|
1192 vars_of_menubar_x ();
|
|
1193 #endif
|
|
1194 vars_of_objects_x ();
|
|
1195 vars_of_xselect ();
|
|
1196 #ifdef EPOCH
|
|
1197 vars_of_epoch ();
|
|
1198 #endif
|
|
1199 #ifdef HAVE_SCROLLBARS
|
|
1200 vars_of_scrollbar_x ();
|
|
1201 #endif
|
|
1202 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
|
|
1203 vars_of_gui_x ();
|
|
1204 #endif
|
|
1205 #endif
|
|
1206
|
213
|
1207 #ifdef HAVE_MS_WINDOWS
|
|
1208 vars_of_device_mswindows ();
|
|
1209 vars_of_console_mswindows ();
|
|
1210 vars_of_event_mswindows ();
|
|
1211 vars_of_frame_mswindows ();
|
|
1212 vars_of_objects_mswindows ();
|
209
|
1213 #endif
|
|
1214
|
70
|
1215 #ifdef MULE
|
|
1216 vars_of_mule ();
|
|
1217 vars_of_mule_charset ();
|
|
1218 vars_of_mule_coding ();
|
|
1219 #ifdef HAVE_WNN
|
|
1220 vars_of_mule_wnn ();
|
|
1221 #endif
|
|
1222 #ifdef HAVE_CANNA
|
|
1223 vars_of_mule_canna ();
|
|
1224 #endif /* HAVE_CANNA */
|
|
1225 #endif /* MULE */
|
|
1226
|
0
|
1227 #ifdef TOOLTALK
|
|
1228 vars_of_tooltalk ();
|
|
1229 #endif
|
|
1230
|
|
1231 #ifdef SUNPRO
|
|
1232 vars_of_sunpro ();
|
|
1233 #endif
|
|
1234
|
|
1235 /* Now initialize any specifier variables. We do this later
|
|
1236 because it has some dependence on the vars initialized
|
|
1237 above.
|
|
1238
|
|
1239 These functions should *only* initialize specifier variables,
|
|
1240 and may make use of the following functions/macros in addition
|
|
1241 to the ones listed above:
|
|
1242
|
|
1243 DEFVAR_SPECIFIER()
|
|
1244 Fmake_specifier()
|
|
1245 set_specifier_fallback()
|
|
1246 set_specifier_caching()
|
|
1247 */
|
|
1248
|
|
1249 specifier_vars_of_glyphs ();
|
|
1250 #ifdef HAVE_MENUBARS
|
|
1251 specifier_vars_of_menubar ();
|
|
1252 #endif
|
|
1253 specifier_vars_of_redisplay ();
|
|
1254 #ifdef HAVE_SCROLLBARS
|
|
1255 specifier_vars_of_scrollbar ();
|
|
1256 #endif
|
|
1257 #ifdef HAVE_TOOLBARS
|
|
1258 specifier_vars_of_toolbar ();
|
|
1259 #endif
|
|
1260 specifier_vars_of_window ();
|
|
1261
|
|
1262 /* Now comes all the rest of the variables that couldn't
|
|
1263 be handled above. There may be dependencies on variables
|
|
1264 initialized above, and dependencies between one complex_vars_()
|
|
1265 function and another. */
|
|
1266
|
|
1267 /* Calls Fmake_range_table(). */
|
|
1268 complex_vars_of_regex ();
|
|
1269 /* Calls Fmake_range_table(). */
|
|
1270 complex_vars_of_search ();
|
|
1271
|
|
1272 /* Calls make_lisp_hashtable(). */
|
|
1273 complex_vars_of_extents ();
|
163
|
1274
|
0
|
1275 /* Depends on hashtables and specifiers. */
|
|
1276 complex_vars_of_faces ();
|
|
1277
|
70
|
1278 #ifdef MULE
|
|
1279 /* These two depend on hashtables and various variables declared
|
|
1280 earlier. The second may also depend on the first. */
|
|
1281 complex_vars_of_mule_charset ();
|
|
1282 complex_vars_of_mule_coding ();
|
|
1283 #endif
|
|
1284
|
0
|
1285 /* This calls allocate_glyph(), which creates specifiers
|
|
1286 and also relies on a variable (Vthe_nothing_vector) initialized
|
70
|
1287 above. It also calls make_ext_string(), which under Mule
|
|
1288 could require that the charsets be initialized. */
|
0
|
1289 complex_vars_of_glyphs ();
|
|
1290
|
175
|
1291 /* These rely on the glyphs just created in the previous function,
|
|
1292 and call Fadd_spec_to_specifier(), which relies on various
|
0
|
1293 variables initialized above. */
|
|
1294 #ifdef HAVE_X_WINDOWS
|
|
1295 complex_vars_of_glyphs_x ();
|
|
1296 #endif
|
|
1297
|
|
1298 /* This calls Fmake_glyph_internal(). */
|
|
1299 complex_vars_of_alloc ();
|
|
1300
|
|
1301 /* This calls Fmake_glyph_internal(). */
|
|
1302 #ifdef HAVE_MENUBARS
|
|
1303 complex_vars_of_menubar ();
|
|
1304 #endif
|
|
1305
|
|
1306 /* This calls Fmake_glyph_internal(). */
|
|
1307 #ifdef HAVE_SCROLLBARS
|
|
1308 complex_vars_of_scrollbar ();
|
|
1309 #endif
|
|
1310
|
|
1311 /* This calls allocate_glyph(). */
|
|
1312 complex_vars_of_frame ();
|
|
1313
|
70
|
1314 /* This calls Fcopy_category_table() under Mule, which calls who
|
|
1315 knows what. */
|
|
1316 complex_vars_of_chartab ();
|
|
1317
|
0
|
1318 /* This calls set_string_char(), which (under Mule) depends on the
|
|
1319 charsets being initialized. */
|
|
1320 complex_vars_of_casetab ();
|
|
1321
|
|
1322 /* This calls Fcopy_syntax_table(), which relies on char tables. */
|
|
1323 complex_vars_of_syntax ();
|
|
1324
|
|
1325 /* This initializes buffer-local variables, sets things up so
|
|
1326 that buffers can be created, and creates a couple of basic
|
|
1327 buffers. This depends on Vstandard_syntax_table and
|
|
1328 Vstandard_category_table (initialized in the previous
|
|
1329 functions), as well as a whole horde of variables that may
|
|
1330 have been initialized above. */
|
|
1331 complex_vars_of_buffer ();
|
|
1332
|
|
1333 /* This initializes console-local variables. */
|
|
1334 complex_vars_of_console ();
|
|
1335
|
|
1336 /* This creates a couple more buffers, and depends on the
|
|
1337 previous function. */
|
|
1338 complex_vars_of_minibuf ();
|
|
1339
|
|
1340 /* These two might call Ffile_name_as_directory(), which
|
|
1341 might depend on all sorts of things; I'm not sure. */
|
|
1342 complex_vars_of_callproc ();
|
|
1343 #ifdef CLASH_DETECTION
|
|
1344 complex_vars_of_filelock ();
|
|
1345 #endif /* CLASH_DETECTION */
|
|
1346
|
|
1347 /* This creates a couple of basic keymaps and depends on Lisp
|
|
1348 hashtables and Ffset() (both of which depend on some variables
|
|
1349 initialized in the vars_of_*() section) and possibly other
|
|
1350 stuff. */
|
|
1351 complex_vars_of_keymap ();
|
175
|
1352 /* Calls Fmake_hashtable() and creates a keymap */
|
|
1353 complex_vars_of_event_stream ();
|
0
|
1354
|
|
1355 if (always_gc) /* purification debugging hack */
|
|
1356 garbage_collect_1 ();
|
|
1357 }
|
|
1358
|
|
1359 /* CONGRATULATIONS!!! We have successfully initialized the Lisp
|
|
1360 engine. */
|
|
1361
|
|
1362 if (initialized)
|
|
1363 {
|
|
1364 /* Stuff that needs to be reset at run time. Order below should
|
|
1365 not matter. */
|
|
1366 reinit_alloc ();
|
|
1367 reinit_eval ();
|
70
|
1368 #ifdef MULE_REGEXP
|
|
1369 reinit_mule_category ();
|
|
1370 #endif
|
0
|
1371 }
|
|
1372
|
|
1373 /* Now do further initialization/setup of stuff that is not needed by the
|
|
1374 syms_of_() routines. This involves stuff that only is enabled in
|
|
1375 an interactive run (redisplay, user input, etc.) and stuff that is
|
|
1376 not needed until we start loading Lisp code (the reader). A lot
|
|
1377 of this stuff involves querying the current environment and needs
|
|
1378 to be done both at dump time and at run time. */
|
|
1379
|
|
1380 init_callproc (); /* Set up the process environment (so that egetenv
|
|
1381 works), the basic directory variables
|
|
1382 (exec-directory and so on), and stuff
|
|
1383 related to subprocesses. This should be
|
|
1384 first because many of the functions below
|
|
1385 call egetenv() to get environment variables. */
|
|
1386 init_lread (); /* Set up the Lisp reader. */
|
|
1387 #ifdef MSDOS
|
|
1388 /* Call early 'cause init_environment needs it. */
|
|
1389 init_dosfns ();
|
|
1390 /* Set defaults for several environment variables. */
|
|
1391 init_environment (argc, argv, skip_args);
|
|
1392 #endif
|
|
1393 init_cmdargs (argc, argv, skip_args); /* Create list Vcommand_line_args */
|
|
1394 init_buffer (); /* Init default directory of *scratch* buffer */
|
195
|
1395
|
|
1396 #ifdef WINDOWSNT
|
|
1397 init_environment();
|
|
1398 init_ntproc();
|
|
1399 #endif
|
|
1400
|
0
|
1401 init_redisplay (); /* Determine terminal type.
|
|
1402 init_sys_modes uses results */
|
|
1403 init_event_stream (); /* Set up so we can get user input. */
|
|
1404 init_macros (); /* set up so we can run macros. */
|
|
1405 init_editfns (); /* Determine the name of the user we're running as */
|
|
1406 init_xemacs_process (); /* set up for calling subprocesses */
|
|
1407 #ifdef SUNPRO
|
|
1408 init_sunpro (); /* Set up Sunpro usage tracking */
|
|
1409 #endif
|
|
1410 #if defined (HAVE_NATIVE_SOUND) && defined (hp9000s800)
|
|
1411 init_hpplay ();
|
|
1412 #endif
|
|
1413 #ifdef HAVE_TTY
|
|
1414 init_device_tty ();
|
|
1415 #endif
|
|
1416 #ifdef HAVE_GIF
|
|
1417 init_gif_err ();
|
|
1418 #endif
|
|
1419 init_console_stream (); /* Create the first console */
|
|
1420
|
173
|
1421 /* try to get the actual pathname of the exec file we are running */
|
0
|
1422 {
|
|
1423 Vinvocation_name = Fcar (Vcommand_line_args);
|
|
1424 Vinvocation_directory = Vinvocation_name;
|
|
1425
|
|
1426 if (!NILP (Ffile_name_directory (Vinvocation_name)))
|
|
1427 /* invocation-name includes a directory component -- presumably it
|
|
1428 is relative to cwd, not $PATH */
|
|
1429 Vinvocation_directory = Fexpand_file_name (Vinvocation_name,
|
|
1430 Qnil);
|
|
1431 else
|
|
1432 locate_file (Vexec_path, Vinvocation_name, EXEC_SUFFIXES,
|
|
1433 &Vinvocation_directory, X_OK);
|
|
1434
|
|
1435 if (NILP (Vinvocation_directory))
|
|
1436 Vinvocation_directory = Vinvocation_name;
|
|
1437
|
|
1438 Vinvocation_name = Ffile_name_nondirectory (Vinvocation_directory);
|
|
1439 Vinvocation_directory = Ffile_name_directory (Vinvocation_directory);
|
|
1440 }
|
|
1441
|
|
1442 #if defined (LOCALTIME_CACHE) && defined (HAVE_TZSET)
|
|
1443 /* sun's localtime() has a bug. it caches the value of the time
|
|
1444 zone rather than looking it up every time. Since localtime() is
|
|
1445 called to bolt the undumping time into the undumped emacs, this
|
|
1446 results in localtime() ignoring the TZ environment variable.
|
|
1447 This flushes the new TZ value into localtime(). */
|
|
1448 tzset ();
|
|
1449 #endif /* LOCALTIME_CACHE and TZSET */
|
|
1450
|
|
1451 load_me = Qnil;
|
|
1452 if (!initialized)
|
|
1453 {
|
|
1454 /* Handle -l loadup-and-dump, args passed by Makefile. */
|
|
1455 if (argc > 2 + skip_args && !strcmp (argv[1 + skip_args], "-l"))
|
80
|
1456 load_me = build_string (argv[2 + skip_args]);
|
0
|
1457 #ifdef CANNOT_DUMP
|
|
1458 /* Unless next switch is -nl, load "loadup.el" first thing. */
|
|
1459 if (!(argc > 1 + skip_args && !strcmp (argv[1 + skip_args], "-nl")))
|
|
1460 load_me = build_string ("loadup.el");
|
|
1461 #endif /* CANNOT_DUMP */
|
|
1462 }
|
|
1463
|
|
1464 #ifdef QUANTIFY
|
|
1465 if (initialized)
|
|
1466 quantify_start_recording_data ();
|
|
1467 #endif /* QUANTIFY */
|
|
1468
|
|
1469 initialized = 1;
|
|
1470
|
|
1471 /* This never returns. */
|
|
1472 initial_command_loop (load_me);
|
|
1473 /* NOTREACHED */
|
|
1474 }
|
|
1475
|
20
|
1476
|
16
|
1477 /* Sort the args so we can find the most important ones
|
|
1478 at the beginning of argv. */
|
|
1479
|
|
1480 /* First, here's a table of all the standard options. */
|
|
1481
|
|
1482 struct standard_args
|
|
1483 {
|
|
1484 CONST char * CONST name;
|
|
1485 CONST char * CONST longname;
|
|
1486 int priority;
|
|
1487 int nargs;
|
|
1488 };
|
|
1489
|
|
1490 static struct standard_args standard_args[] =
|
|
1491 {
|
|
1492 /* Handled by main_1 above: */
|
|
1493 { "-nl", "--no-shared-memory", 100, 0 },
|
|
1494 { "-t", "--terminal", 95, 1 },
|
|
1495 { "-nw", "--no-windows", 90, 0 },
|
|
1496 { "-batch", "--batch", 85, 0 },
|
|
1497 { "-help", "--help", 80, 0 },
|
|
1498 { "-version", "--version", 75, 0 },
|
|
1499 { "-V", 0, 75, 0 },
|
|
1500 { "-d", "--display", 80, 1 },
|
|
1501 { "-display", 0, 80, 1 },
|
|
1502 { "-NXHost", 0, 79, 0 },
|
|
1503 { "-MachLaunch", 0, 79, 0},
|
|
1504
|
|
1505 /* Handled by command-line-early in startup.el: */
|
|
1506 { "-q", "--no-init-file", 50, 0 },
|
|
1507 { "-unmapped", 0, 50, 0 },
|
|
1508 { "-no-init-file", 0, 50, 0 },
|
207
|
1509 { "-vanilla", "--vanilla", 50, 0 },
|
16
|
1510 { "-no-site-file", "--no-site-file", 40, 0 },
|
207
|
1511 { "-no-packages", "--no-packages", 35, 0 },
|
16
|
1512 { "-u", "--user", 30, 1 },
|
|
1513 { "-user", 0, 30, 1 },
|
|
1514 { "-debug-init", "--debug-init", 20, 0 },
|
|
1515
|
|
1516 /* Xt options: */
|
|
1517 { "-i", "--icon-type", 15, 0 },
|
|
1518 { "-itype", 0, 15, 0 },
|
|
1519 { "-iconic", "--iconic", 15, 0 },
|
|
1520 { "-bg", "--background-color", 10, 1 },
|
|
1521 { "-background", 0, 10, 1 },
|
|
1522 { "-fg", "--foreground-color", 10, 1 },
|
|
1523 { "-foreground", 0, 10, 1 },
|
|
1524 { "-bd", "--border-color", 10, 1 },
|
|
1525 { "-bw", "--border-width", 10, 1 },
|
|
1526 { "-ib", "--internal-border", 10, 1 },
|
|
1527 { "-ms", "--mouse-color", 10, 1 },
|
|
1528 { "-cr", "--cursor-color", 10, 1 },
|
|
1529 { "-fn", "--font", 10, 1 },
|
|
1530 { "-font", 0, 10, 1 },
|
|
1531 { "-g", "--geometry", 10, 1 },
|
|
1532 { "-geometry", 0, 10, 1 },
|
|
1533 { "-T", "--title", 10, 1 },
|
|
1534 { "-title", 0, 10, 1 },
|
|
1535 { "-name", "--name", 10, 1 },
|
|
1536 { "-xrm", "--xrm", 10, 1 },
|
|
1537 { "-r", "--reverse-video", 5, 0 },
|
|
1538 { "-rv", 0, 5, 0 },
|
|
1539 { "-reverse", 0, 5, 0 },
|
|
1540 { "-hb", "--horizontal-scroll-bars", 5, 0 },
|
|
1541 { "-vb", "--vertical-scroll-bars", 5, 0 },
|
163
|
1542
|
16
|
1543 /* These have the same priority as ordinary file name args,
|
|
1544 so they are not reordered with respect to those. */
|
|
1545 { "-L", "--directory", 0, 1 },
|
|
1546 { "-directory", 0, 0, 1 },
|
|
1547 { "-l", "--load", 0, 1 },
|
|
1548 { "-load", 0, 0, 1 },
|
|
1549 { "-f", "--funcall", 0, 1 },
|
|
1550 { "-funcall", 0, 0, 1 },
|
|
1551 { "-eval", "--eval", 0, 1 },
|
|
1552 { "-insert", "--insert", 0, 1 },
|
|
1553 /* This should be processed after ordinary file name args and the like. */
|
|
1554 { "-kill", "--kill", -10, 0 },
|
|
1555 };
|
|
1556
|
|
1557 /* Reorder the elements of ARGV (assumed to have ARGC elements)
|
|
1558 so that the highest priority ones come first.
|
|
1559 Do not change the order of elements of equal priority.
|
|
1560 If an option takes an argument, keep it and its argument together. */
|
|
1561
|
|
1562 static void
|
|
1563 sort_args (int argc, char **argv)
|
|
1564 {
|
185
|
1565 char **new = xnew_array (char *, argc);
|
16
|
1566 /* For each element of argv,
|
|
1567 the corresponding element of options is:
|
|
1568 0 for an option that takes no arguments,
|
|
1569 1 for an option that takes one argument, etc.
|
|
1570 -1 for an ordinary non-option argument. */
|
185
|
1571 int *options = xnew_array (int, argc);
|
|
1572 int *priority = xnew_array (int, argc);
|
16
|
1573 int to = 1;
|
|
1574 int from;
|
|
1575 int i;
|
78
|
1576 int end_of_options_p = 0;
|
16
|
1577
|
|
1578 /* Categorize all the options,
|
|
1579 and figure out which argv elts are option arguments. */
|
|
1580 for (from = 1; from < argc; from++)
|
|
1581 {
|
|
1582 options[from] = -1;
|
|
1583 priority[from] = 0;
|
78
|
1584 /* Pseudo options "--" and "run-temacs" indicate end of options */
|
|
1585 if (!strcmp (argv[from], "--") ||
|
|
1586 !strcmp (argv[from], "run-temacs"))
|
|
1587 end_of_options_p = 1;
|
|
1588 if (!end_of_options_p && argv[from][0] == '-')
|
16
|
1589 {
|
|
1590 int match, thislen;
|
|
1591 char *equals;
|
|
1592
|
|
1593 /* Look for a match with a known old-fashioned option. */
|
|
1594 for (i = 0; i < countof (standard_args); i++)
|
|
1595 if (!strcmp (argv[from], standard_args[i].name))
|
|
1596 {
|
|
1597 options[from] = standard_args[i].nargs;
|
|
1598 priority[from] = standard_args[i].priority;
|
|
1599 if (from + standard_args[i].nargs >= argc)
|
|
1600 fatal ("Option `%s' requires an argument\n", argv[from]);
|
|
1601 from += standard_args[i].nargs;
|
|
1602 goto done;
|
|
1603 }
|
|
1604
|
|
1605 /* Look for a match with a known long option.
|
|
1606 MATCH is -1 if no match so far, -2 if two or more matches so far,
|
|
1607 >= 0 (the table index of the match) if just one match so far. */
|
|
1608 if (argv[from][1] == '-')
|
|
1609 {
|
|
1610 match = -1;
|
|
1611 thislen = strlen (argv[from]);
|
|
1612 equals = strchr (argv[from], '=');
|
|
1613 if (equals != 0)
|
|
1614 thislen = equals - argv[from];
|
|
1615
|
|
1616 for (i = 0; i < countof (standard_args); i++)
|
|
1617 if (standard_args[i].longname
|
|
1618 && !strncmp (argv[from], standard_args[i].longname,
|
|
1619 thislen))
|
|
1620 {
|
|
1621 if (match == -1)
|
|
1622 match = i;
|
|
1623 else
|
|
1624 match = -2;
|
|
1625 }
|
|
1626
|
|
1627 /* If we found exactly one match, use that. */
|
|
1628 if (match >= 0)
|
|
1629 {
|
|
1630 options[from] = standard_args[match].nargs;
|
|
1631 priority[from] = standard_args[match].priority;
|
|
1632 /* If --OPTION=VALUE syntax is used,
|
|
1633 this option uses just one argv element. */
|
|
1634 if (equals != 0)
|
|
1635 options[from] = 0;
|
|
1636 if (from + options[from] >= argc)
|
|
1637 fatal ("Option `%s' requires an argument\n", argv[from]);
|
|
1638 from += options[from];
|
|
1639 }
|
|
1640 }
|
|
1641 done: ;
|
|
1642 }
|
|
1643 }
|
|
1644
|
|
1645 /* Copy the arguments, in order of decreasing priority, to NEW. */
|
|
1646 new[0] = argv[0];
|
|
1647 while (to < argc)
|
|
1648 {
|
|
1649 int best = -1;
|
|
1650 int best_priority = -9999;
|
|
1651
|
|
1652 /* Find the highest priority remaining option.
|
|
1653 If several have equal priority, take the first of them. */
|
|
1654 for (from = 1; from < argc; from++)
|
|
1655 {
|
|
1656 if (argv[from] != 0 && priority[from] > best_priority)
|
|
1657 {
|
|
1658 best_priority = priority[from];
|
|
1659 best = from;
|
|
1660 }
|
|
1661 /* Skip option arguments--they are tied to the options. */
|
|
1662 if (options[from] > 0)
|
|
1663 from += options[from];
|
|
1664 }
|
163
|
1665
|
16
|
1666 if (best < 0)
|
|
1667 abort ();
|
|
1668
|
|
1669 /* Copy the highest priority remaining option, with its args, to NEW. */
|
|
1670 new[to++] = argv[best];
|
|
1671 for (i = 0; i < options[best]; i++)
|
|
1672 new[to++] = argv[best + i + 1];
|
|
1673
|
|
1674 /* Clear out this option in ARGV. */
|
|
1675 argv[best] = 0;
|
|
1676 for (i = 0; i < options[best]; i++)
|
|
1677 argv[best + i + 1] = 0;
|
|
1678 }
|
|
1679
|
|
1680 memcpy (argv, new, sizeof (char *) * argc);
|
|
1681 }
|
|
1682
|
0
|
1683 static JMP_BUF run_temacs_catch;
|
|
1684
|
|
1685 static int run_temacs_argc;
|
|
1686 static char **run_temacs_argv;
|
|
1687 static char *run_temacs_args;
|
|
1688 static int run_temacs_argv_size;
|
|
1689 static int run_temacs_args_size;
|
|
1690
|
|
1691 extern int gc_in_progress;
|
|
1692
|
20
|
1693 DEFUN ("running-temacs-p", Frunning_temacs_p, 0, 0, 0, /*
|
0
|
1694 True if running temacs. This means we are in the dumping stage.
|
|
1695 This is false during normal execution of the `xemacs' program, and
|
|
1696 becomes false once `run-emacs-from-temacs' is run.
|
20
|
1697 */
|
|
1698 ())
|
0
|
1699 {
|
|
1700 return run_temacs_argc >= 0 ? Qt : Qnil;
|
|
1701 }
|
|
1702
|
20
|
1703 DEFUN ("run-emacs-from-temacs", Frun_emacs_from_temacs, 0, MANY, 0, /*
|
0
|
1704 Do not call this. It will reinitialize your XEmacs. You'll be sorry.
|
20
|
1705 */
|
0
|
1706 /* If this function is called from startup.el, it will be possible to run
|
|
1707 temacs as an editor using 'temacs -batch -l loadup.el run-temacs', instead
|
|
1708 of having to dump an emacs and then run that (when debugging emacs itself,
|
20
|
1709 this can be much faster)). [Actually, the speed difference isn't that
|
0
|
1710 much as long as your filesystem is local, and you don't end up with
|
|
1711 a dumped version in case you want to rerun it. This function is most
|
|
1712 useful when used as part of the `make all-elc' command. --ben]
|
185
|
1713 This will "restart" emacs with the specified command-line arguments.
|
0
|
1714 */
|
70
|
1715 (int nargs, Lisp_Object *args))
|
0
|
1716 {
|
|
1717 int ac;
|
|
1718 Extbyte *wampum;
|
|
1719 int namesize;
|
|
1720 int total_len;
|
|
1721 Lisp_Object orig_invoc_name = Fcar (Vcommand_line_args);
|
185
|
1722 Extbyte **wampum_all = alloca_array (Extbyte *, nargs);
|
|
1723 int *wampum_all_len = alloca_array (int, nargs);
|
0
|
1724
|
|
1725 assert (!gc_in_progress);
|
|
1726
|
|
1727 if (run_temacs_argc < 0)
|
|
1728 error ("I've lost my temacs-hood.");
|
|
1729
|
|
1730 /* Need to convert the orig_invoc_name and all of the arguments
|
|
1731 to external format. */
|
163
|
1732
|
0
|
1733 GET_STRING_EXT_DATA_ALLOCA (orig_invoc_name, FORMAT_OS, wampum,
|
|
1734 namesize);
|
|
1735 namesize++;
|
|
1736
|
|
1737 for (ac = 0, total_len = namesize; ac < nargs; ac++)
|
|
1738 {
|
|
1739 CHECK_STRING (args[ac]);
|
|
1740 GET_STRING_EXT_DATA_ALLOCA (args[ac], FORMAT_OS,
|
|
1741 wampum_all[ac],
|
|
1742 wampum_all_len[ac]);
|
|
1743 wampum_all_len[ac]++;
|
|
1744 total_len += wampum_all_len[ac];
|
|
1745 }
|
|
1746 DO_REALLOC (run_temacs_args, run_temacs_args_size, total_len, char);
|
|
1747 DO_REALLOC (run_temacs_argv, run_temacs_argv_size, nargs+1, char *);
|
|
1748
|
|
1749 memcpy (run_temacs_args, wampum, namesize);
|
|
1750 run_temacs_argv [0] = run_temacs_args;
|
|
1751 for (ac = 0; ac < nargs; ac++)
|
|
1752 {
|
|
1753 memcpy (run_temacs_args + namesize,
|
|
1754 wampum_all[ac], wampum_all_len[ac]);
|
|
1755 run_temacs_argv [ac + 1] = run_temacs_args + namesize;
|
|
1756 namesize += wampum_all_len[ac];
|
|
1757 }
|
|
1758 run_temacs_argv [nargs + 1] = 0;
|
|
1759 catchlist = NULL; /* Important! Otherwise free_cons() calls in
|
|
1760 condition_case_unwind() may lead to GC death. */
|
|
1761 unbind_to (0, Qnil); /* this closes loadup.el */
|
|
1762 purify_flag = 0;
|
|
1763 run_temacs_argc = nargs + 1;
|
207
|
1764 #ifdef DEBUG_XEMACS
|
0
|
1765 report_pure_usage (1, 0);
|
207
|
1766 #else
|
|
1767 report_pure_usage (0, 0);
|
|
1768 #endif
|
0
|
1769 LONGJMP (run_temacs_catch, 1);
|
|
1770 return Qnil; /* not reached; warning suppression */
|
|
1771 }
|
|
1772
|
|
1773 /* ARGSUSED */
|
163
|
1774 int
|
0
|
1775 main (int argc, char **argv, char **envp)
|
|
1776 {
|
16
|
1777 int volatile vol_argc = argc;
|
|
1778 char ** volatile vol_argv = argv;
|
|
1779 char ** volatile vol_envp = envp;
|
0
|
1780 #ifdef QUANTIFY
|
|
1781 quantify_stop_recording_data ();
|
|
1782 quantify_clear_data ();
|
|
1783 #endif /* QUANTIFY */
|
|
1784
|
|
1785 suppress_early_backtrace = 0;
|
|
1786 lim_data = 0; /* force reinitialization of this variable */
|
|
1787
|
78
|
1788 /* Lisp_Object must fit in a word; check VALBITS and GCTYPEBITS */
|
|
1789 assert (sizeof (Lisp_Object) == sizeof (void *));
|
|
1790
|
0
|
1791 if (!initialized)
|
78
|
1792 {
|
|
1793 run_temacs_argc = 0;
|
|
1794 if (! SETJMP (run_temacs_catch))
|
|
1795 main_1 (vol_argc, vol_argv, vol_envp);
|
|
1796 /* run-emacs-from-temacs called */
|
|
1797 vol_argc = run_temacs_argc;
|
|
1798 vol_argv = run_temacs_argv;
|
0
|
1799 #ifdef _SCO_DS
|
78
|
1800 /* This makes absolutely no sense to anyone involved. There are
|
|
1801 several people using this stuff. We've compared versions on
|
|
1802 everything we can think of. We can find no difference.
|
|
1803 However, on both my systems environ is a plain old global
|
|
1804 variable initialized to zero. _environ is the one that
|
|
1805 contains pointers to the actual environment.
|
163
|
1806
|
78
|
1807 Since we can't figure out the difference (and we're hours
|
|
1808 away from a release), this takes a very cowardly approach and
|
|
1809 is bracketed with both a system specific preprocessor test
|
|
1810 and a runtime "do you have this problem" test
|
163
|
1811
|
78
|
1812 06/20/96 robertl@dgii.com */
|
|
1813 {
|
|
1814 extern char *_environ;
|
|
1815 if ((unsigned) environ == 0)
|
|
1816 environ=_environ;
|
|
1817 }
|
16
|
1818 #endif /* _SCO_DS */
|
80
|
1819 vol_envp = environ;
|
|
1820 }
|
0
|
1821 run_temacs_argc = -1;
|
|
1822
|
16
|
1823 main_1 (vol_argc, vol_argv, vol_envp);
|
163
|
1824 return 0; /* unreached */
|
0
|
1825 }
|
|
1826
|
|
1827
|
20
|
1828 DEFUN ("kill-emacs", Fkill_emacs, 0, 1, "P", /*
|
0
|
1829 Exit the XEmacs job and kill it. Ask for confirmation, without argument.
|
|
1830 If ARG is an integer, return ARG as the exit program code.
|
|
1831 If ARG is a string, stuff it as keyboard input.
|
|
1832
|
|
1833 The value of `kill-emacs-hook', if not void,
|
|
1834 is a list of functions (of no args),
|
|
1835 all of which are called before XEmacs is actually killed.
|
20
|
1836 */
|
|
1837 (arg))
|
0
|
1838 {
|
|
1839 /* This function can GC */
|
|
1840 struct gcpro gcpro1;
|
|
1841
|
|
1842 GCPRO1 (arg);
|
|
1843
|
|
1844 if (feof (stdin))
|
|
1845 arg = Qt;
|
|
1846
|
|
1847 if (!preparing_for_armageddon && !noninteractive)
|
|
1848 run_hook (Qkill_emacs_hook);
|
|
1849
|
|
1850 /* make sure no quitting from now on!! */
|
|
1851 dont_check_for_quit = 1;
|
|
1852 Vinhibit_quit = Qt;
|
|
1853
|
|
1854 if (!preparing_for_armageddon)
|
|
1855 {
|
|
1856 Lisp_Object concons;
|
|
1857
|
|
1858 /* Normally, go ahead and delete all the consoles now.
|
|
1859 Some unmentionably lame window systems (MS Wwwww...... eek,
|
|
1860 I can't even say it) don't properly clean up after themselves,
|
|
1861 and even for those that do, it might be cleaner this way.
|
|
1862 If we're going down, however, we don't do this (might
|
|
1863 be too dangerous), and if we get a crash somewhere within
|
|
1864 this loop, we'll still autosave and won't try this again. */
|
|
1865 CONSOLE_LOOP (concons)
|
|
1866 delete_console_internal (XCONSOLE (XCAR (concons)), 1, 1, 0);
|
|
1867 }
|
|
1868
|
|
1869 UNGCPRO;
|
|
1870
|
|
1871 shut_down_emacs (0, ((STRINGP (arg)) ? arg : Qnil));
|
|
1872
|
207
|
1873 exit ((INTP (arg)) ? XINT (arg) : 0);
|
0
|
1874 /* NOTREACHED */
|
|
1875 return Qnil; /* I'm sick of the compiler warning */
|
|
1876 }
|
|
1877
|
|
1878 /* Perform an orderly shutdown of XEmacs. Autosave any modified
|
|
1879 buffers, kill any child processes, clean up the terminal modes (if
|
|
1880 we're in the foreground), and other stuff like that. Don't perform
|
|
1881 any redisplay; this may be called when XEmacs is shutting down in
|
|
1882 the background, or after its X connection has died.
|
|
1883
|
|
1884 If SIG is a signal number, print a message for it.
|
|
1885
|
|
1886 This is called by fatal signal handlers, X protocol error handlers,
|
|
1887 and Fkill_emacs. */
|
|
1888 static void
|
|
1889 shut_down_emacs (int sig, Lisp_Object stuff)
|
|
1890 {
|
|
1891 /* This function can GC */
|
|
1892 /* Prevent running of hooks and other non-essential stuff
|
|
1893 from now on. */
|
|
1894 preparing_for_armageddon = 1;
|
|
1895
|
|
1896 /* In case frames or windows are screwed up, avoid assertion
|
|
1897 failures here */
|
|
1898 Vinhibit_quit = Qt;
|
|
1899
|
|
1900 #ifdef QUANTIFY
|
|
1901 quantify_stop_recording_data ();
|
|
1902 #endif /* QUANTIFY */
|
|
1903
|
|
1904 /* This is absolutely the most important thing to do, so make sure
|
|
1905 we do it now, before anything else. We might have crashed and
|
|
1906 be in a weird inconsistent state, and potentially anything could
|
|
1907 set off another protection fault and cause us to bail out
|
|
1908 immediately. */
|
|
1909 Fdo_auto_save (Qt, Qnil); /* do this before anything hazardous */
|
|
1910
|
|
1911 fflush (stdout);
|
|
1912 reset_all_consoles ();
|
|
1913 if (sig && sig != SIGTERM)
|
|
1914 {
|
|
1915 stderr_out ("\nFatal error (%d).\n", sig);
|
|
1916 stderr_out
|
|
1917 ("Your files have been auto-saved.\n"
|
|
1918 "Use `M-x recover-session' to recover them.\n"
|
|
1919 "\n"
|
126
|
1920 "Please report this bug by running the send-pr script included\n"
|
|
1921 "with XEmacs, or selecting `Send Bug Report' from the help menu.\n"
|
|
1922 "As a last resort send ordinary email to `crashes@xemacs.org'.\n"
|
2
|
1923 "*MAKE SURE* to include as much configuration information as\n"
|
|
1924 "possible; at the very least what OS and hardware you are running\n"
|
|
1925 "on, and hopefully also what compiler and compiler options the\n"
|
|
1926 "binary was compiled with, what options XEmacs was compiled with,\n"
|
|
1927 "whether you are using a prebuilt binary from ftp.xemacs.org or\n"
|
|
1928 "compiled XEmacs yourself for your system, etc.\n"
|
|
1929 "\n"
|
0
|
1930 "If at all possible, *please* try to obtain a C stack backtrace;\n"
|
|
1931 "it will help us immensely in determining what went wrong.\n"
|
|
1932 "To do this, locate the core file that was produced as a result\n"
|
|
1933 "of this crash (it's usually called `core' and is located in the\n"
|
|
1934 "directory in which you started XEmacs, or maybe in your home\n"
|
|
1935 "directory), and type\n"
|
|
1936 "\n"
|
|
1937 " gdb ");
|
|
1938 {
|
2
|
1939 CONST char *name;
|
0
|
1940 char *dir = 0;
|
|
1941
|
|
1942 /* Now try to determine the actual path to the executable,
|
|
1943 to try to make the backtrace-determination process as foolproof
|
|
1944 as possible. */
|
|
1945 if (GC_STRINGP (Vinvocation_name))
|
14
|
1946 name = (char *) XSTRING_DATA (Vinvocation_name);
|
0
|
1947 else
|
|
1948 name = "xemacs";
|
|
1949 if (GC_STRINGP (Vinvocation_directory))
|
14
|
1950 dir = (char *) XSTRING_DATA (Vinvocation_directory);
|
0
|
1951 if (!dir || dir[0] != '/')
|
|
1952 stderr_out ("`which %s`", name);
|
|
1953 else if (dir[strlen (dir) - 1] != '/')
|
|
1954 stderr_out ("%s/%s", dir, name);
|
|
1955 else
|
|
1956 stderr_out ("%s%s", dir, name);
|
|
1957 }
|
|
1958 stderr_out
|
|
1959 (" core\n\n"
|
|
1960 "then type `where' when the debugger prompt comes up.\n"
|
|
1961 "(If you don't have GDB on your system, you might have DBX,\n"
|
|
1962 "or XDB, or SDB. A similar procedure should work for all of\n"
|
|
1963 "these. Ask your system administrator if you need more help.)\n");
|
|
1964 }
|
|
1965
|
|
1966 stuff_buffered_input (stuff);
|
|
1967
|
|
1968 kill_buffer_processes (Qnil);
|
|
1969
|
|
1970 #ifdef CLASH_DETECTION
|
|
1971 unlock_all_files ();
|
|
1972 #endif
|
|
1973
|
|
1974 #ifdef TOOLTALK
|
|
1975 tt_session_quit (tt_default_session ());
|
2
|
1976 #if 0
|
|
1977 /* The following crashes when built on X11R5 and run on X11R6 */
|
0
|
1978 tt_close ();
|
|
1979 #endif
|
2
|
1980 #endif /* TOOLTALK */
|
0
|
1981
|
|
1982 }
|
|
1983
|
|
1984
|
|
1985 #ifndef CANNOT_DUMP
|
|
1986 /* Nothing like this can be implemented on an Apollo.
|
|
1987 What a loss! */
|
|
1988
|
2
|
1989 extern char my_edata[];
|
0
|
1990
|
|
1991 #ifdef HAVE_SHM
|
|
1992
|
20
|
1993 DEFUN ("dump-emacs-data", Fdump_emacs_data, 1, 1, 0, /*
|
0
|
1994 Dump current state of XEmacs into data file FILENAME.
|
|
1995 This function exists on systems that use HAVE_SHM.
|
20
|
1996 */
|
|
1997 (intoname))
|
0
|
1998 {
|
|
1999 /* This function can GC */
|
|
2000 int opurify;
|
|
2001 struct gcpro gcpro1;
|
|
2002 GCPRO1 (intoname);
|
|
2003
|
|
2004 CHECK_STRING (intoname);
|
|
2005 intoname = Fexpand_file_name (intoname, Qnil);
|
|
2006
|
|
2007 opurify = purify_flag;
|
|
2008 purify_flag = 0;
|
|
2009
|
|
2010 fflush (stderr);
|
|
2011 fflush (stdout);
|
|
2012
|
|
2013 disksave_object_finalization ();
|
|
2014 release_breathing_space ();
|
|
2015
|
|
2016 /* Tell malloc where start of impure now is */
|
|
2017 /* Also arrange for warnings when nearly out of space. */
|
|
2018 #ifndef SYSTEM_MALLOC
|
173
|
2019 memory_warnings (my_edata, malloc_warning);
|
0
|
2020 #endif
|
|
2021 UNGCPRO;
|
14
|
2022 map_out_data (XSTRING_DATA (intoname));
|
0
|
2023
|
|
2024 purify_flag = opurify;
|
|
2025
|
|
2026 return Qnil;
|
|
2027 }
|
|
2028
|
|
2029 #else /* not HAVE_SHM */
|
|
2030
|
20
|
2031 DEFUN ("dump-emacs", Fdump_emacs, 2, 2, 0, /*
|
0
|
2032 Dump current state of XEmacs into executable file FILENAME.
|
|
2033 Take symbols from SYMFILE (presumably the file you executed to run XEmacs).
|
|
2034 This is used in the file `loadup.el' when building XEmacs.
|
|
2035
|
|
2036 Remember to set `command-line-processed' to nil before dumping
|
|
2037 if you want the dumped XEmacs to process its command line
|
|
2038 and announce itself normally when it is run.
|
20
|
2039 */
|
|
2040 (intoname, symname))
|
0
|
2041 {
|
|
2042 /* This function can GC */
|
|
2043 struct gcpro gcpro1, gcpro2;
|
|
2044 int opurify;
|
|
2045
|
|
2046 GCPRO2 (intoname, symname);
|
|
2047
|
|
2048 #ifdef FREE_CHECKING
|
|
2049 Freally_free (Qnil);
|
|
2050
|
|
2051 /* When we're dumping, we can't use the debugging free() */
|
|
2052
|
|
2053 disable_free_hook ();
|
|
2054 #endif
|
|
2055
|
|
2056 CHECK_STRING (intoname);
|
|
2057 intoname = Fexpand_file_name (intoname, Qnil);
|
|
2058 if (!NILP (symname))
|
|
2059 {
|
|
2060 CHECK_STRING (symname);
|
14
|
2061 if (XSTRING_LENGTH (symname) > 0)
|
0
|
2062 symname = Fexpand_file_name (symname, Qnil);
|
|
2063 else
|
|
2064 symname = Qnil;
|
|
2065 }
|
|
2066
|
|
2067 opurify = purify_flag;
|
|
2068 purify_flag = 0;
|
|
2069
|
207
|
2070 #ifdef DEBUG_XEMACS
|
0
|
2071 report_pure_usage (1, 1);
|
207
|
2072 #else
|
|
2073 report_pure_usage (0, 1);
|
|
2074 #endif
|
0
|
2075
|
|
2076 fflush (stderr);
|
|
2077 fflush (stdout);
|
|
2078
|
|
2079 disksave_object_finalization ();
|
|
2080 release_breathing_space ();
|
|
2081
|
|
2082 /* Tell malloc where start of impure now is */
|
|
2083 /* Also arrange for warnings when nearly out of space. */
|
|
2084 #ifndef SYSTEM_MALLOC
|
173
|
2085 memory_warnings (my_edata, malloc_warning);
|
0
|
2086 #endif
|
|
2087
|
|
2088 UNGCPRO;
|
|
2089
|
|
2090 #if defined (MSDOS) && defined (EMX)
|
|
2091 {
|
14
|
2092 int fd = open ((char *) XSTRING_DATA (intoname),
|
0
|
2093 O_WRONLY|O_CREAT|O_TRUNC, S_IREAD|S_IWRITE);
|
|
2094 if (!fd) {
|
14
|
2095 error ("Failure operating on %s", XSTRING_DATA (intoname));
|
0
|
2096 } else {
|
|
2097 _core (fd);
|
|
2098 close (fd);
|
|
2099 }
|
|
2100 }
|
|
2101 #else /* not MSDOS and EMX */
|
|
2102 {
|
|
2103 CONST char *intoname_ext;
|
|
2104 CONST char *symname_ext;
|
|
2105
|
|
2106 GET_C_STRING_FILENAME_DATA_ALLOCA (intoname, intoname_ext);
|
|
2107 if (STRINGP (symname))
|
|
2108 GET_C_STRING_FILENAME_DATA_ALLOCA (symname, symname_ext);
|
|
2109 else
|
|
2110 symname_ext = 0;
|
|
2111 /* here we break our rule that the filename conversion should
|
|
2112 be performed at the actual time that the system call is made.
|
|
2113 It's a whole lot easier to do the conversion here than to
|
|
2114 modify all the unexec routines to ensure that filename
|
|
2115 conversion is applied everywhere. Don't worry about memory
|
|
2116 leakage because this call only happens once. */
|
|
2117 unexec ((char *) intoname_ext, (char *) symname_ext,
|
173
|
2118 (uintptr_t) my_edata,
|
0
|
2119 0, 0);
|
|
2120 }
|
|
2121 #endif /* not MSDOS and EMX */
|
|
2122
|
|
2123 purify_flag = opurify;
|
|
2124
|
|
2125 return Qnil;
|
|
2126 }
|
|
2127
|
|
2128 #endif /* not HAVE_SHM */
|
|
2129
|
|
2130 #endif /* not CANNOT_DUMP */
|
|
2131
|
|
2132 #ifndef SEPCHAR
|
|
2133 #define SEPCHAR ':'
|
|
2134 #endif
|
|
2135
|
|
2136 Lisp_Object
|
177
|
2137 decode_path (CONST char *path)
|
0
|
2138 {
|
|
2139 REGISTER CONST char *p;
|
|
2140 Lisp_Object lpath = Qnil;
|
|
2141
|
177
|
2142 if (!path || !strlen(path)) return Qnil;
|
0
|
2143
|
|
2144 #if defined (MSDOS) || defined (WIN32)
|
|
2145 dostounix_filename (path);
|
|
2146 #endif
|
|
2147
|
|
2148 while (1)
|
|
2149 {
|
|
2150 p = strchr (path, SEPCHAR);
|
|
2151 if (!p) p = path + strlen (path);
|
|
2152 lpath = Fcons (((p != path)
|
|
2153 ? make_string ((CONST Bufbyte *) path, p - path)
|
|
2154 : Qnil),
|
|
2155 lpath);
|
|
2156 if (*p)
|
|
2157 path = p + 1;
|
|
2158 else
|
|
2159 break;
|
|
2160 }
|
|
2161 return Fnreverse (lpath);
|
|
2162 }
|
|
2163
|
177
|
2164 Lisp_Object
|
|
2165 decode_env_path (CONST char *evarname, CONST char *default_)
|
|
2166 {
|
|
2167 REGISTER CONST char *path = 0;
|
|
2168 if (evarname)
|
|
2169 path = (char *) egetenv (evarname);
|
|
2170 if (!path)
|
|
2171 path = default_;
|
|
2172 if (!path)
|
|
2173 return Qnil;
|
|
2174 else
|
|
2175 return decode_path(path);
|
|
2176 }
|
|
2177
|
20
|
2178 DEFUN ("noninteractive", Fnoninteractive, 0, 0, 0, /*
|
0
|
2179 Non-nil return value means XEmacs is running without interactive terminal.
|
20
|
2180 */
|
|
2181 ())
|
0
|
2182 {
|
173
|
2183 return noninteractive ? Qt : Qnil;
|
0
|
2184 }
|
|
2185
|
|
2186 /* This flag is useful to define if you're under a debugger; this way, you
|
|
2187 can put a breakpoint of assert_failed() and debug multiple problems
|
|
2188 in one session without having to recompile. */
|
|
2189 /* #define ASSERTIONS_DONT_ABORT */
|
|
2190
|
70
|
2191 #ifdef USE_ASSERTIONS
|
0
|
2192 /* This highly dubious kludge ... shut up Jamie, I'm tired of your slagging. */
|
|
2193
|
|
2194 DOESNT_RETURN
|
|
2195 assert_failed (CONST char *file, int line, CONST char *expr)
|
|
2196 {
|
|
2197 stderr_out ("Fatal error: assertion failed, file %s, line %d, %s\n",
|
|
2198 file, line, expr);
|
|
2199 #undef abort /* avoid infinite #define loop... */
|
|
2200 #ifndef ASSERTIONS_DONT_ABORT
|
|
2201 abort ();
|
|
2202 #endif
|
|
2203 }
|
70
|
2204 #endif /* USE_ASSERTIONS */
|
0
|
2205
|
|
2206 #ifdef QUANTIFY
|
20
|
2207 DEFUN ("quantify-start-recording-data",
|
|
2208 Fquantify_start_recording_data, 0, 0, 0, /*
|
0
|
2209 Start recording Quantify data.
|
20
|
2210 */
|
|
2211 ())
|
0
|
2212 {
|
|
2213 quantify_start_recording_data ();
|
|
2214 return Qnil;
|
|
2215 }
|
|
2216
|
20
|
2217 DEFUN ("quantify-stop-recording-data",
|
|
2218 Fquantify_stop_recording_data, 0, 0, 0, /*
|
0
|
2219 Stop recording Quantify data.
|
20
|
2220 */
|
|
2221 ())
|
0
|
2222 {
|
|
2223 quantify_stop_recording_data ();
|
|
2224 return Qnil;
|
|
2225 }
|
|
2226
|
20
|
2227 DEFUN ("quantify-clear-data", Fquantify_clear_data, 0, 0, 0, /*
|
0
|
2228 Clear all Quantify data.
|
20
|
2229 */
|
|
2230 ())
|
0
|
2231 {
|
|
2232 quantify_clear_data ();
|
|
2233 return Qnil;
|
|
2234 }
|
|
2235 #endif /* QUANTIFY */
|
|
2236
|
|
2237 void
|
|
2238 syms_of_emacs (void)
|
|
2239 {
|
|
2240 #ifndef CANNOT_DUMP
|
|
2241 #ifdef HAVE_SHM
|
20
|
2242 DEFSUBR (Fdump_emacs_data);
|
0
|
2243 #else
|
20
|
2244 DEFSUBR (Fdump_emacs);
|
0
|
2245 #endif
|
|
2246 #endif /* !CANNOT_DUMP */
|
|
2247
|
20
|
2248 DEFSUBR (Frun_emacs_from_temacs);
|
|
2249 DEFSUBR (Frunning_temacs_p);
|
|
2250 DEFSUBR (Finvocation_name);
|
|
2251 DEFSUBR (Finvocation_directory);
|
|
2252 DEFSUBR (Fkill_emacs);
|
|
2253 DEFSUBR (Fnoninteractive);
|
0
|
2254
|
|
2255 #ifdef QUANTIFY
|
20
|
2256 DEFSUBR (Fquantify_start_recording_data);
|
|
2257 DEFSUBR (Fquantify_stop_recording_data);
|
|
2258 DEFSUBR (Fquantify_clear_data);
|
0
|
2259 #endif /* QUANTIFY */
|
|
2260
|
|
2261 defsymbol (&Qkill_emacs_hook, "kill-emacs-hook");
|
|
2262 defsymbol (&Qsave_buffers_kill_emacs, "save-buffers-kill-emacs");
|
|
2263 }
|
|
2264
|
|
2265 void
|
|
2266 vars_of_emacs (void)
|
|
2267 {
|
|
2268 DEFVAR_BOOL ("suppress-early-error-handler-backtrace",
|
|
2269 &suppress_early_backtrace /*
|
|
2270 Non-nil means early error handler shouldn't print a backtrace
|
|
2271 */ );
|
|
2272
|
|
2273 DEFVAR_LISP ("command-line-args", &Vcommand_line_args /*
|
|
2274 Args passed by shell to XEmacs, as a list of strings.
|
|
2275 */ );
|
|
2276
|
|
2277 DEFVAR_LISP ("invocation-name", &Vinvocation_name /*
|
|
2278 The program name that was used to run XEmacs.
|
|
2279 Any directory names are omitted.
|
|
2280 */ );
|
|
2281
|
|
2282 DEFVAR_LISP ("invocation-directory", &Vinvocation_directory /*
|
|
2283 The directory in which the XEmacs executable was found, to run it.
|
|
2284 The value is simply the program name if that directory's name is not known.
|
|
2285 */ );
|
|
2286
|
|
2287 #if 0 /* FSFmacs */
|
|
2288 xxDEFVAR_LISP ("installation-directory", &Vinstallation_directory,
|
|
2289 "A directory within which to look for the `lib-src' and `etc' directories.\n"
|
|
2290 "This is non-nil when we can't find those directories in their standard\n"
|
|
2291 "installed locations, but we can find them\n"
|
|
2292 "near where the XEmacs executable was found.");
|
|
2293 #endif
|
|
2294
|
|
2295 DEFVAR_LISP ("system-type", &Vsystem_type /*
|
|
2296 Value is symbol indicating type of operating system you are using.
|
|
2297 */ );
|
|
2298 Vsystem_type = intern (SYSTEM_TYPE);
|
169
|
2299 Fprovide (intern(SYSTEM_TYPE));
|
0
|
2300
|
|
2301 #ifndef EMACS_CONFIGURATION
|
|
2302 # define EMACS_CONFIGURATION "UNKNOWN"
|
|
2303 #endif
|
|
2304 DEFVAR_LISP ("system-configuration", &Vsystem_configuration /*
|
|
2305 Value is string indicating configuration XEmacs was built for.
|
|
2306 */ );
|
|
2307 Vsystem_configuration = Fpurecopy (build_string (EMACS_CONFIGURATION));
|
|
2308
|
175
|
2309 #ifndef EMACS_CONFIG_OPTIONS
|
|
2310 # define EMACS_CONFIG_OPTIONS "UNKNOWN"
|
|
2311 #endif
|
|
2312 DEFVAR_LISP ("system-configuration-options", &Vsystem_configuration_options /*
|
|
2313 String containing the configuration options XEmacs was built with.
|
|
2314 */ );
|
|
2315 Vsystem_configuration_options = Fpurecopy (build_string
|
|
2316 (EMACS_CONFIG_OPTIONS));
|
|
2317
|
165
|
2318 DEFVAR_LISP ("emacs-major-version", &Vemacs_major_version /*
|
|
2319 Major version number of this version of Emacs, as an integer.
|
|
2320 Warning: this variable did not exist in Emacs versions earlier than:
|
|
2321 FSF Emacs: 19.23
|
|
2322 XEmacs: 19.10
|
|
2323 */ );
|
|
2324 Vemacs_major_version = make_int (EMACS_MAJOR_VERSION);
|
|
2325
|
|
2326 DEFVAR_LISP ("emacs-minor-version", &Vemacs_minor_version /*
|
|
2327 Minor version number of this version of Emacs, as an integer.
|
|
2328 Warning: this variable did not exist in Emacs versions earlier than:
|
|
2329 FSF Emacs: 19.23
|
|
2330 XEmacs: 19.10
|
|
2331 */ );
|
|
2332 Vemacs_minor_version = make_int (EMACS_MINOR_VERSION);
|
|
2333
|
|
2334 DEFVAR_LISP ("emacs-beta-version", &Vemacs_beta_version /*
|
163
|
2335 Beta number of this version of Emacs, as an integer.
|
|
2336 The value is nil if this is an officially released version of XEmacs.
|
|
2337 Warning: this variable does not exist in FSF Emacs or in XEmacs versions
|
|
2338 earlier than 20.3.
|
|
2339 */ );
|
165
|
2340 #ifdef EMACS_BETA_VERSION
|
|
2341 Vemacs_beta_version = make_int (EMACS_BETA_VERSION);
|
|
2342 #else
|
|
2343 Vemacs_beta_version = Qnil;
|
163
|
2344 #endif
|
|
2345
|
|
2346 DEFVAR_LISP ("xemacs-codename", &Vxemacs_codename /*
|
|
2347 Codename of this version of Emacs (a string).
|
|
2348 */ );
|
|
2349 #ifndef XEMACS_CODENAME
|
165
|
2350 #define XEMACS_CODENAME "Noname"
|
163
|
2351 #endif
|
|
2352 Vxemacs_codename = Fpurecopy (build_string (XEMACS_CODENAME));
|
|
2353
|
177
|
2354 DEFVAR_LISP ("package-path", &Vpackage_path /*
|
|
2355 List of directories configured for package searching.
|
|
2356 */ );
|
|
2357 #ifndef PACKAGE_PATH
|
187
|
2358 #define PACKAGE_PATH "~/.xemacs:" PATH_PREFIX "/lib/xemacs/packages"
|
177
|
2359 #endif
|
|
2360 Vpackage_path = decode_path(PACKAGE_PATH);
|
|
2361
|
0
|
2362 DEFVAR_BOOL ("noninteractive", &noninteractive1 /*
|
|
2363 Non-nil means XEmacs is running without interactive terminal.
|
|
2364 */ );
|
|
2365
|
207
|
2366 DEFVAR_BOOL ("inhibit-package-init", &inhibit_package_init /*
|
|
2367 Set to non-nil when the package-path should not be searched at startup.
|
|
2368 */ );
|
|
2369
|
0
|
2370 DEFVAR_INT ("emacs-priority", &emacs_priority /*
|
|
2371 Priority for XEmacs to run at.
|
|
2372 This value is effective only if set before XEmacs is dumped,
|
|
2373 and only if the XEmacs executable is installed with setuid to permit
|
|
2374 it to change priority. (XEmacs sets its uid back to the real uid.)
|
|
2375 Currently, you need to define SET_EMACS_PRIORITY in `config.h'
|
|
2376 before you compile XEmacs, to enable the code for this feature.
|
|
2377 */ );
|
|
2378 emacs_priority = 0;
|
163
|
2379
|
0
|
2380 }
|