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