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 ();
|
282
|
893 #ifdef HAVE_DRAGNDROP
|
|
894 syms_of_dragdrop ();
|
|
895 #endif
|
0
|
896 syms_of_event_stream ();
|
|
897 syms_of_events ();
|
|
898 syms_of_extents ();
|
|
899 syms_of_faces ();
|
|
900 syms_of_fileio ();
|
|
901 #ifdef CLASH_DETECTION
|
|
902 syms_of_filelock ();
|
|
903 #endif /* CLASH_DETECTION */
|
|
904 syms_of_floatfns ();
|
|
905 syms_of_fns ();
|
|
906 syms_of_font_lock ();
|
|
907 syms_of_frame ();
|
|
908 syms_of_general ();
|
|
909 syms_of_glyphs ();
|
280
|
910 syms_of_glyphs_eimage ();
|
0
|
911 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
|
|
912 syms_of_gui ();
|
|
913 #endif
|
|
914 syms_of_indent ();
|
|
915 syms_of_intl ();
|
|
916 syms_of_keymap ();
|
|
917 syms_of_lread ();
|
|
918 syms_of_macros ();
|
|
919 syms_of_marker ();
|
|
920 syms_of_md5 ();
|
|
921 #ifdef HAVE_DATABASE
|
272
|
922 syms_of_database ();
|
0
|
923 #endif
|
|
924 #ifdef HAVE_MENUBARS
|
|
925 syms_of_menubar ();
|
|
926 #endif
|
|
927 syms_of_minibuf ();
|
|
928 syms_of_objects ();
|
|
929 syms_of_print ();
|
|
930 #if !defined (NO_SUBPROCESSES)
|
|
931 syms_of_process ();
|
|
932 #endif
|
|
933 syms_of_profile ();
|
255
|
934 #if defined (HAVE_MMAP) && defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC)
|
0
|
935 syms_of_ralloc ();
|
|
936 #endif /* HAVE_MMAP && REL_ALLOC */
|
|
937 syms_of_rangetab ();
|
|
938 syms_of_redisplay ();
|
|
939 syms_of_search ();
|
|
940 syms_of_signal ();
|
|
941 syms_of_sound ();
|
|
942 syms_of_specifier ();
|
|
943 syms_of_symbols ();
|
|
944 syms_of_syntax ();
|
|
945 #ifdef HAVE_SCROLLBARS
|
|
946 syms_of_scrollbar ();
|
|
947 #endif
|
|
948 #ifdef HAVE_TOOLBARS
|
|
949 syms_of_toolbar ();
|
|
950 #endif
|
|
951 syms_of_undo ();
|
195
|
952 syms_of_widget ();
|
0
|
953 syms_of_window ();
|
195
|
954
|
0
|
955 #ifdef HAVE_TTY
|
|
956 syms_of_console_tty ();
|
|
957 syms_of_device_tty ();
|
|
958 syms_of_objects_tty ();
|
|
959 #endif
|
|
960 #ifdef HAVE_X_WINDOWS
|
|
961 syms_of_device_x ();
|
|
962 #ifdef HAVE_DIALOGS
|
|
963 syms_of_dialog_x ();
|
|
964 #endif
|
|
965 syms_of_event_Xt ();
|
|
966 syms_of_frame_x ();
|
|
967 syms_of_glyphs_x ();
|
|
968 syms_of_objects_x ();
|
|
969 #ifdef HAVE_MENUBARS
|
|
970 syms_of_menubar_x ();
|
|
971 #endif
|
|
972 syms_of_xselect ();
|
|
973 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
|
|
974 syms_of_gui_x ();
|
|
975 #endif
|
|
976 #endif /* HAVE_X_WINDOWS */
|
|
977
|
213
|
978 #ifdef HAVE_MS_WINDOWS
|
|
979 syms_of_console_mswindows ();
|
|
980 syms_of_device_mswindows ();
|
|
981 syms_of_event_mswindows ();
|
|
982 syms_of_frame_mswindows ();
|
|
983 syms_of_objects_mswindows ();
|
221
|
984 syms_of_select_mswindows ();
|
267
|
985 syms_of_glyphs_mswindows ();
|
231
|
986 #ifdef HAVE_MENUBARS
|
|
987 syms_of_menubar_mswindows ();
|
|
988 #endif
|
276
|
989 #ifdef HAVE_SCROLLBARS
|
|
990 syms_of_scrollbar_mswindows ();
|
|
991 #endif
|
263
|
992 #ifdef HAVE_MSW_C_DIRED
|
|
993 syms_of_dired_mswindows ();
|
209
|
994 #endif
|
263
|
995 #endif /* HAVE_MS_WINDOWS */
|
209
|
996
|
70
|
997 #ifdef MULE
|
|
998 syms_of_mule ();
|
|
999 syms_of_mule_ccl ();
|
|
1000 syms_of_mule_charset ();
|
259
|
1001 #endif
|
|
1002 #ifdef FILE_CODING
|
70
|
1003 syms_of_mule_coding ();
|
259
|
1004 #endif
|
|
1005 #ifdef MULE
|
70
|
1006 #ifdef HAVE_WNN
|
|
1007 syms_of_mule_wnn ();
|
|
1008 #endif
|
|
1009 #ifdef HAVE_CANNA
|
|
1010 syms_of_mule_canna ();
|
|
1011 #endif /* HAVE_CANNA */
|
|
1012 #endif /* MULE */
|
|
1013
|
0
|
1014 #ifdef SYMS_SYSTEM
|
|
1015 SYMS_SYSTEM;
|
|
1016 #endif
|
|
1017
|
|
1018 #ifdef SYMS_MACHINE
|
|
1019 SYMS_MACHINE;
|
|
1020 #endif
|
|
1021
|
|
1022 #ifdef EMACS_BTL
|
163
|
1023 syms_of_btl ();
|
0
|
1024 #endif
|
|
1025
|
269
|
1026 /*
|
267
|
1027 #if defined (GNU_MALLOC) && \
|
|
1028 defined (ERROR_CHECK_MALLOC) && \
|
|
1029 !defined (HAVE_LIBMCHECK)
|
269
|
1030 */
|
267
|
1031 /* Prior to XEmacs 21, this was `#if 0'ed out. -slb */
|
269
|
1032 #if defined (LOSING_GCC_DESTRUCTOR_FREE_BUG)
|
0
|
1033 syms_of_free_hook ();
|
|
1034 #endif
|
|
1035
|
|
1036 #ifdef TOOLTALK
|
|
1037 syms_of_tooltalk ();
|
|
1038 #endif
|
|
1039
|
|
1040 #ifdef SUNPRO
|
|
1041 syms_of_sunpro ();
|
|
1042 #endif
|
|
1043
|
259
|
1044 #ifdef HAVE_LDAP
|
|
1045 syms_of_eldap ();
|
|
1046 #endif
|
|
1047
|
0
|
1048 /* Now create the subtypes for the types that have them.
|
|
1049 We do this before the vars_*() because more symbols
|
|
1050 may get initialized here. */
|
|
1051
|
|
1052 /* Now initialize the console types and associated symbols.
|
|
1053 Other than the first function below, the functions may
|
|
1054 make exactly the following function/macro calls:
|
|
1055
|
|
1056 INITIALIZE_CONSOLE_TYPE()
|
|
1057 CONSOLE_HAS_METHOD()
|
|
1058
|
|
1059 For any given console type, the former macro must be called
|
|
1060 before the any calls to the latter macro. */
|
|
1061
|
|
1062 console_type_create ();
|
|
1063
|
|
1064 console_type_create_stream ();
|
|
1065
|
|
1066 #ifdef HAVE_TTY
|
|
1067 console_type_create_tty ();
|
|
1068 console_type_create_device_tty ();
|
|
1069 console_type_create_frame_tty ();
|
|
1070 console_type_create_objects_tty ();
|
|
1071 console_type_create_redisplay_tty ();
|
|
1072 #endif
|
|
1073
|
|
1074 #ifdef HAVE_X_WINDOWS
|
|
1075 console_type_create_x ();
|
|
1076 console_type_create_device_x ();
|
|
1077 console_type_create_frame_x ();
|
|
1078 console_type_create_glyphs_x ();
|
|
1079 #ifdef HAVE_MENUBARS
|
|
1080 console_type_create_menubar_x ();
|
|
1081 #endif
|
|
1082 console_type_create_objects_x ();
|
|
1083 console_type_create_redisplay_x ();
|
|
1084 #ifdef HAVE_SCROLLBARS
|
|
1085 console_type_create_scrollbar_x ();
|
|
1086 #endif
|
|
1087 #ifdef HAVE_TOOLBARS
|
|
1088 console_type_create_toolbar_x ();
|
|
1089 #endif
|
|
1090 #endif /* HAVE_X_WINDOWS */
|
|
1091
|
213
|
1092 #ifdef HAVE_MS_WINDOWS
|
|
1093 console_type_create_mswindows ();
|
|
1094 console_type_create_device_mswindows ();
|
|
1095 console_type_create_frame_mswindows ();
|
|
1096 console_type_create_objects_mswindows ();
|
|
1097 console_type_create_redisplay_mswindows ();
|
267
|
1098 console_type_create_glyphs_mswindows ();
|
225
|
1099 # ifdef HAVE_SCROLLBARS
|
|
1100 console_type_create_scrollbar_mswindows ();
|
|
1101 # endif
|
231
|
1102 #ifdef HAVE_MENUBARS
|
|
1103 console_type_create_menubar_mswindows ();
|
|
1104 #endif
|
276
|
1105 #ifdef HAVE_TOOLBARS
|
|
1106 console_type_create_toolbar_mswindows ();
|
|
1107 #endif
|
209
|
1108 #endif
|
|
1109
|
0
|
1110 /* Now initialize the specifier types and associated symbols.
|
|
1111 Other than the first function below, the functions may
|
|
1112 make exactly the following function/macro calls:
|
|
1113
|
|
1114 INITIALIZE_SPECIFIER_TYPE()
|
|
1115 SPECIFIER_HAS_METHOD()
|
|
1116
|
|
1117 For any given specifier type, the former macro must be called
|
|
1118 before the any calls to the latter macro. */
|
|
1119
|
|
1120 specifier_type_create ();
|
|
1121
|
|
1122 specifier_type_create_image ();
|
|
1123 specifier_type_create_objects ();
|
|
1124 #ifdef HAVE_TOOLBARS
|
|
1125 specifier_type_create_toolbar ();
|
|
1126 #endif
|
|
1127
|
|
1128 /* Now initialize the structure types and associated symbols.
|
|
1129 Other than the first function below, the functions may
|
|
1130 make exactly the following function/macro calls:
|
|
1131
|
|
1132 define_structure_type()
|
|
1133 define_structure_type_keyword()
|
|
1134
|
|
1135 */
|
|
1136
|
|
1137 structure_type_create ();
|
|
1138
|
70
|
1139 structure_type_create_chartab ();
|
0
|
1140 structure_type_create_faces ();
|
|
1141 structure_type_create_rangetab ();
|
223
|
1142 structure_type_create_hashtable ();
|
0
|
1143
|
|
1144 /* Now initialize the image instantiator formats and associated symbols.
|
|
1145 Other than the first function below, the functions may
|
|
1146 make exactly the following function/macro calls:
|
|
1147
|
|
1148 INITIALIZE_IMAGE_INSTANTIATOR_FORMAT()
|
|
1149 IIFORMAT_HAS_METHOD()
|
|
1150 IIFORMAT_VALID_KEYWORD()
|
|
1151
|
|
1152 For any given image instantiator format, the first macro must be
|
|
1153 called before the any calls to the other macros. */
|
|
1154
|
|
1155 image_instantiator_format_create ();
|
280
|
1156 image_instantiator_format_create_glyphs_eimage ();
|
0
|
1157 #ifdef HAVE_X_WINDOWS
|
|
1158 image_instantiator_format_create_glyphs_x ();
|
|
1159 #endif /* HAVE_X_WINDOWS */
|
267
|
1160 #ifdef HAVE_MS_WINDOWS
|
|
1161 image_instantiator_format_create_glyphs_mswindows ();
|
|
1162 #endif /* HAVE_MSWINDOWS_WINDOWS */
|
0
|
1163
|
|
1164 /* Now initialize the lstream types and associated symbols.
|
|
1165 Other than the first function below, the functions may
|
|
1166 make exactly the following function/macro calls:
|
|
1167
|
|
1168 LSTREAM_HAS_METHOD()
|
|
1169
|
|
1170 */
|
|
1171
|
|
1172 lstream_type_create ();
|
259
|
1173 #ifdef FILE_CODING
|
70
|
1174 lstream_type_create_mule_coding ();
|
|
1175 #endif
|
278
|
1176 #if defined (HAVE_MS_WINDOWS) && !defined(HAVE_MSG_SELECT)
|
274
|
1177 lstream_type_create_mswindows_selectable ();
|
|
1178 #endif
|
|
1179
|
263
|
1180 /* Initialize processes implementation.
|
|
1181 The functions may make exactly the following function/macro calls:
|
|
1182
|
|
1183 PROCESS_HAS_METHOD()
|
|
1184 */
|
|
1185 #ifdef HAVE_UNIX_PROCESSES
|
|
1186 process_type_create_unix ();
|
|
1187 #endif
|
|
1188 #ifdef HAVE_WIN32_PROCESSES
|
274
|
1189 process_type_create_nt ();
|
263
|
1190 #endif
|
|
1191
|
0
|
1192 /* Now initialize most variables.
|
|
1193
|
|
1194 These functions may do exactly the following:
|
|
1195
|
|
1196 DEFVAR_INT()
|
|
1197 DEFVAR_LISP()
|
|
1198 DEFVAR_BOOL()
|
|
1199 DEFER_GETTEXT()
|
|
1200 Dynarr_*()
|
|
1201 Blocktype_*()
|
|
1202 staticpro()
|
|
1203 Fprovide(symbol)
|
|
1204 intern()
|
|
1205 pure_put()
|
|
1206 xmalloc()
|
|
1207 defsymbol(), if it's absolutely necessary and you're sure that
|
|
1208 the symbol isn't referenced anywhere else in the initialization
|
|
1209 code
|
|
1210 Fset() on a symbol that is unbound
|
|
1211 assigning a symbol or constant value to a variable
|
|
1212 using a global variable that has been initialized
|
|
1213 earlier on in the same function
|
|
1214
|
|
1215 Any of the object-creating functions on alloc.c: e.g.
|
|
1216
|
|
1217 make_pure_*()
|
|
1218 Fpurecopy()
|
|
1219 make_string()
|
|
1220 build_string()
|
|
1221 make_vector()
|
|
1222 make_int()
|
|
1223 make_extent()
|
|
1224 alloc_lcrecord()
|
|
1225 Fcons()
|
|
1226 listN()
|
|
1227 make_opaque_ptr()
|
|
1228 make_opaque_long()
|
|
1229
|
|
1230 perhaps a few others.
|
|
1231 */
|
|
1232
|
|
1233 /* Now allow Fprovide() statements to be made. */
|
|
1234 init_provide_once ();
|
|
1235
|
|
1236 vars_of_abbrev ();
|
|
1237 vars_of_alloc ();
|
136
|
1238 #ifdef HAVE_X_WINDOWS
|
|
1239 vars_of_balloon_x ();
|
|
1240 #endif
|
0
|
1241 vars_of_buffer ();
|
|
1242 vars_of_bytecode ();
|
|
1243 vars_of_callint ();
|
|
1244 vars_of_callproc ();
|
|
1245 vars_of_cmdloop ();
|
|
1246 vars_of_cmds ();
|
|
1247 vars_of_console ();
|
|
1248 vars_of_data ();
|
|
1249 #ifdef DEBUG_XEMACS
|
|
1250 vars_of_debug ();
|
|
1251 #endif
|
|
1252 vars_of_console_stream ();
|
|
1253 vars_of_device ();
|
|
1254 #ifdef HAVE_DIALOGS
|
|
1255 vars_of_dialog ();
|
|
1256 #endif
|
|
1257 vars_of_dired ();
|
|
1258 vars_of_doc ();
|
|
1259 vars_of_editfns ();
|
|
1260 vars_of_elhash ();
|
|
1261 vars_of_emacs ();
|
|
1262 vars_of_eval ();
|
|
1263 vars_of_event_stream ();
|
|
1264 vars_of_events ();
|
|
1265 vars_of_extents ();
|
|
1266 vars_of_faces ();
|
|
1267 vars_of_fileio ();
|
|
1268 #ifdef CLASH_DETECTION
|
|
1269 vars_of_filelock ();
|
|
1270 #endif
|
|
1271 vars_of_floatfns ();
|
|
1272 vars_of_font_lock ();
|
|
1273 vars_of_frame ();
|
|
1274 vars_of_glyphs ();
|
280
|
1275 vars_of_glyphs_eimage ();
|
0
|
1276 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
|
|
1277 vars_of_gui ();
|
|
1278 #endif
|
|
1279 vars_of_indent ();
|
|
1280 vars_of_insdel ();
|
|
1281 vars_of_intl ();
|
70
|
1282 #ifdef HAVE_XIM
|
|
1283 #ifdef XIM_MOTIF
|
|
1284 vars_of_input_method_motif ();
|
|
1285 #else /* XIM_XLIB */
|
|
1286 vars_of_input_method_xlib ();
|
|
1287 #endif
|
|
1288 #endif /* HAVE_XIM */
|
0
|
1289 vars_of_keymap ();
|
|
1290 vars_of_lread ();
|
|
1291 vars_of_lstream ();
|
|
1292 vars_of_macros ();
|
|
1293 vars_of_md5 ();
|
|
1294 #ifdef HAVE_DATABASE
|
272
|
1295 vars_of_database ();
|
0
|
1296 #endif
|
|
1297 #ifdef HAVE_MENUBARS
|
|
1298 vars_of_menubar ();
|
|
1299 #endif
|
|
1300 vars_of_minibuf ();
|
|
1301 vars_of_objects ();
|
|
1302 vars_of_print ();
|
263
|
1303
|
0
|
1304 #ifndef NO_SUBPROCESSES
|
|
1305 vars_of_process ();
|
263
|
1306 #ifdef HAVE_UNIX_PROCESSES
|
|
1307 vars_of_process_unix ();
|
0
|
1308 #endif
|
263
|
1309 #ifdef HAVE_WIN32_PROCESSES
|
274
|
1310 vars_of_process_nt ();
|
263
|
1311 #endif
|
|
1312 #endif
|
|
1313
|
0
|
1314 vars_of_profile ();
|
255
|
1315 #if defined (HAVE_MMAP) && defined (REL_ALLOC) && !defined(DOUG_LEA_MALLOC)
|
0
|
1316 vars_of_ralloc ();
|
|
1317 #endif /* HAVE_MMAP && REL_ALLOC */
|
|
1318 vars_of_redisplay ();
|
|
1319 #ifdef HAVE_SCROLLBARS
|
|
1320 vars_of_scrollbar ();
|
|
1321 #endif
|
|
1322 vars_of_search ();
|
|
1323 vars_of_sound ();
|
|
1324 vars_of_specifier ();
|
|
1325 vars_of_symbols ();
|
|
1326 vars_of_syntax ();
|
|
1327 #ifdef HAVE_TOOLBARS
|
|
1328 vars_of_toolbar ();
|
|
1329 #endif
|
|
1330 vars_of_undo ();
|
|
1331 vars_of_window ();
|
|
1332
|
|
1333 #ifdef HAVE_TTY
|
|
1334 vars_of_console_tty ();
|
|
1335 vars_of_event_tty ();
|
|
1336 vars_of_frame_tty ();
|
|
1337 vars_of_objects_tty ();
|
|
1338 #endif
|
|
1339
|
|
1340 #ifdef HAVE_X_WINDOWS
|
|
1341 vars_of_device_x ();
|
|
1342 #ifdef HAVE_DIALOGS
|
|
1343 vars_of_dialog_x ();
|
|
1344 #endif
|
|
1345 vars_of_event_Xt ();
|
|
1346 vars_of_frame_x ();
|
|
1347 vars_of_glyphs_x ();
|
|
1348 #ifdef HAVE_MENUBARS
|
|
1349 vars_of_menubar_x ();
|
|
1350 #endif
|
|
1351 vars_of_objects_x ();
|
|
1352 vars_of_xselect ();
|
|
1353 #ifdef HAVE_SCROLLBARS
|
|
1354 vars_of_scrollbar_x ();
|
|
1355 #endif
|
|
1356 #if defined (HAVE_MENUBARS) || defined (HAVE_SCROLLBARS) || defined (HAVE_DIALOGS) || defined (HAVE_TOOLBARS)
|
|
1357 vars_of_gui_x ();
|
|
1358 #endif
|
|
1359 #endif
|
|
1360
|
213
|
1361 #ifdef HAVE_MS_WINDOWS
|
|
1362 vars_of_device_mswindows ();
|
|
1363 vars_of_console_mswindows ();
|
|
1364 vars_of_event_mswindows ();
|
|
1365 vars_of_frame_mswindows ();
|
|
1366 vars_of_objects_mswindows ();
|
221
|
1367 vars_of_select_mswindows ();
|
267
|
1368 vars_of_glyphs_mswindows ();
|
225
|
1369 #ifdef HAVE_SCROLLBARS
|
|
1370 vars_of_scrollbar_mswindows ();
|
|
1371 #endif
|
231
|
1372 #ifdef HAVE_MENUBARS
|
|
1373 vars_of_menubar_mswindows ();
|
|
1374 #endif
|
263
|
1375 #ifdef HAVE_MSW_C_DIRED
|
|
1376 vars_of_dired_mswindows ();
|
209
|
1377 #endif
|
263
|
1378 #endif /* HAVE_MS_WINDOWS */
|
209
|
1379
|
70
|
1380 #ifdef MULE
|
|
1381 vars_of_mule ();
|
|
1382 vars_of_mule_charset ();
|
259
|
1383 #endif
|
|
1384 #ifdef FILE_CODING
|
70
|
1385 vars_of_mule_coding ();
|
259
|
1386 #endif
|
|
1387 #ifdef MULE
|
70
|
1388 #ifdef HAVE_WNN
|
|
1389 vars_of_mule_wnn ();
|
|
1390 #endif
|
|
1391 #ifdef HAVE_CANNA
|
|
1392 vars_of_mule_canna ();
|
|
1393 #endif /* HAVE_CANNA */
|
|
1394 #endif /* MULE */
|
|
1395
|
0
|
1396 #ifdef TOOLTALK
|
|
1397 vars_of_tooltalk ();
|
|
1398 #endif
|
|
1399
|
|
1400 #ifdef SUNPRO
|
|
1401 vars_of_sunpro ();
|
|
1402 #endif
|
|
1403
|
259
|
1404 #ifdef HAVE_LDAP
|
|
1405 vars_of_eldap ();
|
|
1406 #endif
|
|
1407
|
0
|
1408 /* Now initialize any specifier variables. We do this later
|
|
1409 because it has some dependence on the vars initialized
|
|
1410 above.
|
|
1411
|
|
1412 These functions should *only* initialize specifier variables,
|
|
1413 and may make use of the following functions/macros in addition
|
|
1414 to the ones listed above:
|
|
1415
|
|
1416 DEFVAR_SPECIFIER()
|
|
1417 Fmake_specifier()
|
|
1418 set_specifier_fallback()
|
|
1419 set_specifier_caching()
|
|
1420 */
|
|
1421
|
|
1422 specifier_vars_of_glyphs ();
|
|
1423 #ifdef HAVE_MENUBARS
|
|
1424 specifier_vars_of_menubar ();
|
|
1425 #endif
|
|
1426 specifier_vars_of_redisplay ();
|
|
1427 #ifdef HAVE_SCROLLBARS
|
|
1428 specifier_vars_of_scrollbar ();
|
|
1429 #endif
|
|
1430 #ifdef HAVE_TOOLBARS
|
|
1431 specifier_vars_of_toolbar ();
|
|
1432 #endif
|
|
1433 specifier_vars_of_window ();
|
|
1434
|
|
1435 /* Now comes all the rest of the variables that couldn't
|
|
1436 be handled above. There may be dependencies on variables
|
|
1437 initialized above, and dependencies between one complex_vars_()
|
|
1438 function and another. */
|
|
1439
|
|
1440 /* Calls Fmake_range_table(). */
|
|
1441 complex_vars_of_regex ();
|
|
1442 /* Calls Fmake_range_table(). */
|
|
1443 complex_vars_of_search ();
|
|
1444
|
|
1445 /* Calls make_lisp_hashtable(). */
|
|
1446 complex_vars_of_extents ();
|
163
|
1447
|
0
|
1448 /* Depends on hashtables and specifiers. */
|
|
1449 complex_vars_of_faces ();
|
|
1450
|
70
|
1451 #ifdef MULE
|
|
1452 /* These two depend on hashtables and various variables declared
|
|
1453 earlier. The second may also depend on the first. */
|
|
1454 complex_vars_of_mule_charset ();
|
259
|
1455 #endif
|
|
1456 #if defined(FILE_CODING)
|
70
|
1457 complex_vars_of_mule_coding ();
|
|
1458 #endif
|
|
1459
|
0
|
1460 /* This calls allocate_glyph(), which creates specifiers
|
|
1461 and also relies on a variable (Vthe_nothing_vector) initialized
|
70
|
1462 above. It also calls make_ext_string(), which under Mule
|
|
1463 could require that the charsets be initialized. */
|
0
|
1464 complex_vars_of_glyphs ();
|
|
1465
|
175
|
1466 /* These rely on the glyphs just created in the previous function,
|
|
1467 and call Fadd_spec_to_specifier(), which relies on various
|
0
|
1468 variables initialized above. */
|
|
1469 #ifdef HAVE_X_WINDOWS
|
|
1470 complex_vars_of_glyphs_x ();
|
|
1471 #endif
|
267
|
1472 #ifdef HAVE_MS_WINDOWS
|
|
1473 complex_vars_of_glyphs_mswindows ();
|
|
1474 #endif
|
0
|
1475
|
|
1476 /* This calls Fmake_glyph_internal(). */
|
|
1477 complex_vars_of_alloc ();
|
|
1478
|
|
1479 /* This calls Fmake_glyph_internal(). */
|
|
1480 #ifdef HAVE_MENUBARS
|
|
1481 complex_vars_of_menubar ();
|
|
1482 #endif
|
|
1483
|
|
1484 /* This calls Fmake_glyph_internal(). */
|
|
1485 #ifdef HAVE_SCROLLBARS
|
|
1486 complex_vars_of_scrollbar ();
|
|
1487 #endif
|
|
1488
|
|
1489 /* This calls allocate_glyph(). */
|
|
1490 complex_vars_of_frame ();
|
|
1491
|
70
|
1492 /* This calls Fcopy_category_table() under Mule, which calls who
|
|
1493 knows what. */
|
|
1494 complex_vars_of_chartab ();
|
|
1495
|
0
|
1496 /* This calls set_string_char(), which (under Mule) depends on the
|
|
1497 charsets being initialized. */
|
|
1498 complex_vars_of_casetab ();
|
|
1499
|
|
1500 /* This calls Fcopy_syntax_table(), which relies on char tables. */
|
|
1501 complex_vars_of_syntax ();
|
|
1502
|
|
1503 /* This initializes buffer-local variables, sets things up so
|
|
1504 that buffers can be created, and creates a couple of basic
|
|
1505 buffers. This depends on Vstandard_syntax_table and
|
|
1506 Vstandard_category_table (initialized in the previous
|
|
1507 functions), as well as a whole horde of variables that may
|
|
1508 have been initialized above. */
|
|
1509 complex_vars_of_buffer ();
|
|
1510
|
|
1511 /* This initializes console-local variables. */
|
|
1512 complex_vars_of_console ();
|
|
1513
|
|
1514 /* This creates a couple more buffers, and depends on the
|
|
1515 previous function. */
|
|
1516 complex_vars_of_minibuf ();
|
|
1517
|
|
1518 /* These two might call Ffile_name_as_directory(), which
|
|
1519 might depend on all sorts of things; I'm not sure. */
|
267
|
1520 complex_vars_of_emacs ();
|
|
1521
|
0
|
1522 #ifdef CLASH_DETECTION
|
|
1523 complex_vars_of_filelock ();
|
|
1524 #endif /* CLASH_DETECTION */
|
|
1525
|
|
1526 /* This creates a couple of basic keymaps and depends on Lisp
|
|
1527 hashtables and Ffset() (both of which depend on some variables
|
|
1528 initialized in the vars_of_*() section) and possibly other
|
|
1529 stuff. */
|
|
1530 complex_vars_of_keymap ();
|
175
|
1531 /* Calls Fmake_hashtable() and creates a keymap */
|
|
1532 complex_vars_of_event_stream ();
|
0
|
1533
|
|
1534 if (always_gc) /* purification debugging hack */
|
|
1535 garbage_collect_1 ();
|
|
1536 }
|
|
1537
|
|
1538 /* CONGRATULATIONS!!! We have successfully initialized the Lisp
|
|
1539 engine. */
|
|
1540
|
|
1541 if (initialized)
|
|
1542 {
|
|
1543 /* Stuff that needs to be reset at run time. Order below should
|
|
1544 not matter. */
|
|
1545 reinit_alloc ();
|
|
1546 reinit_eval ();
|
70
|
1547 #ifdef MULE_REGEXP
|
|
1548 reinit_mule_category ();
|
|
1549 #endif
|
0
|
1550 }
|
|
1551
|
|
1552 /* Now do further initialization/setup of stuff that is not needed by the
|
|
1553 syms_of_() routines. This involves stuff that only is enabled in
|
|
1554 an interactive run (redisplay, user input, etc.) and stuff that is
|
|
1555 not needed until we start loading Lisp code (the reader). A lot
|
|
1556 of this stuff involves querying the current environment and needs
|
|
1557 to be done both at dump time and at run time. */
|
|
1558
|
|
1559 init_callproc (); /* Set up the process environment (so that egetenv
|
|
1560 works), the basic directory variables
|
|
1561 (exec-directory and so on), and stuff
|
|
1562 related to subprocesses. This should be
|
|
1563 first because many of the functions below
|
|
1564 call egetenv() to get environment variables. */
|
|
1565 init_lread (); /* Set up the Lisp reader. */
|
|
1566 #ifdef MSDOS
|
|
1567 /* Call early 'cause init_environment needs it. */
|
|
1568 init_dosfns ();
|
|
1569 /* Set defaults for several environment variables. */
|
|
1570 init_environment (argc, argv, skip_args);
|
|
1571 #endif
|
|
1572 init_cmdargs (argc, argv, skip_args); /* Create list Vcommand_line_args */
|
|
1573 init_buffer (); /* Init default directory of *scratch* buffer */
|
195
|
1574
|
|
1575 #ifdef WINDOWSNT
|
|
1576 init_environment();
|
|
1577 init_ntproc();
|
|
1578 #endif
|
|
1579
|
0
|
1580 init_redisplay (); /* Determine terminal type.
|
|
1581 init_sys_modes uses results */
|
|
1582 init_event_stream (); /* Set up so we can get user input. */
|
|
1583 init_macros (); /* set up so we can run macros. */
|
|
1584 init_editfns (); /* Determine the name of the user we're running as */
|
|
1585 init_xemacs_process (); /* set up for calling subprocesses */
|
|
1586 #ifdef SUNPRO
|
|
1587 init_sunpro (); /* Set up Sunpro usage tracking */
|
|
1588 #endif
|
|
1589 #if defined (HAVE_NATIVE_SOUND) && defined (hp9000s800)
|
|
1590 init_hpplay ();
|
|
1591 #endif
|
|
1592 #ifdef HAVE_TTY
|
|
1593 init_device_tty ();
|
|
1594 #endif
|
|
1595 init_console_stream (); /* Create the first console */
|
|
1596
|
173
|
1597 /* try to get the actual pathname of the exec file we are running */
|
233
|
1598 if (!restart)
|
0
|
1599 {
|
|
1600 Vinvocation_name = Fcar (Vcommand_line_args);
|
233
|
1601 if (XSTRING_DATA(Vinvocation_name)[0] == '-')
|
|
1602 {
|
|
1603 /* XEmacs as a login shell, oh goody! */
|
|
1604 Vinvocation_name = build_string(getenv("SHELL"));
|
|
1605 }
|
0
|
1606 Vinvocation_directory = Vinvocation_name;
|
|
1607
|
|
1608 if (!NILP (Ffile_name_directory (Vinvocation_name)))
|
269
|
1609 {
|
|
1610 /* invocation-name includes a directory component -- presumably it
|
|
1611 is relative to cwd, not $PATH */
|
|
1612 Vinvocation_directory = Fexpand_file_name (Vinvocation_name,
|
|
1613 Qnil);
|
|
1614 Vinvocation_path = Qnil;
|
|
1615 }
|
0
|
1616 else
|
269
|
1617 {
|
|
1618 Vinvocation_path = decode_env_path ("PATH", NULL);
|
|
1619 locate_file (Vinvocation_path, Vinvocation_name, EXEC_SUFFIXES,
|
|
1620 &Vinvocation_directory, X_OK);
|
|
1621 }
|
0
|
1622
|
|
1623 if (NILP (Vinvocation_directory))
|
|
1624 Vinvocation_directory = Vinvocation_name;
|
|
1625
|
|
1626 Vinvocation_name = Ffile_name_nondirectory (Vinvocation_directory);
|
|
1627 Vinvocation_directory = Ffile_name_directory (Vinvocation_directory);
|
|
1628 }
|
|
1629
|
265
|
1630 #if defined(HAVE_SHLIB) && !defined(WINDOWSNT)
|
|
1631 /* This is Unix only. MS Windows NT has a library call that does
|
|
1632 The Right Thing on that system. Rumor has it, this must be
|
|
1633 called for GNU dld in temacs and xemacs. */
|
|
1634 {
|
|
1635 char *buf = (char *)alloca (XSTRING_LENGTH (Vinvocation_directory)
|
|
1636 + XSTRING_LENGTH (Vinvocation_name)
|
|
1637 + 2);
|
|
1638 sprintf (buf, "%s/%s", XSTRING_DATA(Vinvocation_directory),
|
|
1639 XSTRING_DATA(Vinvocation_name));
|
|
1640
|
|
1641 /* All we can do is cry if an error happens, so ignore it. */
|
|
1642 (void)dll_init(buf);
|
|
1643 }
|
|
1644 #endif
|
|
1645
|
0
|
1646 #if defined (LOCALTIME_CACHE) && defined (HAVE_TZSET)
|
|
1647 /* sun's localtime() has a bug. it caches the value of the time
|
|
1648 zone rather than looking it up every time. Since localtime() is
|
|
1649 called to bolt the undumping time into the undumped emacs, this
|
|
1650 results in localtime() ignoring the TZ environment variable.
|
|
1651 This flushes the new TZ value into localtime(). */
|
|
1652 tzset ();
|
|
1653 #endif /* LOCALTIME_CACHE and TZSET */
|
|
1654
|
|
1655 load_me = Qnil;
|
|
1656 if (!initialized)
|
|
1657 {
|
|
1658 /* Handle -l loadup-and-dump, args passed by Makefile. */
|
|
1659 if (argc > 2 + skip_args && !strcmp (argv[1 + skip_args], "-l"))
|
80
|
1660 load_me = build_string (argv[2 + skip_args]);
|
239
|
1661 #if 0 /* CANNOT_DUMP - this can never be right in XEmacs --andyp */
|
0
|
1662 /* Unless next switch is -nl, load "loadup.el" first thing. */
|
|
1663 if (!(argc > 1 + skip_args && !strcmp (argv[1 + skip_args], "-nl")))
|
|
1664 load_me = build_string ("loadup.el");
|
|
1665 #endif /* CANNOT_DUMP */
|
|
1666 }
|
|
1667
|
|
1668 #ifdef QUANTIFY
|
|
1669 if (initialized)
|
|
1670 quantify_start_recording_data ();
|
|
1671 #endif /* QUANTIFY */
|
|
1672
|
|
1673 initialized = 1;
|
|
1674
|
|
1675 /* This never returns. */
|
|
1676 initial_command_loop (load_me);
|
|
1677 /* NOTREACHED */
|
|
1678 }
|
|
1679
|
20
|
1680
|
16
|
1681 /* Sort the args so we can find the most important ones
|
|
1682 at the beginning of argv. */
|
|
1683
|
|
1684 /* First, here's a table of all the standard options. */
|
|
1685
|
|
1686 struct standard_args
|
|
1687 {
|
|
1688 CONST char * CONST name;
|
|
1689 CONST char * CONST longname;
|
|
1690 int priority;
|
|
1691 int nargs;
|
|
1692 };
|
|
1693
|
|
1694 static struct standard_args standard_args[] =
|
|
1695 {
|
|
1696 /* Handled by main_1 above: */
|
|
1697 { "-nl", "--no-shared-memory", 100, 0 },
|
|
1698 { "-t", "--terminal", 95, 1 },
|
|
1699 { "-nw", "--no-windows", 90, 0 },
|
|
1700 { "-batch", "--batch", 85, 0 },
|
276
|
1701 { "-debug-paths", "--debug-paths", 82, 0 },
|
16
|
1702 { "-help", "--help", 80, 0 },
|
|
1703 { "-version", "--version", 75, 0 },
|
|
1704 { "-V", 0, 75, 0 },
|
|
1705 { "-d", "--display", 80, 1 },
|
|
1706 { "-display", 0, 80, 1 },
|
|
1707 { "-NXHost", 0, 79, 0 },
|
|
1708 { "-MachLaunch", 0, 79, 0},
|
|
1709
|
|
1710 /* Handled by command-line-early in startup.el: */
|
|
1711 { "-q", "--no-init-file", 50, 0 },
|
|
1712 { "-unmapped", 0, 50, 0 },
|
|
1713 { "-no-init-file", 0, 50, 0 },
|
207
|
1714 { "-vanilla", "--vanilla", 50, 0 },
|
239
|
1715 { "-no-autoloads", "--no-autoloads", 50, 0 },
|
16
|
1716 { "-no-site-file", "--no-site-file", 40, 0 },
|
276
|
1717 { "-no-early-packages", "--no-early-packages", 35, 0 },
|
16
|
1718 { "-u", "--user", 30, 1 },
|
|
1719 { "-user", 0, 30, 1 },
|
|
1720 { "-debug-init", "--debug-init", 20, 0 },
|
276
|
1721 { "-debug-paths", "--debug-paths", 20, 0 },
|
16
|
1722
|
|
1723 /* Xt options: */
|
|
1724 { "-i", "--icon-type", 15, 0 },
|
|
1725 { "-itype", 0, 15, 0 },
|
|
1726 { "-iconic", "--iconic", 15, 0 },
|
|
1727 { "-bg", "--background-color", 10, 1 },
|
|
1728 { "-background", 0, 10, 1 },
|
|
1729 { "-fg", "--foreground-color", 10, 1 },
|
|
1730 { "-foreground", 0, 10, 1 },
|
|
1731 { "-bd", "--border-color", 10, 1 },
|
|
1732 { "-bw", "--border-width", 10, 1 },
|
|
1733 { "-ib", "--internal-border", 10, 1 },
|
|
1734 { "-ms", "--mouse-color", 10, 1 },
|
|
1735 { "-cr", "--cursor-color", 10, 1 },
|
|
1736 { "-fn", "--font", 10, 1 },
|
|
1737 { "-font", 0, 10, 1 },
|
|
1738 { "-g", "--geometry", 10, 1 },
|
|
1739 { "-geometry", 0, 10, 1 },
|
|
1740 { "-T", "--title", 10, 1 },
|
|
1741 { "-title", 0, 10, 1 },
|
|
1742 { "-name", "--name", 10, 1 },
|
|
1743 { "-xrm", "--xrm", 10, 1 },
|
|
1744 { "-r", "--reverse-video", 5, 0 },
|
|
1745 { "-rv", 0, 5, 0 },
|
|
1746 { "-reverse", 0, 5, 0 },
|
|
1747 { "-hb", "--horizontal-scroll-bars", 5, 0 },
|
|
1748 { "-vb", "--vertical-scroll-bars", 5, 0 },
|
163
|
1749
|
16
|
1750 /* These have the same priority as ordinary file name args,
|
|
1751 so they are not reordered with respect to those. */
|
|
1752 { "-L", "--directory", 0, 1 },
|
|
1753 { "-directory", 0, 0, 1 },
|
|
1754 { "-l", "--load", 0, 1 },
|
|
1755 { "-load", 0, 0, 1 },
|
|
1756 { "-f", "--funcall", 0, 1 },
|
|
1757 { "-funcall", 0, 0, 1 },
|
|
1758 { "-eval", "--eval", 0, 1 },
|
|
1759 { "-insert", "--insert", 0, 1 },
|
|
1760 /* This should be processed after ordinary file name args and the like. */
|
|
1761 { "-kill", "--kill", -10, 0 },
|
|
1762 };
|
|
1763
|
|
1764 /* Reorder the elements of ARGV (assumed to have ARGC elements)
|
|
1765 so that the highest priority ones come first.
|
|
1766 Do not change the order of elements of equal priority.
|
|
1767 If an option takes an argument, keep it and its argument together. */
|
|
1768
|
|
1769 static void
|
|
1770 sort_args (int argc, char **argv)
|
|
1771 {
|
185
|
1772 char **new = xnew_array (char *, argc);
|
16
|
1773 /* For each element of argv,
|
|
1774 the corresponding element of options is:
|
|
1775 0 for an option that takes no arguments,
|
|
1776 1 for an option that takes one argument, etc.
|
|
1777 -1 for an ordinary non-option argument. */
|
185
|
1778 int *options = xnew_array (int, argc);
|
|
1779 int *priority = xnew_array (int, argc);
|
16
|
1780 int to = 1;
|
|
1781 int from;
|
|
1782 int i;
|
78
|
1783 int end_of_options_p = 0;
|
16
|
1784
|
|
1785 /* Categorize all the options,
|
|
1786 and figure out which argv elts are option arguments. */
|
|
1787 for (from = 1; from < argc; from++)
|
|
1788 {
|
|
1789 options[from] = -1;
|
|
1790 priority[from] = 0;
|
78
|
1791 /* Pseudo options "--" and "run-temacs" indicate end of options */
|
|
1792 if (!strcmp (argv[from], "--") ||
|
|
1793 !strcmp (argv[from], "run-temacs"))
|
|
1794 end_of_options_p = 1;
|
|
1795 if (!end_of_options_p && argv[from][0] == '-')
|
16
|
1796 {
|
|
1797 int match, thislen;
|
|
1798 char *equals;
|
|
1799
|
|
1800 /* Look for a match with a known old-fashioned option. */
|
|
1801 for (i = 0; i < countof (standard_args); i++)
|
|
1802 if (!strcmp (argv[from], standard_args[i].name))
|
|
1803 {
|
|
1804 options[from] = standard_args[i].nargs;
|
|
1805 priority[from] = standard_args[i].priority;
|
|
1806 if (from + standard_args[i].nargs >= argc)
|
|
1807 fatal ("Option `%s' requires an argument\n", argv[from]);
|
|
1808 from += standard_args[i].nargs;
|
|
1809 goto done;
|
|
1810 }
|
|
1811
|
|
1812 /* Look for a match with a known long option.
|
|
1813 MATCH is -1 if no match so far, -2 if two or more matches so far,
|
|
1814 >= 0 (the table index of the match) if just one match so far. */
|
|
1815 if (argv[from][1] == '-')
|
|
1816 {
|
|
1817 match = -1;
|
|
1818 thislen = strlen (argv[from]);
|
|
1819 equals = strchr (argv[from], '=');
|
|
1820 if (equals != 0)
|
|
1821 thislen = equals - argv[from];
|
|
1822
|
|
1823 for (i = 0; i < countof (standard_args); i++)
|
|
1824 if (standard_args[i].longname
|
|
1825 && !strncmp (argv[from], standard_args[i].longname,
|
|
1826 thislen))
|
|
1827 {
|
|
1828 if (match == -1)
|
|
1829 match = i;
|
|
1830 else
|
|
1831 match = -2;
|
|
1832 }
|
|
1833
|
|
1834 /* If we found exactly one match, use that. */
|
|
1835 if (match >= 0)
|
|
1836 {
|
|
1837 options[from] = standard_args[match].nargs;
|
|
1838 priority[from] = standard_args[match].priority;
|
|
1839 /* If --OPTION=VALUE syntax is used,
|
|
1840 this option uses just one argv element. */
|
|
1841 if (equals != 0)
|
|
1842 options[from] = 0;
|
|
1843 if (from + options[from] >= argc)
|
|
1844 fatal ("Option `%s' requires an argument\n", argv[from]);
|
|
1845 from += options[from];
|
|
1846 }
|
|
1847 }
|
|
1848 done: ;
|
|
1849 }
|
|
1850 }
|
|
1851
|
|
1852 /* Copy the arguments, in order of decreasing priority, to NEW. */
|
|
1853 new[0] = argv[0];
|
|
1854 while (to < argc)
|
|
1855 {
|
|
1856 int best = -1;
|
|
1857 int best_priority = -9999;
|
|
1858
|
|
1859 /* Find the highest priority remaining option.
|
|
1860 If several have equal priority, take the first of them. */
|
|
1861 for (from = 1; from < argc; from++)
|
|
1862 {
|
|
1863 if (argv[from] != 0 && priority[from] > best_priority)
|
|
1864 {
|
|
1865 best_priority = priority[from];
|
|
1866 best = from;
|
|
1867 }
|
|
1868 /* Skip option arguments--they are tied to the options. */
|
|
1869 if (options[from] > 0)
|
|
1870 from += options[from];
|
|
1871 }
|
163
|
1872
|
16
|
1873 if (best < 0)
|
|
1874 abort ();
|
|
1875
|
|
1876 /* Copy the highest priority remaining option, with its args, to NEW. */
|
|
1877 new[to++] = argv[best];
|
|
1878 for (i = 0; i < options[best]; i++)
|
|
1879 new[to++] = argv[best + i + 1];
|
|
1880
|
|
1881 /* Clear out this option in ARGV. */
|
|
1882 argv[best] = 0;
|
|
1883 for (i = 0; i < options[best]; i++)
|
|
1884 argv[best + i + 1] = 0;
|
|
1885 }
|
|
1886
|
|
1887 memcpy (argv, new, sizeof (char *) * argc);
|
|
1888 }
|
|
1889
|
0
|
1890 static JMP_BUF run_temacs_catch;
|
|
1891
|
|
1892 static int run_temacs_argc;
|
|
1893 static char **run_temacs_argv;
|
|
1894 static char *run_temacs_args;
|
272
|
1895 static size_t run_temacs_argv_size;
|
|
1896 static size_t run_temacs_args_size;
|
0
|
1897
|
20
|
1898 DEFUN ("running-temacs-p", Frunning_temacs_p, 0, 0, 0, /*
|
0
|
1899 True if running temacs. This means we are in the dumping stage.
|
|
1900 This is false during normal execution of the `xemacs' program, and
|
|
1901 becomes false once `run-emacs-from-temacs' is run.
|
20
|
1902 */
|
|
1903 ())
|
0
|
1904 {
|
|
1905 return run_temacs_argc >= 0 ? Qt : Qnil;
|
|
1906 }
|
|
1907
|
20
|
1908 DEFUN ("run-emacs-from-temacs", Frun_emacs_from_temacs, 0, MANY, 0, /*
|
0
|
1909 Do not call this. It will reinitialize your XEmacs. You'll be sorry.
|
20
|
1910 */
|
0
|
1911 /* If this function is called from startup.el, it will be possible to run
|
|
1912 temacs as an editor using 'temacs -batch -l loadup.el run-temacs', instead
|
|
1913 of having to dump an emacs and then run that (when debugging emacs itself,
|
20
|
1914 this can be much faster)). [Actually, the speed difference isn't that
|
0
|
1915 much as long as your filesystem is local, and you don't end up with
|
|
1916 a dumped version in case you want to rerun it. This function is most
|
|
1917 useful when used as part of the `make all-elc' command. --ben]
|
185
|
1918 This will "restart" emacs with the specified command-line arguments.
|
0
|
1919 */
|
70
|
1920 (int nargs, Lisp_Object *args))
|
0
|
1921 {
|
|
1922 int ac;
|
259
|
1923 CONST Extbyte *wampum;
|
0
|
1924 int namesize;
|
|
1925 int total_len;
|
|
1926 Lisp_Object orig_invoc_name = Fcar (Vcommand_line_args);
|
259
|
1927 CONST Extbyte **wampum_all = alloca_array (CONST Extbyte *, nargs);
|
185
|
1928 int *wampum_all_len = alloca_array (int, nargs);
|
0
|
1929
|
|
1930 assert (!gc_in_progress);
|
|
1931
|
|
1932 if (run_temacs_argc < 0)
|
|
1933 error ("I've lost my temacs-hood.");
|
|
1934
|
|
1935 /* Need to convert the orig_invoc_name and all of the arguments
|
|
1936 to external format. */
|
163
|
1937
|
0
|
1938 GET_STRING_EXT_DATA_ALLOCA (orig_invoc_name, FORMAT_OS, wampum,
|
|
1939 namesize);
|
|
1940 namesize++;
|
|
1941
|
|
1942 for (ac = 0, total_len = namesize; ac < nargs; ac++)
|
|
1943 {
|
|
1944 CHECK_STRING (args[ac]);
|
|
1945 GET_STRING_EXT_DATA_ALLOCA (args[ac], FORMAT_OS,
|
|
1946 wampum_all[ac],
|
|
1947 wampum_all_len[ac]);
|
|
1948 wampum_all_len[ac]++;
|
|
1949 total_len += wampum_all_len[ac];
|
|
1950 }
|
|
1951 DO_REALLOC (run_temacs_args, run_temacs_args_size, total_len, char);
|
|
1952 DO_REALLOC (run_temacs_argv, run_temacs_argv_size, nargs+1, char *);
|
|
1953
|
|
1954 memcpy (run_temacs_args, wampum, namesize);
|
|
1955 run_temacs_argv [0] = run_temacs_args;
|
|
1956 for (ac = 0; ac < nargs; ac++)
|
|
1957 {
|
|
1958 memcpy (run_temacs_args + namesize,
|
|
1959 wampum_all[ac], wampum_all_len[ac]);
|
|
1960 run_temacs_argv [ac + 1] = run_temacs_args + namesize;
|
|
1961 namesize += wampum_all_len[ac];
|
|
1962 }
|
|
1963 run_temacs_argv [nargs + 1] = 0;
|
|
1964 catchlist = NULL; /* Important! Otherwise free_cons() calls in
|
|
1965 condition_case_unwind() may lead to GC death. */
|
|
1966 unbind_to (0, Qnil); /* this closes loadup.el */
|
|
1967 purify_flag = 0;
|
|
1968 run_temacs_argc = nargs + 1;
|
251
|
1969 #ifdef REPORT_PURE_USAGE
|
0
|
1970 report_pure_usage (1, 0);
|
207
|
1971 #else
|
|
1972 report_pure_usage (0, 0);
|
|
1973 #endif
|
0
|
1974 LONGJMP (run_temacs_catch, 1);
|
|
1975 return Qnil; /* not reached; warning suppression */
|
|
1976 }
|
|
1977
|
|
1978 /* ARGSUSED */
|
163
|
1979 int
|
0
|
1980 main (int argc, char **argv, char **envp)
|
|
1981 {
|
16
|
1982 int volatile vol_argc = argc;
|
|
1983 char ** volatile vol_argv = argv;
|
|
1984 char ** volatile vol_envp = envp;
|
233
|
1985 /* This is hairy. We need to compute where the XEmacs binary was invoked */
|
|
1986 /* from because temacs initialization requires it to find the lisp */
|
|
1987 /* directories. The code that recomputes the path is guarded by the */
|
|
1988 /* restarted flag. There are three possible paths I've found so far */
|
|
1989 /* through this: */
|
|
1990 /* temacs -- When running temacs for basic build stuff, the first main_1 */
|
|
1991 /* will be the only one invoked. It must compute the path else there */
|
|
1992 /* will be a very ugly bomb in startup.el (can't find obvious location */
|
|
1993 /* for doc-directory data-directory, etc.). */
|
|
1994 /* temacs w/ run-temacs on the command line -- This is run to bytecompile */
|
|
1995 /* all the out of date dumped lisp. It will execute both of the main_1 */
|
|
1996 /* calls and the second one must not touch the first computation because */
|
|
1997 /* argc/argv are hosed the second time through. */
|
|
1998 /* xemacs -- Only the second main_1 is executed. The invocation path must */
|
|
1999 /* computed but this only matters when running in place or when running */
|
|
2000 /* as a login shell. */
|
|
2001 /* As a bonus for straightening this out, XEmacs can now be run in place */
|
|
2002 /* as a login shell. This never used to work. */
|
|
2003 /* As another bonus, we can now guarantee that */
|
|
2004 /* (concat invocation-directory invocation-name) contains the filename */
|
|
2005 /* of the XEmacs binary we are running. This can now be used in a */
|
|
2006 /* definite test for out of date dumped files. -slb */
|
|
2007 int restarted = 0;
|
0
|
2008 #ifdef QUANTIFY
|
|
2009 quantify_stop_recording_data ();
|
|
2010 quantify_clear_data ();
|
|
2011 #endif /* QUANTIFY */
|
|
2012
|
272
|
2013 suppress_early_error_handler_backtrace = 0;
|
0
|
2014 lim_data = 0; /* force reinitialization of this variable */
|
|
2015
|
78
|
2016 /* Lisp_Object must fit in a word; check VALBITS and GCTYPEBITS */
|
|
2017 assert (sizeof (Lisp_Object) == sizeof (void *));
|
|
2018
|
255
|
2019 #ifdef LINUX_SBRK_BUG
|
|
2020 sbrk (1);
|
|
2021 #endif
|
|
2022
|
0
|
2023 if (!initialized)
|
78
|
2024 {
|
255
|
2025 #ifdef DOUG_LEA_MALLOC
|
|
2026 mallopt (M_MMAP_MAX, 0);
|
|
2027 #endif
|
78
|
2028 run_temacs_argc = 0;
|
|
2029 if (! SETJMP (run_temacs_catch))
|
233
|
2030 {
|
|
2031 main_1 (vol_argc, vol_argv, vol_envp, 0);
|
|
2032 }
|
78
|
2033 /* run-emacs-from-temacs called */
|
233
|
2034 restarted = 1;
|
78
|
2035 vol_argc = run_temacs_argc;
|
|
2036 vol_argv = run_temacs_argv;
|
0
|
2037 #ifdef _SCO_DS
|
78
|
2038 /* This makes absolutely no sense to anyone involved. There are
|
|
2039 several people using this stuff. We've compared versions on
|
|
2040 everything we can think of. We can find no difference.
|
|
2041 However, on both my systems environ is a plain old global
|
|
2042 variable initialized to zero. _environ is the one that
|
|
2043 contains pointers to the actual environment.
|
163
|
2044
|
78
|
2045 Since we can't figure out the difference (and we're hours
|
|
2046 away from a release), this takes a very cowardly approach and
|
|
2047 is bracketed with both a system specific preprocessor test
|
|
2048 and a runtime "do you have this problem" test
|
163
|
2049
|
78
|
2050 06/20/96 robertl@dgii.com */
|
|
2051 {
|
|
2052 extern char *_environ;
|
|
2053 if ((unsigned) environ == 0)
|
|
2054 environ=_environ;
|
|
2055 }
|
16
|
2056 #endif /* _SCO_DS */
|
80
|
2057 vol_envp = environ;
|
|
2058 }
|
272
|
2059 #ifdef RUN_TIME_REMAP
|
|
2060 else
|
|
2061 /* obviously no-one uses this because where it was before initalized was
|
|
2062 *always* true */
|
245
|
2063 run_time_remap (argv[0]);
|
|
2064 #endif
|
|
2065
|
255
|
2066 #ifdef DOUG_LEA_MALLOC
|
|
2067 if (initialized && (malloc_state_ptr != NULL))
|
|
2068 {
|
272
|
2069 int rc = malloc_set_state (malloc_state_ptr);
|
|
2070 if (rc != 0)
|
|
2071 {
|
|
2072 fprintf (stderr, "malloc_set_state failed, rc = %d\n", rc);
|
|
2073 abort ();
|
|
2074 }
|
255
|
2075 #if 0
|
|
2076 free (malloc_state_ptr);
|
|
2077 #endif
|
259
|
2078 /* mmap works in glibc-2.1, glibc-2.0 (Non-Mule only) and Linux libc5 */
|
|
2079 #if (defined(__GLIBC__) && __GLIBC_MINOR__ >= 1) || \
|
|
2080 defined(_NO_MALLOC_WARNING_) || \
|
|
2081 (defined(__GLIBC__) && __GLIBC_MINOR__ < 1 && !defined(MULE)) || \
|
|
2082 defined(DEBUG_DOUG_LEA_MALLOC)
|
255
|
2083 mallopt (M_MMAP_MAX, 64);
|
|
2084 #endif
|
|
2085 #ifdef REL_ALLOC
|
|
2086 r_alloc_reinit ();
|
|
2087 #endif
|
|
2088 }
|
272
|
2089 #endif /* DOUG_LEA_MALLOC */
|
255
|
2090
|
0
|
2091 run_temacs_argc = -1;
|
|
2092
|
233
|
2093 main_1 (vol_argc, vol_argv, vol_envp, restarted);
|
163
|
2094 return 0; /* unreached */
|
0
|
2095 }
|
|
2096
|
|
2097
|
272
|
2098 /* Dumping apparently isn't supported by versions of GCC >= 2.8. */
|
|
2099 /* The following needs conditionalization on whether either XEmacs or */
|
|
2100 /* various system shared libraries have been built and linked with */
|
|
2101 /* GCC >= 2.8. -slb */
|
|
2102 #if defined(GNU_MALLOC)
|
|
2103 static void
|
|
2104 voodoo_free_hook(void *mem)
|
|
2105 {
|
|
2106 /* Disable all calls to free() when XEmacs is exiting and it doesn't */
|
|
2107 /* matter. */
|
|
2108 __free_hook = voodoo_free_hook;
|
|
2109 }
|
|
2110 #endif
|
|
2111
|
20
|
2112 DEFUN ("kill-emacs", Fkill_emacs, 0, 1, "P", /*
|
0
|
2113 Exit the XEmacs job and kill it. Ask for confirmation, without argument.
|
|
2114 If ARG is an integer, return ARG as the exit program code.
|
|
2115 If ARG is a string, stuff it as keyboard input.
|
|
2116
|
|
2117 The value of `kill-emacs-hook', if not void,
|
|
2118 is a list of functions (of no args),
|
|
2119 all of which are called before XEmacs is actually killed.
|
20
|
2120 */
|
|
2121 (arg))
|
0
|
2122 {
|
|
2123 /* This function can GC */
|
|
2124 struct gcpro gcpro1;
|
|
2125
|
|
2126 GCPRO1 (arg);
|
|
2127
|
|
2128 if (feof (stdin))
|
|
2129 arg = Qt;
|
|
2130
|
|
2131 if (!preparing_for_armageddon && !noninteractive)
|
|
2132 run_hook (Qkill_emacs_hook);
|
|
2133
|
|
2134 /* make sure no quitting from now on!! */
|
|
2135 dont_check_for_quit = 1;
|
|
2136 Vinhibit_quit = Qt;
|
|
2137
|
|
2138 if (!preparing_for_armageddon)
|
|
2139 {
|
267
|
2140 Lisp_Object concons, nextcons;
|
0
|
2141
|
|
2142 /* Normally, go ahead and delete all the consoles now.
|
|
2143 Some unmentionably lame window systems (MS Wwwww...... eek,
|
|
2144 I can't even say it) don't properly clean up after themselves,
|
|
2145 and even for those that do, it might be cleaner this way.
|
|
2146 If we're going down, however, we don't do this (might
|
|
2147 be too dangerous), and if we get a crash somewhere within
|
|
2148 this loop, we'll still autosave and won't try this again. */
|
267
|
2149
|
|
2150 LIST_LOOP_DELETING(concons, nextcons, Vconsole_list)
|
|
2151 {
|
|
2152 /* There is very little point in deleting the stream console.
|
|
2153 It uses stdio, which should flush any buffered output and
|
|
2154 something can only go wrong. -slb */
|
|
2155 /* I changed my mind. There's a stupid hack in close to add
|
|
2156 a trailing newline. */
|
|
2157 /*if (!CONSOLE_STREAM_P (XCONSOLE (XCAR (concons))))*/
|
|
2158 delete_console_internal (XCONSOLE (XCAR (concons)), 1, 1, 0);
|
|
2159 }
|
0
|
2160 }
|
|
2161
|
|
2162 UNGCPRO;
|
|
2163
|
|
2164 shut_down_emacs (0, ((STRINGP (arg)) ? arg : Qnil));
|
|
2165
|
272
|
2166 #if defined(GNU_MALLOC)
|
|
2167 __free_hook = voodoo_free_hook;
|
|
2168 #endif
|
|
2169
|
207
|
2170 exit ((INTP (arg)) ? XINT (arg) : 0);
|
0
|
2171 /* NOTREACHED */
|
|
2172 return Qnil; /* I'm sick of the compiler warning */
|
|
2173 }
|
|
2174
|
|
2175 /* Perform an orderly shutdown of XEmacs. Autosave any modified
|
|
2176 buffers, kill any child processes, clean up the terminal modes (if
|
|
2177 we're in the foreground), and other stuff like that. Don't perform
|
|
2178 any redisplay; this may be called when XEmacs is shutting down in
|
|
2179 the background, or after its X connection has died.
|
|
2180
|
|
2181 If SIG is a signal number, print a message for it.
|
|
2182
|
|
2183 This is called by fatal signal handlers, X protocol error handlers,
|
|
2184 and Fkill_emacs. */
|
|
2185 static void
|
|
2186 shut_down_emacs (int sig, Lisp_Object stuff)
|
|
2187 {
|
|
2188 /* This function can GC */
|
|
2189 /* Prevent running of hooks and other non-essential stuff
|
|
2190 from now on. */
|
|
2191 preparing_for_armageddon = 1;
|
|
2192
|
|
2193 /* In case frames or windows are screwed up, avoid assertion
|
|
2194 failures here */
|
|
2195 Vinhibit_quit = Qt;
|
|
2196
|
|
2197 #ifdef QUANTIFY
|
|
2198 quantify_stop_recording_data ();
|
|
2199 #endif /* QUANTIFY */
|
|
2200
|
263
|
2201 #if 0
|
0
|
2202 /* This is absolutely the most important thing to do, so make sure
|
|
2203 we do it now, before anything else. We might have crashed and
|
|
2204 be in a weird inconsistent state, and potentially anything could
|
|
2205 set off another protection fault and cause us to bail out
|
|
2206 immediately. */
|
263
|
2207 /* I'm not removing the code entirely, yet. We have run up against
|
|
2208 a spate of problems in diagnosing crashes due to crashes within
|
|
2209 crashes. It has very definitely been determined that code called
|
|
2210 during auto-saving cannot work if XEmacs crashed inside of GC.
|
|
2211 We already auto-save on an itimer so there cannot be too much
|
|
2212 unsaved stuff around, and if we get better crash reports we might
|
|
2213 be able to get more problems fixed so I'm disabling this. -slb */
|
0
|
2214 Fdo_auto_save (Qt, Qnil); /* do this before anything hazardous */
|
263
|
2215 #endif
|
0
|
2216
|
|
2217 fflush (stdout);
|
|
2218 reset_all_consoles ();
|
|
2219 if (sig && sig != SIGTERM)
|
|
2220 {
|
|
2221 stderr_out ("\nFatal error (%d).\n", sig);
|
|
2222 stderr_out
|
|
2223 ("Your files have been auto-saved.\n"
|
|
2224 "Use `M-x recover-session' to recover them.\n"
|
|
2225 "\n"
|
282
|
2226 #ifdef INFODOCK
|
|
2227 "Please report this bug by selecting `Report-Bug' in the InfoDock\n"
|
|
2228 "menu.\n"
|
|
2229 #else
|
126
|
2230 "Please report this bug by running the send-pr script included\n"
|
|
2231 "with XEmacs, or selecting `Send Bug Report' from the help menu.\n"
|
|
2232 "As a last resort send ordinary email to `crashes@xemacs.org'.\n"
|
282
|
2233 #endif
|
|
2234 "*MAKE SURE* to include the information in the command\n"
|
|
2235 "M-x describe-installation.\n"
|
2
|
2236 "\n"
|
0
|
2237 "If at all possible, *please* try to obtain a C stack backtrace;\n"
|
|
2238 "it will help us immensely in determining what went wrong.\n"
|
|
2239 "To do this, locate the core file that was produced as a result\n"
|
|
2240 "of this crash (it's usually called `core' and is located in the\n"
|
282
|
2241 "directory in which you started the editor, or maybe in your home\n"
|
0
|
2242 "directory), and type\n"
|
|
2243 "\n"
|
|
2244 " gdb ");
|
|
2245 {
|
2
|
2246 CONST char *name;
|
0
|
2247 char *dir = 0;
|
|
2248
|
|
2249 /* Now try to determine the actual path to the executable,
|
|
2250 to try to make the backtrace-determination process as foolproof
|
|
2251 as possible. */
|
|
2252 if (GC_STRINGP (Vinvocation_name))
|
14
|
2253 name = (char *) XSTRING_DATA (Vinvocation_name);
|
0
|
2254 else
|
|
2255 name = "xemacs";
|
|
2256 if (GC_STRINGP (Vinvocation_directory))
|
14
|
2257 dir = (char *) XSTRING_DATA (Vinvocation_directory);
|
0
|
2258 if (!dir || dir[0] != '/')
|
|
2259 stderr_out ("`which %s`", name);
|
|
2260 else if (dir[strlen (dir) - 1] != '/')
|
|
2261 stderr_out ("%s/%s", dir, name);
|
|
2262 else
|
|
2263 stderr_out ("%s%s", dir, name);
|
|
2264 }
|
|
2265 stderr_out
|
|
2266 (" core\n\n"
|
|
2267 "then type `where' when the debugger prompt comes up.\n"
|
|
2268 "(If you don't have GDB on your system, you might have DBX,\n"
|
|
2269 "or XDB, or SDB. A similar procedure should work for all of\n"
|
|
2270 "these. Ask your system administrator if you need more help.)\n");
|
|
2271 }
|
|
2272
|
|
2273 stuff_buffered_input (stuff);
|
|
2274
|
|
2275 kill_buffer_processes (Qnil);
|
|
2276
|
|
2277 #ifdef CLASH_DETECTION
|
|
2278 unlock_all_files ();
|
|
2279 #endif
|
|
2280
|
|
2281 #ifdef TOOLTALK
|
|
2282 tt_session_quit (tt_default_session ());
|
2
|
2283 #if 0
|
|
2284 /* The following crashes when built on X11R5 and run on X11R6 */
|
0
|
2285 tt_close ();
|
|
2286 #endif
|
2
|
2287 #endif /* TOOLTALK */
|
0
|
2288
|
|
2289 }
|
|
2290
|
|
2291
|
|
2292 #ifndef CANNOT_DUMP
|
|
2293 /* Nothing like this can be implemented on an Apollo.
|
|
2294 What a loss! */
|
|
2295
|
2
|
2296 extern char my_edata[];
|
0
|
2297
|
|
2298 #ifdef HAVE_SHM
|
|
2299
|
20
|
2300 DEFUN ("dump-emacs-data", Fdump_emacs_data, 1, 1, 0, /*
|
0
|
2301 Dump current state of XEmacs into data file FILENAME.
|
|
2302 This function exists on systems that use HAVE_SHM.
|
20
|
2303 */
|
|
2304 (intoname))
|
0
|
2305 {
|
|
2306 /* This function can GC */
|
|
2307 int opurify;
|
|
2308 struct gcpro gcpro1;
|
|
2309 GCPRO1 (intoname);
|
|
2310
|
|
2311 CHECK_STRING (intoname);
|
|
2312 intoname = Fexpand_file_name (intoname, Qnil);
|
|
2313
|
|
2314 opurify = purify_flag;
|
|
2315 purify_flag = 0;
|
|
2316
|
|
2317 fflush (stderr);
|
|
2318 fflush (stdout);
|
|
2319
|
|
2320 disksave_object_finalization ();
|
|
2321 release_breathing_space ();
|
|
2322
|
|
2323 /* Tell malloc where start of impure now is */
|
|
2324 /* Also arrange for warnings when nearly out of space. */
|
|
2325 #ifndef SYSTEM_MALLOC
|
173
|
2326 memory_warnings (my_edata, malloc_warning);
|
0
|
2327 #endif
|
|
2328 UNGCPRO;
|
14
|
2329 map_out_data (XSTRING_DATA (intoname));
|
0
|
2330
|
|
2331 purify_flag = opurify;
|
|
2332
|
|
2333 return Qnil;
|
|
2334 }
|
|
2335
|
|
2336 #else /* not HAVE_SHM */
|
272
|
2337 extern void disable_free_hook (void);
|
0
|
2338
|
20
|
2339 DEFUN ("dump-emacs", Fdump_emacs, 2, 2, 0, /*
|
0
|
2340 Dump current state of XEmacs into executable file FILENAME.
|
|
2341 Take symbols from SYMFILE (presumably the file you executed to run XEmacs).
|
|
2342 This is used in the file `loadup.el' when building XEmacs.
|
|
2343
|
|
2344 Remember to set `command-line-processed' to nil before dumping
|
|
2345 if you want the dumped XEmacs to process its command line
|
|
2346 and announce itself normally when it is run.
|
20
|
2347 */
|
|
2348 (intoname, symname))
|
0
|
2349 {
|
|
2350 /* This function can GC */
|
|
2351 struct gcpro gcpro1, gcpro2;
|
|
2352 int opurify;
|
|
2353
|
|
2354 GCPRO2 (intoname, symname);
|
|
2355
|
|
2356 #ifdef FREE_CHECKING
|
|
2357 Freally_free (Qnil);
|
|
2358
|
|
2359 /* When we're dumping, we can't use the debugging free() */
|
274
|
2360 disable_free_hook ();
|
272
|
2361 #endif
|
|
2362 #if 1 /* martin */
|
0
|
2363 #endif
|
|
2364
|
|
2365 CHECK_STRING (intoname);
|
|
2366 intoname = Fexpand_file_name (intoname, Qnil);
|
|
2367 if (!NILP (symname))
|
|
2368 {
|
|
2369 CHECK_STRING (symname);
|
14
|
2370 if (XSTRING_LENGTH (symname) > 0)
|
0
|
2371 symname = Fexpand_file_name (symname, Qnil);
|
|
2372 else
|
|
2373 symname = Qnil;
|
|
2374 }
|
|
2375
|
|
2376 opurify = purify_flag;
|
|
2377 purify_flag = 0;
|
|
2378
|
207
|
2379 #ifdef DEBUG_XEMACS
|
0
|
2380 report_pure_usage (1, 1);
|
207
|
2381 #else
|
|
2382 report_pure_usage (0, 1);
|
|
2383 #endif
|
0
|
2384
|
|
2385 fflush (stderr);
|
|
2386 fflush (stdout);
|
|
2387
|
|
2388 disksave_object_finalization ();
|
|
2389 release_breathing_space ();
|
|
2390
|
|
2391 /* Tell malloc where start of impure now is */
|
|
2392 /* Also arrange for warnings when nearly out of space. */
|
|
2393 #ifndef SYSTEM_MALLOC
|
173
|
2394 memory_warnings (my_edata, malloc_warning);
|
0
|
2395 #endif
|
|
2396
|
|
2397 UNGCPRO;
|
|
2398
|
|
2399 #if defined (MSDOS) && defined (EMX)
|
|
2400 {
|
14
|
2401 int fd = open ((char *) XSTRING_DATA (intoname),
|
0
|
2402 O_WRONLY|O_CREAT|O_TRUNC, S_IREAD|S_IWRITE);
|
|
2403 if (!fd) {
|
14
|
2404 error ("Failure operating on %s", XSTRING_DATA (intoname));
|
0
|
2405 } else {
|
|
2406 _core (fd);
|
|
2407 close (fd);
|
|
2408 }
|
|
2409 }
|
|
2410 #else /* not MSDOS and EMX */
|
|
2411 {
|
272
|
2412 char *intoname_ext;
|
|
2413 char *symname_ext;
|
0
|
2414
|
|
2415 GET_C_STRING_FILENAME_DATA_ALLOCA (intoname, intoname_ext);
|
|
2416 if (STRINGP (symname))
|
|
2417 GET_C_STRING_FILENAME_DATA_ALLOCA (symname, symname_ext);
|
|
2418 else
|
|
2419 symname_ext = 0;
|
272
|
2420
|
|
2421 garbage_collect_1 ();
|
255
|
2422 #ifdef DOUG_LEA_MALLOC
|
272
|
2423 malloc_state_ptr = malloc_get_state ();
|
|
2424 #endif
|
|
2425 /* here we break our rule that the filename conversion should
|
|
2426 be performed at the actual time that the system call is made.
|
|
2427 It's a whole lot easier to do the conversion here than to
|
|
2428 modify all the unexec routines to ensure that filename
|
|
2429 conversion is applied everywhere. Don't worry about memory
|
|
2430 leakage because this call only happens once. */
|
|
2431 unexec (intoname_ext, symname_ext, (uintptr_t) my_edata, 0, 0);
|
255
|
2432 #ifdef DOUG_LEA_MALLOC
|
|
2433 free (malloc_state_ptr);
|
|
2434 #endif
|
0
|
2435 }
|
|
2436 #endif /* not MSDOS and EMX */
|
|
2437
|
|
2438 purify_flag = opurify;
|
|
2439
|
|
2440 return Qnil;
|
|
2441 }
|
|
2442
|
|
2443 #endif /* not HAVE_SHM */
|
|
2444
|
|
2445 #endif /* not CANNOT_DUMP */
|
|
2446
|
|
2447 #ifndef SEPCHAR
|
|
2448 #define SEPCHAR ':'
|
|
2449 #endif
|
|
2450
|
267
|
2451 DEFUN ("decode-path-internal", Fdecode_path_internal, 1, 1, 0, /*
|
272
|
2452 Explode a colon-separated list of paths into a list of strings.
|
265
|
2453 */
|
|
2454 (cd_path))
|
|
2455 {
|
272
|
2456 if (NILP (cd_path))
|
|
2457 return Qnil;
|
|
2458
|
265
|
2459 CHECK_STRING (cd_path);
|
|
2460
|
272
|
2461 return !XSTRING_LENGTH (cd_path) ?
|
|
2462 list1 (Qnil) :
|
|
2463 decode_path ((char *) XSTRING_DATA (cd_path));
|
265
|
2464 }
|
|
2465
|
0
|
2466 Lisp_Object
|
177
|
2467 decode_path (CONST char *path)
|
0
|
2468 {
|
|
2469 REGISTER CONST char *p;
|
|
2470 Lisp_Object lpath = Qnil;
|
|
2471
|
272
|
2472 if (!path || !strlen (path)) return Qnil;
|
0
|
2473
|
|
2474 #if defined (MSDOS) || defined (WIN32)
|
|
2475 dostounix_filename (path);
|
|
2476 #endif
|
|
2477
|
|
2478 while (1)
|
|
2479 {
|
|
2480 p = strchr (path, SEPCHAR);
|
|
2481 if (!p) p = path + strlen (path);
|
276
|
2482 lpath = Fcons (make_string ((CONST Bufbyte *) path, p - path),
|
265
|
2483 lpath);
|
0
|
2484 if (*p)
|
|
2485 path = p + 1;
|
|
2486 else
|
|
2487 break;
|
|
2488 }
|
|
2489 return Fnreverse (lpath);
|
|
2490 }
|
|
2491
|
177
|
2492 Lisp_Object
|
|
2493 decode_env_path (CONST char *evarname, CONST char *default_)
|
|
2494 {
|
|
2495 REGISTER CONST char *path = 0;
|
|
2496 if (evarname)
|
|
2497 path = (char *) egetenv (evarname);
|
|
2498 if (!path)
|
|
2499 path = default_;
|
|
2500 if (!path)
|
|
2501 return Qnil;
|
|
2502 else
|
|
2503 return decode_path(path);
|
|
2504 }
|
|
2505
|
20
|
2506 DEFUN ("noninteractive", Fnoninteractive, 0, 0, 0, /*
|
0
|
2507 Non-nil return value means XEmacs is running without interactive terminal.
|
20
|
2508 */
|
|
2509 ())
|
0
|
2510 {
|
173
|
2511 return noninteractive ? Qt : Qnil;
|
0
|
2512 }
|
|
2513
|
|
2514 /* This flag is useful to define if you're under a debugger; this way, you
|
|
2515 can put a breakpoint of assert_failed() and debug multiple problems
|
|
2516 in one session without having to recompile. */
|
|
2517 /* #define ASSERTIONS_DONT_ABORT */
|
|
2518
|
70
|
2519 #ifdef USE_ASSERTIONS
|
0
|
2520 /* This highly dubious kludge ... shut up Jamie, I'm tired of your slagging. */
|
|
2521
|
|
2522 DOESNT_RETURN
|
|
2523 assert_failed (CONST char *file, int line, CONST char *expr)
|
|
2524 {
|
|
2525 stderr_out ("Fatal error: assertion failed, file %s, line %d, %s\n",
|
|
2526 file, line, expr);
|
|
2527 #undef abort /* avoid infinite #define loop... */
|
272
|
2528 #if defined (WINDOWSNT) && defined (DEBUG_XEMACS)
|
227
|
2529 DebugBreak ();
|
|
2530 #elif !defined (ASSERTIONS_DONT_ABORT)
|
0
|
2531 abort ();
|
|
2532 #endif
|
|
2533 }
|
70
|
2534 #endif /* USE_ASSERTIONS */
|
0
|
2535
|
|
2536 #ifdef QUANTIFY
|
280
|
2537 DEFUN ("quantify-start-recording-data", Fquantify_start_recording_data,
|
|
2538 0, 0, 0, /*
|
0
|
2539 Start recording Quantify data.
|
20
|
2540 */
|
|
2541 ())
|
0
|
2542 {
|
|
2543 quantify_start_recording_data ();
|
|
2544 return Qnil;
|
|
2545 }
|
|
2546
|
280
|
2547 DEFUN ("quantify-stop-recording-data", Fquantify_stop_recording_data,
|
|
2548 0, 0, 0, /*
|
0
|
2549 Stop recording Quantify data.
|
20
|
2550 */
|
|
2551 ())
|
0
|
2552 {
|
|
2553 quantify_stop_recording_data ();
|
|
2554 return Qnil;
|
|
2555 }
|
|
2556
|
20
|
2557 DEFUN ("quantify-clear-data", Fquantify_clear_data, 0, 0, 0, /*
|
0
|
2558 Clear all Quantify data.
|
20
|
2559 */
|
|
2560 ())
|
0
|
2561 {
|
|
2562 quantify_clear_data ();
|
|
2563 return Qnil;
|
|
2564 }
|
|
2565 #endif /* QUANTIFY */
|
|
2566
|
|
2567 void
|
|
2568 syms_of_emacs (void)
|
|
2569 {
|
|
2570 #ifndef CANNOT_DUMP
|
|
2571 #ifdef HAVE_SHM
|
20
|
2572 DEFSUBR (Fdump_emacs_data);
|
0
|
2573 #else
|
20
|
2574 DEFSUBR (Fdump_emacs);
|
0
|
2575 #endif
|
|
2576 #endif /* !CANNOT_DUMP */
|
|
2577
|
20
|
2578 DEFSUBR (Frun_emacs_from_temacs);
|
|
2579 DEFSUBR (Frunning_temacs_p);
|
|
2580 DEFSUBR (Finvocation_name);
|
|
2581 DEFSUBR (Finvocation_directory);
|
|
2582 DEFSUBR (Fkill_emacs);
|
|
2583 DEFSUBR (Fnoninteractive);
|
0
|
2584
|
|
2585 #ifdef QUANTIFY
|
20
|
2586 DEFSUBR (Fquantify_start_recording_data);
|
|
2587 DEFSUBR (Fquantify_stop_recording_data);
|
|
2588 DEFSUBR (Fquantify_clear_data);
|
0
|
2589 #endif /* QUANTIFY */
|
|
2590
|
267
|
2591 DEFSUBR (Fdecode_path_internal);
|
265
|
2592
|
0
|
2593 defsymbol (&Qkill_emacs_hook, "kill-emacs-hook");
|
|
2594 defsymbol (&Qsave_buffers_kill_emacs, "save-buffers-kill-emacs");
|
|
2595 }
|
|
2596
|
|
2597 void
|
|
2598 vars_of_emacs (void)
|
|
2599 {
|
|
2600 DEFVAR_BOOL ("suppress-early-error-handler-backtrace",
|
272
|
2601 &suppress_early_error_handler_backtrace /*
|
|
2602 Non-nil means early error handler shouldn't print a backtrace.
|
0
|
2603 */ );
|
|
2604
|
|
2605 DEFVAR_LISP ("command-line-args", &Vcommand_line_args /*
|
|
2606 Args passed by shell to XEmacs, as a list of strings.
|
|
2607 */ );
|
|
2608
|
|
2609 DEFVAR_LISP ("invocation-name", &Vinvocation_name /*
|
|
2610 The program name that was used to run XEmacs.
|
|
2611 Any directory names are omitted.
|
|
2612 */ );
|
|
2613
|
|
2614 DEFVAR_LISP ("invocation-directory", &Vinvocation_directory /*
|
|
2615 The directory in which the XEmacs executable was found, to run it.
|
|
2616 The value is simply the program name if that directory's name is not known.
|
|
2617 */ );
|
|
2618
|
269
|
2619 DEFVAR_LISP ("invocation-path", &Vinvocation_path /*
|
|
2620 The path in which the XEmacs executable was found, to run it.
|
|
2621 The value is simply the value of environment variable PATH on startup
|
|
2622 if XEmacs was found there.
|
|
2623 */ );
|
|
2624
|
0
|
2625 #if 0 /* FSFmacs */
|
|
2626 xxDEFVAR_LISP ("installation-directory", &Vinstallation_directory,
|
|
2627 "A directory within which to look for the `lib-src' and `etc' directories.\n"
|
|
2628 "This is non-nil when we can't find those directories in their standard\n"
|
|
2629 "installed locations, but we can find them\n"
|
|
2630 "near where the XEmacs executable was found.");
|
|
2631 #endif
|
|
2632
|
|
2633 DEFVAR_LISP ("system-type", &Vsystem_type /*
|
272
|
2634 Symbol indicating type of operating system you are using.
|
0
|
2635 */ );
|
|
2636 Vsystem_type = intern (SYSTEM_TYPE);
|
169
|
2637 Fprovide (intern(SYSTEM_TYPE));
|
0
|
2638
|
|
2639 #ifndef EMACS_CONFIGURATION
|
|
2640 # define EMACS_CONFIGURATION "UNKNOWN"
|
|
2641 #endif
|
|
2642 DEFVAR_LISP ("system-configuration", &Vsystem_configuration /*
|
272
|
2643 String naming the configuration XEmacs was built for.
|
0
|
2644 */ );
|
|
2645 Vsystem_configuration = Fpurecopy (build_string (EMACS_CONFIGURATION));
|
|
2646
|
175
|
2647 #ifndef EMACS_CONFIG_OPTIONS
|
|
2648 # define EMACS_CONFIG_OPTIONS "UNKNOWN"
|
|
2649 #endif
|
|
2650 DEFVAR_LISP ("system-configuration-options", &Vsystem_configuration_options /*
|
|
2651 String containing the configuration options XEmacs was built with.
|
|
2652 */ );
|
|
2653 Vsystem_configuration_options = Fpurecopy (build_string
|
|
2654 (EMACS_CONFIG_OPTIONS));
|
|
2655
|
165
|
2656 DEFVAR_LISP ("emacs-major-version", &Vemacs_major_version /*
|
|
2657 Major version number of this version of Emacs, as an integer.
|
|
2658 Warning: this variable did not exist in Emacs versions earlier than:
|
|
2659 FSF Emacs: 19.23
|
|
2660 XEmacs: 19.10
|
|
2661 */ );
|
|
2662 Vemacs_major_version = make_int (EMACS_MAJOR_VERSION);
|
|
2663
|
|
2664 DEFVAR_LISP ("emacs-minor-version", &Vemacs_minor_version /*
|
|
2665 Minor version number of this version of Emacs, as an integer.
|
|
2666 Warning: this variable did not exist in Emacs versions earlier than:
|
|
2667 FSF Emacs: 19.23
|
|
2668 XEmacs: 19.10
|
|
2669 */ );
|
|
2670 Vemacs_minor_version = make_int (EMACS_MINOR_VERSION);
|
|
2671
|
|
2672 DEFVAR_LISP ("emacs-beta-version", &Vemacs_beta_version /*
|
163
|
2673 Beta number of this version of Emacs, as an integer.
|
|
2674 The value is nil if this is an officially released version of XEmacs.
|
|
2675 Warning: this variable does not exist in FSF Emacs or in XEmacs versions
|
|
2676 earlier than 20.3.
|
|
2677 */ );
|
165
|
2678 #ifdef EMACS_BETA_VERSION
|
|
2679 Vemacs_beta_version = make_int (EMACS_BETA_VERSION);
|
|
2680 #else
|
|
2681 Vemacs_beta_version = Qnil;
|
163
|
2682 #endif
|
|
2683
|
278
|
2684 #ifdef INFODOCK
|
|
2685 DEFVAR_LISP ("infodock-major-version", &Vinfodock_major_version /*
|
|
2686 Major version number of this InfoDock release.
|
|
2687 */ );
|
|
2688 Vinfodock_major_version = make_int (INFODOCK_MAJOR_VERSION);
|
|
2689
|
|
2690 DEFVAR_LISP ("infodock-minor-version", &Vinfodock_minor_version /*
|
|
2691 Minor version number of this InfoDock release.
|
|
2692 */ );
|
|
2693 Vinfodock_minor_version = make_int (INFODOCK_MINOR_VERSION);
|
|
2694
|
|
2695 DEFVAR_LISP ("infodock-build-version", &Vinfodock_build_version /*
|
|
2696 Build version of this InfoDock release.
|
|
2697 */ );
|
|
2698 Vinfodock_build_version = make_int (INFODOCK_BUILD_VERSION);
|
|
2699 #endif
|
|
2700
|
163
|
2701 DEFVAR_LISP ("xemacs-codename", &Vxemacs_codename /*
|
|
2702 Codename of this version of Emacs (a string).
|
|
2703 */ );
|
|
2704 #ifndef XEMACS_CODENAME
|
165
|
2705 #define XEMACS_CODENAME "Noname"
|
163
|
2706 #endif
|
|
2707 Vxemacs_codename = Fpurecopy (build_string (XEMACS_CODENAME));
|
|
2708
|
0
|
2709 DEFVAR_BOOL ("noninteractive", &noninteractive1 /*
|
|
2710 Non-nil means XEmacs is running without interactive terminal.
|
|
2711 */ );
|
|
2712
|
276
|
2713 DEFVAR_BOOL ("inhibit-early-packages", &inhibit_early_packages /*
|
|
2714 Set to non-nil when the early packages should not be respected at startup.
|
|
2715 */ );
|
|
2716
|
|
2717 DEFVAR_BOOL ("inhibit-autoloads", &inhibit_autoloads /*
|
|
2718 Set to non-nil when autoloads should not be loaded at startup.
|
|
2719 */ );
|
|
2720
|
|
2721 DEFVAR_BOOL ("debug-paths", &debug_paths /*
|
|
2722 Set to non-nil when debug information about paths should be printed.
|
207
|
2723 */ );
|
|
2724
|
267
|
2725 DEFVAR_BOOL ("inhibit-site-lisp", &inhibit_site_lisp /*
|
|
2726 Set to non-nil when the site-lisp should not be searched at startup.
|
|
2727 */ );
|
269
|
2728 #ifdef INHIBIT_SITE_LISP
|
|
2729 inhibit_site_lisp = 1;
|
|
2730 #endif
|
267
|
2731
|
0
|
2732 DEFVAR_INT ("emacs-priority", &emacs_priority /*
|
|
2733 Priority for XEmacs to run at.
|
|
2734 This value is effective only if set before XEmacs is dumped,
|
|
2735 and only if the XEmacs executable is installed with setuid to permit
|
|
2736 it to change priority. (XEmacs sets its uid back to the real uid.)
|
|
2737 Currently, you need to define SET_EMACS_PRIORITY in `config.h'
|
|
2738 before you compile XEmacs, to enable the code for this feature.
|
|
2739 */ );
|
|
2740 emacs_priority = 0;
|
163
|
2741
|
276
|
2742 DEFVAR_CONST_LISP ("internal-error-checking", &Vinternal_error_checking /*
|
|
2743 Internal error checking built-in into this instance of XEmacs.
|
|
2744 This is a list of symbols, initialized at build-time. Legal symbols
|
|
2745 are:
|
|
2746
|
|
2747 extents - check extents prior to each extent change;
|
|
2748 typecheck - check types strictly, aborting in case of error;
|
|
2749 malloc - check operation of malloc;
|
|
2750 gc - check garbage collection;
|
|
2751 bufpos - check buffer positions.
|
|
2752 */ );
|
|
2753 Vinternal_error_checking = Qnil;
|
|
2754 #ifdef ERROR_CHECK_EXTENTS
|
|
2755 Vinternal_error_checking = Fcons (intern ("extents"),
|
|
2756 Vinternal_error_checking);
|
|
2757 #endif
|
|
2758 #ifdef ERROR_CHECK_TYPECHECK
|
|
2759 Vinternal_error_checking = Fcons (intern ("typecheck"),
|
|
2760 Vinternal_error_checking);
|
|
2761 #endif
|
|
2762 #ifdef ERROR_CHECK_MALLOC
|
|
2763 Vinternal_error_checking = Fcons (intern ("malloc"),
|
|
2764 Vinternal_error_checking);
|
|
2765 #endif
|
|
2766 #ifdef ERROR_CHECK_GC
|
|
2767 Vinternal_error_checking = Fcons (intern ("gc"),
|
|
2768 Vinternal_error_checking);
|
|
2769 #endif
|
|
2770 #ifdef ERROR_CHECK_BUFPOS
|
|
2771 Vinternal_error_checking = Fcons (intern ("bufpos"),
|
|
2772 Vinternal_error_checking);
|
|
2773 #endif
|
|
2774 Vinternal_error_checking = Fpurecopy (Vinternal_error_checking);
|
0
|
2775 }
|
267
|
2776
|
|
2777 void
|
|
2778 complex_vars_of_emacs (void)
|
|
2779 {
|
280
|
2780 /* This is all related to path searching. */
|
|
2781
|
|
2782 DEFVAR_LISP ("emacs-program-name", &Vemacs_program_name /*
|
|
2783 *Name of the Emacs variant.
|
|
2784 For example, this may be \"xemacs\" or \"infodock\".
|
|
2785 This is mainly meant for use in path searching.
|
|
2786 */ );
|
|
2787 Vemacs_program_name = build_string ((char *) PATH_PROGNAME);
|
|
2788
|
|
2789 DEFVAR_LISP ("emacs-program-version", &Vemacs_program_version /*
|
|
2790 *Version of the Emacs variant.
|
|
2791 This typically has the form XX.XX[-bXX].
|
|
2792 This is mainly meant for use in path searching.
|
|
2793 */ );
|
|
2794 Vemacs_program_version = build_string ((char *) PATH_VERSION);
|
|
2795
|
267
|
2796 DEFVAR_LISP ("exec-path", &Vexec_path /*
|
|
2797 *List of directories to search programs to run in subprocesses.
|
|
2798 Each element is a string (directory name) or nil (try default directory).
|
|
2799 */ );
|
|
2800 Vexec_path = Qnil;
|
|
2801
|
|
2802 DEFVAR_LISP ("exec-directory", &Vexec_directory /*
|
|
2803 *Directory of architecture-dependent files that come with XEmacs,
|
|
2804 especially executable programs intended for XEmacs to invoke.
|
|
2805 */ );
|
|
2806 Vexec_directory = Qnil;
|
|
2807
|
276
|
2808 DEFVAR_LISP ("configure-exec-directory", &Vconfigure_exec_directory /*
|
|
2809 For internal use by the build procedure only.
|
|
2810 configure's idea of what EXEC-DIRECTORY will be.
|
|
2811 */ );
|
|
2812 #ifdef PATH_EXEC
|
|
2813 Vconfigure_exec_directory = Ffile_name_as_directory
|
|
2814 (build_string ((char *) PATH_EXEC));
|
|
2815 #else
|
|
2816 Vconfigure_exec_directory = Qnil;
|
|
2817 #endif
|
|
2818
|
|
2819 DEFVAR_LISP ("lisp-directory", &Vlisp_directory /*
|
|
2820 *Directory of core Lisp files that come with XEmacs.
|
|
2821 */ );
|
|
2822 Vlisp_directory = Qnil;
|
|
2823
|
267
|
2824 DEFVAR_LISP ("configure-lisp-directory", &Vconfigure_lisp_directory /*
|
276
|
2825 For internal use by the build procedure only.
|
|
2826 configure's idea of what LISP-DIRECTORY will be.
|
267
|
2827 */ );
|
|
2828 #ifdef PATH_LOADSEARCH
|
|
2829 Vconfigure_lisp_directory = Ffile_name_as_directory
|
|
2830 (build_string ((char *) PATH_LOADSEARCH));
|
|
2831 #else
|
|
2832 Vconfigure_lisp_directory = Qnil;
|
|
2833 #endif
|
|
2834
|
|
2835 DEFVAR_LISP ("configure-package-path", &Vconfigure_package_path /*
|
|
2836 For internal use by the build procedure only.
|
278
|
2837 configure's idea of what the package path will be.
|
267
|
2838 */ );
|
|
2839 #ifdef PATH_PACKAGEPATH
|
|
2840 Vconfigure_package_path = decode_path (PATH_PACKAGEPATH);
|
|
2841 #else
|
|
2842 Vconfigure_package_path = Qnil;
|
|
2843 #endif
|
|
2844
|
|
2845 DEFVAR_LISP ("data-directory", &Vdata_directory /*
|
|
2846 *Directory of architecture-independent files that come with XEmacs,
|
|
2847 intended for XEmacs to use.
|
|
2848 Use of this variable in new code is almost never correct. See the
|
|
2849 function `locate-data-directory' and the variable `data-directory-list'.
|
|
2850 */ );
|
|
2851 Vdata_directory = Qnil;
|
|
2852
|
|
2853 DEFVAR_LISP ("configure-data-directory", &Vconfigure_data_directory /*
|
|
2854 For internal use by the build procedure only.
|
|
2855 configure's idea of what DATA-DIRECTORY will be.
|
|
2856 */ );
|
|
2857 #ifdef PATH_DATA
|
|
2858 Vconfigure_data_directory = Ffile_name_as_directory
|
|
2859 (build_string ((char *) PATH_DATA));
|
|
2860 #else
|
|
2861 Vconfigure_data_directory = Qnil;
|
|
2862 #endif
|
|
2863
|
|
2864 DEFVAR_LISP ("data-directory-list", &Vdata_directory_list /*
|
|
2865 *List of directories of architecture-independent files that come with XEmacs
|
|
2866 or were installed as packages, and are intended for XEmacs to use.
|
|
2867 */ );
|
|
2868 Vdata_directory_list = Qnil;
|
|
2869
|
|
2870 #ifdef CLASH_DETECTION
|
|
2871 DEFVAR_LISP ("configure-lock-directory", &Vconfigure_lock_directory /*
|
|
2872 For internal use by the build procedure only.
|
|
2873 configure's idea of what LOCK-DIRECTORY will be.
|
|
2874 */ );
|
|
2875 #ifdef PATH_LOCK
|
|
2876 Vconfigure_lock_directory = Ffile_name_as_directory
|
|
2877 (build_string ((char *) PATH_LOCK));
|
|
2878 #else
|
|
2879 Vconfigure_lock_directory = Qnil;
|
|
2880 #endif
|
|
2881 #endif /* CLASH_DETECTION */
|
|
2882
|
276
|
2883 DEFVAR_LISP ("site-directory", &Vsite_directory /*
|
|
2884 *Directory of site-specific Lisp files that come with XEmacs.
|
|
2885 */ );
|
|
2886 Vsite_directory = Qnil;
|
|
2887
|
267
|
2888 DEFVAR_LISP ("configure-site-directory", &Vconfigure_site_directory /*
|
|
2889 For internal use by the build procedure only.
|
|
2890 configure's idea of what SITE-DIRECTORY will be.
|
|
2891 */ );
|
|
2892 #ifdef PATH_SITE
|
|
2893 Vconfigure_site_directory = Ffile_name_as_directory
|
|
2894 (build_string ((char *) PATH_SITE));
|
|
2895 #else
|
|
2896 Vconfigure_site_directory = Qnil;
|
|
2897 #endif
|
|
2898
|
|
2899 DEFVAR_LISP ("doc-directory", &Vdoc_directory /*
|
|
2900 *Directory containing the DOC file that comes with XEmacs.
|
|
2901 This is usually the same as exec-directory.
|
|
2902 */ );
|
|
2903 Vdoc_directory = Qnil;
|
|
2904
|
|
2905 DEFVAR_LISP ("configure-doc-directory", &Vconfigure_doc_directory /*
|
|
2906 For internal use by the build procedure only.
|
|
2907 configure's idea of what DOC-DIRECTORY will be.
|
|
2908 */ );
|
|
2909 #ifdef PATH_DOC
|
|
2910 Vconfigure_doc_directory = Ffile_name_as_directory
|
|
2911 (build_string ((char *) PATH_DOC));
|
|
2912 #else
|
|
2913 Vconfigure_doc_directory = Qnil;
|
|
2914 #endif
|
|
2915
|
278
|
2916 DEFVAR_LISP ("configure-exec-prefix-directory", &Vconfigure_exec_prefix_directory /*
|
|
2917 For internal use by the build procedure only.
|
|
2918 configure's idea of what EXEC-PREFIX-DIRECTORY will be.
|
|
2919 */ );
|
|
2920 #ifdef PATH_EXEC_PREFIX
|
|
2921 Vconfigure_exec_prefix_directory = Ffile_name_as_directory
|
|
2922 (build_string ((char *) PATH_EXEC_PREFIX));
|
|
2923 #else
|
|
2924 Vconfigure_exec_prefix_directory = Qnil;
|
|
2925 #endif
|
|
2926
|
267
|
2927 DEFVAR_LISP ("configure-prefix-directory", &Vconfigure_prefix_directory /*
|
|
2928 For internal use by the build procedure only.
|
|
2929 configure's idea of what PREFIX-DIRECTORY will be.
|
|
2930 */ );
|
|
2931 #ifdef PATH_PREFIX
|
|
2932 Vconfigure_prefix_directory = Ffile_name_as_directory
|
|
2933 (build_string ((char *) PATH_PREFIX));
|
|
2934 #else
|
|
2935 Vconfigure_prefix_directory = Qnil;
|
|
2936 #endif
|
|
2937
|
|
2938 DEFVAR_LISP ("configure-info-directory", &Vconfigure_info_directory /*
|
|
2939 For internal use by the build procedure only.
|
|
2940 This is the name of the directory in which the build procedure installed
|
|
2941 Emacs's info files; the default value for Info-default-directory-list
|
|
2942 includes this.
|
|
2943 */ );
|
|
2944 #ifdef PATH_INFO
|
|
2945 Vconfigure_info_directory =
|
|
2946 Ffile_name_as_directory (build_string (PATH_INFO));
|
|
2947 #else
|
|
2948 Vconfigure_info_directory = Qnil;
|
|
2949 #endif
|
|
2950
|
|
2951 DEFVAR_LISP ("configure-info-path", &Vconfigure_info_path /*
|
|
2952 The configured initial path for info documentation.
|
|
2953 */ );
|
|
2954 #ifdef PATH_INFOPATH
|
|
2955 Vconfigure_info_path = decode_path (PATH_INFOPATH);
|
|
2956 #else
|
|
2957 Vconfigure_info_path = Qnil;
|
|
2958 #endif
|
|
2959 }
|