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