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