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