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