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