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