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