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